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

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

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

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
file
required
The document file to upload.
title
string
required
The title for the document.
document_type
string
required
The type of document: glossary, styleguide, or reference.

Optional form fields

description
string
A description of the document.
languages
string
Comma-separated language codes of the document content.
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 "languages=en"
Response
{
  "id": 1,
  "store_id": 1,
  "title": "Product Style Guide",
  "description": "Official style guide for product documentation",
  "document_type": "styleguide",
  "languages": ["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

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.
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",
  "languages": ["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

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

title
string
The title of the document.
description
string
A description of the document.
document_type
string
The type of document: glossary, styleguide, or reference.
languages
array of strings
Language codes of the document content.
is_active
boolean
Whether or not the document is active.
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",
    "languages": ["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",
  "languages": ["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

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.
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

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

delete_s3_file
boolean
Whether to delete the associated S3 file (default: true).
curl -X DELETE https://api.elanlanguages.ai/v1/context/1/documents/1 \
  -H "Authorization: Bearer {token}" \
  -H "X-Org-Id: {orgId}"