Create or update a document

This endpoint performs an upsert operation: it creates a new document or updates an existing one
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 update an existing document
  • If the document doesn't exist, a 404 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, it will be updated
  • 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.

Required Fields

  • title: Document title (required)
  • body: Document content, supports HTML (required)
  • One identifier: either document_id OR custom_document_id (required)

AI Training

If is_ai_enabled is set to true, the document will be trained for AI-powered features.
Note: AI training can take a few minutes to complete. The document will have ai_training_status: "to_train"
initially, and will change to "trained" once the training process is complete.

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 creating/updating the document

Content Visibility

Use contact_segment_ids and company_segment_ids to restrict access to this document inside Aura
(the AI assistant). Only contacts and companies belonging to the specified segments will be able to
access this content through Aura.

If a document has no explicit visibility rules, it inherits them from its parent folder (if any).

  • Omit the field (or pass null) to leave existing visibilities unchanged.
  • Pass an empty array [] to remove all visibility restrictions for that segment type.
  • Pass a non-empty array to replace the current visibilities with exactly those segment IDs.

Requires the content_visibility feature on your plan.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params

Document data for creation/update

integer

Customerly document ID (use this to update an existing document by internal ID)

string

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

string

Optional external URL reference

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')

string
required

Document title

string
required

Document content (supports HTML)

boolean

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

contact_segment_ids
array of integers | null

Restrict visibility to contacts belonging to these segment IDs. Pass an empty array to remove all restrictions.

contact_segment_ids
company_segment_ids
array of integers | null

Restrict visibility to companies belonging to these segment IDs. Pass an empty array to remove all restrictions.

company_segment_ids
Responses

401

Authentication required

403

Permission denied

404

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

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