The context document model
The context document model contains metadata about files stored in a context store, including the title, type, language, and processing status.Properties
Unique identifier for the context document.
The ID of the context store this document belongs to.
The title of the document.
An optional description of the document.
The type of document. Possible values:
glossary, styleguide, reference.Language codes of the document content (optional).
The processing status. Possible values:
processing, ready, failed.The original filename of the uploaded file.
The file extension type.
Size of the file in bytes.
The MIME type of the file (optional).
Whether or not the document is active.
Timestamp of when the document was uploaded.
Timestamp of when the document was last updated.
List all context documents
GET /v1/context/:store_id/documents
This endpoint allows you to retrieve a paginated list of all documents in a context store. By default, a maximum of 50 documents are shown per page.
Optional parameters
Maximum number of documents to return (default: 50).
Number of documents to skip (default: 0).
Filter by document type:
glossary, styleguide, or reference.Filter by document language. Matches documents that have the specified language in their languages list.
Filter by active status.
Field to order by (default: “created_at”).
Order in descending order (default: true).
Response
Upload a context document
POST /v1/context/:store_id/documents
This endpoint allows you to upload a new document to a context store. Documents are uploaded using multipart form data and stored in S3. Metadata is stored in the database with a reference to the S3 file.
Supported file types
- PDF (.pdf)
- Microsoft Word (.docx)
- CSV (.csv)
- Text (.txt)
Maximum file size
50MB per fileRequired form fields
The document file to upload.
The title for the document.
The type of document:
glossary, styleguide, or reference.Optional form fields
A description of the document.
Comma-separated language codes of the document content.
Response
Retrieve a context document
GET /v1/context/:store_id/documents/:document_id
This endpoint allows you to retrieve metadata about a specific context document. To download the actual file content, use the download endpoint.
Response
Update a context document
PUT /v1/context/:store_id/documents/:document_id
This endpoint allows you to update the metadata of a context document. Note: You cannot change the file itself through this endpoint. To replace a file, delete the document and upload a new one.
Optional attributes
The title of the document.
A description of the document.
The type of document:
glossary, styleguide, or reference.Language codes of the document content.
Whether or not the document is active.
Response
Download a context document
GET /v1/context/:store_id/documents/:document_id/download
This endpoint allows you to download the actual file content of a context document from S3. The response will be the document file itself with appropriate content-type headers set based on the file type.
Delete a context document
DELETE /v1/context/:store_id/documents/:document_id
This endpoint allows you to delete a context document. This is a soft delete operation. By default, this will also remove the associated S3 file.
Optional parameters
Whether to delete the associated S3 file (default: true).