Context Documents
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
- Name
id- Type
- integer
- Description
Unique identifier for the context document.
- Name
store_id- Type
- integer
- Description
The ID of the context store this document belongs to.
- Name
title- Type
- string
- Description
The title of the document.
- Name
description- Type
- string
- Description
An optional description of the document.
- Name
document_type- Type
- string
- Description
The type of document. Possible values:
glossary,styleguide,reference.
- Name
language- Type
- string
- Description
The primary language code of the document content (optional).
- Name
status- Type
- string
- Description
The processing status. Possible values:
processing,ready,failed.
- Name
file_name- Type
- string
- Description
The original filename of the uploaded file.
- Name
file_type- Type
- string
- Description
The file extension type.
- Name
file_size- Type
- integer
- Description
Size of the file in bytes.
- Name
mime_type- Type
- string
- Description
The MIME type of the file (optional).
- Name
is_active- Type
- boolean
- Description
Whether or not the document is active.
- Name
created_at- Type
- timestamp
- Description
Timestamp of when the document was uploaded.
- Name
updated_at- Type
- timestamp
- Description
Timestamp of when the document was last updated.
List all context 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
- Name
limit- Type
- integer
- Description
Maximum number of documents to return (default: 50).
- Name
offset- Type
- integer
- Description
Number of documents to skip (default: 0).
- Name
document_type- Type
- string
- Description
Filter by document type:
glossary,styleguide, orreference.
- Name
language- Type
- string
- Description
Filter by document language.
- Name
is_active- Type
- boolean
- Description
Filter by active status.
- Name
order_by- Type
- string
- Description
Field to order by (default: "created_at").
- Name
order_desc- Type
- boolean
- Description
Order in descending order (default: true).
Request
curl -G https://api.elanlanguages.ai/v1/context/1/documents \
-H "Authorization: Bearer {token}" \
-H "X-Org-Id: {orgId}"
Response
{
"documents": [
{
"id": 1,
"store_id": 1,
"title": "Product Style Guide",
"description": "Official style guide for product documentation",
"document_type": "styleguide",
"language": "en",
"status": "ready",
"file_name": "style-guide.pdf",
"file_type": "pdf",
"file_size": 2048576,
"mime_type": "application/pdf",
"is_active": true,
"created_at": "2025-12-21T10:30:29.114Z",
"updated_at": "2025-12-21T10:30:29.114Z"
}
],
"total": 1,
"limit": 50,
"offset": 0
}
Upload a context document
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
- Name
file- Type
- file
- Description
The document file to upload.
- Name
title- Type
- string
- Description
The title for the document.
- Name
document_type- Type
- string
- Description
The type of document:
glossary,styleguide, orreference.
Optional form fields
- Name
description- Type
- string
- Description
A description of the document.
- Name
language- Type
- string
- Description
The primary language code of the document content.
Request
curl https://api.elanlanguages.ai/v1/context/1/documents \
-H "Authorization: Bearer {token}" \
-H "X-Org-Id: {orgId}" \
-F "file=@/path/to/style-guide.pdf" \
-F "title=Product Style Guide" \
-F "document_type=styleguide" \
-F "description=Official style guide for product documentation" \
-F "language=en"
Response
{
"id": 1,
"store_id": 1,
"title": "Product Style Guide",
"description": "Official style guide for product documentation",
"document_type": "styleguide",
"language": "en",
"status": "processing",
"file_name": "style-guide.pdf",
"file_type": "pdf",
"file_size": 2048576,
"mime_type": "application/pdf",
"is_active": true,
"created_at": "2025-12-21T10:34:41.135Z",
"updated_at": "2025-12-21T10:34:41.135Z"
}
Retrieve a context document
This endpoint allows you to retrieve metadata about a specific context document. To download the actual file content, use the download endpoint.
Request
curl https://api.elanlanguages.ai/v1/context/1/documents/1 \
-H "Authorization: Bearer {token}" \
-H "X-Org-Id: {orgId}"
Response
{
"id": 1,
"store_id": 1,
"title": "Product Style Guide",
"description": "Official style guide for product documentation",
"document_type": "styleguide",
"language": "en",
"status": "ready",
"file_name": "style-guide.pdf",
"file_type": "pdf",
"file_size": 2048576,
"mime_type": "application/pdf",
"is_active": true,
"created_at": "2025-12-21T10:34:41.135Z",
"updated_at": "2025-12-21T10:34:41.135Z"
}
Update a context document
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
- Name
title- Type
- string
- Description
The title of the document.
- Name
description- Type
- string
- Description
A description of the document.
- Name
document_type- Type
- string
- Description
The type of document:
glossary,styleguide, orreference.
- Name
language- Type
- string
- Description
The primary language code of the document content.
- Name
is_active- Type
- boolean
- Description
Whether or not the document is active.
Request
curl -X PUT https://api.elanlanguages.ai/v1/context/1/documents/1 \
-H "Authorization: Bearer {token}" \
-H "X-Org-Id: {orgId}" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated Style Guide",
"language": "en-US",
"is_active": true
}'
Response
{
"id": 1,
"store_id": 1,
"title": "Updated Style Guide",
"description": "Official style guide for product documentation",
"document_type": "styleguide",
"language": "en-US",
"status": "ready",
"file_name": "style-guide.pdf",
"file_type": "pdf",
"file_size": 2048576,
"mime_type": "application/pdf",
"is_active": true,
"created_at": "2025-12-21T10:34:41.135Z",
"updated_at": "2025-12-21T10:39:04.329Z"
}
Download a context document
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.
Request
curl https://api.elanlanguages.ai/v1/context/1/documents/1/download \
-H "Authorization: Bearer {token}" \
-H "X-Org-Id: {orgId}" \
--output style-guide.pdf
Delete a context document
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
- Name
delete_s3_file- Type
- boolean
- Description
Whether to delete the associated S3 file (default: true).
Request
curl -X DELETE https://api.elanlanguages.ai/v1/context/1/documents/1 \
-H "Authorization: Bearer {token}" \
-H "X-Org-Id: {orgId}"