Upload a document file

This endpoint performs an upsert operation for document files: it uploads a new document or replaces
an existing document's file based on the identifier you provide.

Document Identification

You must provide exactly one of the following identifiers (providing both will result in an error):

1. document_id (integer):

  • Use the internal Customerly document ID to replace an existing document's file
  • If the document doesn't exist or is currently processing, an error will be returned

2. custom_document_id (string):

  • Use your custom identifier for upsert operations
  • If a document with this custom_document_id exists, its file will be replaced
  • If it doesn't exist, a new document will be created with this identifier
  • Must be unique within your app

Important: You cannot specify both document_id and custom_document_id in the same request.
If neither is provided, the upload will fail.

File Requirements

  • Supported formats: PDF, Word (doc/docx), TXT
  • Maximum size: 100MB
  • Required: You must include a file in the request

Processing

The document content will be extracted asynchronously:

  1. Initial status will be processing
  2. Once extraction completes successfully, status changes to active
  3. If extraction fails, status will be set to failed

You can poll the GET /documents/{id} endpoint to check the current processing status.

Title

  • If title is not provided, the filename (without extension) will be used as the document title

AI Training

If is_ai_enabled is set to true, the document will be trained for AI-powered features after text extraction.
Note: AI training can take a few minutes to complete after the document status becomes active.

Document Folders

To organize documents in folders, use the polymorphic_folder_id parameter:

  1. Create folders in the Customerly UI or use GET /documents/folders to list existing folders
  2. Get the folder ID from the response
  3. Pass the folder ID in the polymorphic_folder_id parameter when uploading the document
Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params

File to upload with metadata

file
required

PDF, Word or TXT document (max 100MB)

integer

Customerly document ID (use this to replace an existing document's file)

string

Your custom identifier (use this for upsert by custom ID)

string

Document title (if not provided, filename will be used)

string

Optional folder identifier. Use the numeric folder ID (e.g., '42') or your custom folder ID prefixed with 'cid:' (e.g., 'cid:fld_manuals')

boolean

Whether this document should be used for AI training (default: false)

Responses

400

Invalid file or request data

401

Authentication required

403

Permission denied

404

Document folder not found (if polymorphic_folder_id is provided and invalid)

409

Document is currently being processed

422

The request is not valid

Language
Credentials
Bearer
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json