Document Custom Fields
This scenario demonstrates how to attach custom fields to a document during creation and how to retrieve them later. Custom fields are intended mainly for integrations to enrich documents with external data that is not part of the metadata definition. Key features:- Attach custom fields during document creation
- Expose custom fields as imported fields in the sharing UI
- Retrieve custom fields via the document detail endpoint
During the sharing flow, the creator can place imported fields in the UI based on the custom fields attached to the document.
Prerequisites
Before creating a document with custom fields, you need:- A valid authentication token (see the “Authentication & Security” section for details)
- A PDF file to upload as the document content
- Knowledge of the document metadata definition and workflow you want to use
Custom fields are always stored and returned as strings. For the “date” type, you can provide either ISO string or epoch millis; the API normalizes the value to ISO.
Step 1 - Upload a PDF file
Before creating a document, upload the PDF file that will serve as the document content.- The file is uploaded as a multipart/form-data request
- The response includes the file ID that will be used when creating the document
- The response includes storage quota information
- fileId - Located at
file.idin the response.- Example value:
pRUWgn1sGvpYLsM0gpOTE4IYOBSwUOwLkbi5rFPgOmKLLQtZEPtVSRZgBZlsDo7k
- Example value:
Step 2 - Create a document with custom fields
This step creates a new document and attaches custom fields in the request body.- Each custom field includes key, displayName, type, and value
- Allowed types are string, number, and date
- All values are stored and returned as strings; date values are normalized to ISO
- documentId - Located at
results[0].documentIdin the response.- The unique identifier of the created document.
- Example value:
f61d58e7-6f44-4ff4-af05-fda45fbcd6f0
Step 3 - Retrieve document details including custom fields
Fetch the document details to verify that custom fields are stored and returned as part of the document body. The response includes the normalized values.- The response includes the full document metadata
- Custom fields are returned in the customFields array
- Date values are returned as ISO strings
Custom Fields Summary
You have created a document with custom fields and retrieved them back via the document detail endpoint.Key Concepts
- Custom fields: Additional key-value data that you attach to documents
- Storage format: All values are stored and returned as strings
- Date normalization: Date values are returned in ISO format
Example Implementation
See our OpenAPI documentation to learn about the full set of API endpoints and parameters.
Please use proper exception handling and function decomposition in your own code. The code is provided for illustrative purposes only and is not intended for production use.