Skip to main content
Context documents are reference files stored within a context store. These can be glossaries, style guides, or reference materials that support your translation workflows. On this page, we’ll dive into the different context document endpoints you can use to manage documents programmatically.

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

integer
Unique identifier for the context document.
integer
The ID of the context store this document belongs to.
string
The title of the document.
string
An optional description of the document.
string
The type of document. Possible values: glossary, styleguide, reference.
array of strings
Language codes of the document content (optional).
string
The processing status. Possible values: processing, ready, failed.
string
The original filename of the uploaded file.
string
The file extension type.
integer
Size of the file in bytes.
string
The MIME type of the file (optional).
boolean
Whether or not the document is active.
timestamp
Timestamp of when the document was uploaded.
timestamp
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

integer
Maximum number of documents to return (default: 50).
integer
Number of documents to skip (default: 0).
string
Filter by document type: glossary, styleguide, or reference.
string
Filter by document language. Matches documents that have the specified language in their languages list.
boolean
Filter by active status.
string
Field to order by (default: “created_at”).
boolean
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 file

Required form fields

file
required
The document file to upload.
string
required
The title for the document.
string
required
The type of document: glossary, styleguide, or reference.

Optional form fields

string
A description of the document.
string
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

string
The title of the document.
string
A description of the document.
string
The type of document: glossary, styleguide, or reference.
array of strings
Language codes of the document content.
boolean
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

boolean
Whether to delete the associated S3 file (default: true).