Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.chamelio.ai/llms.txt

Use this file to discover all available pages before exploring further.

Endpoint

GET /files/{file_id}

Authentication

This endpoint requires authentication via API key. Include your API key in the X-API-Key header:
X-API-Key: ca_your_api_key_here

Path Parameters

ParameterTypeRequiredDescription
file_idstringYesUnique file identifier (format: document_{id} or attachment_{id})

Query Parameters

ParameterTypeRequiredDescription
user_emailstringNoEmail address of the user downloading the file (for audit purposes)

Request Example

curl -X GET "https://platform.chamelio.ai/files/document_789?user_email=john@example.com" \
  -H "X-API-Key: ca_your_api_key_here"

Response

Success Response

Status Code: 200 OK
{
  "file_id": "document_789",
  "file_name": "acme_contract.pdf",
  "content_type": "application/pdf",
  "download_url": "https://s3.amazonaws.com/chamelio-files/...",
  "expires_at": "2025-01-20T12:00:00Z"
}

Response Fields

FieldTypeDescription
file_idstringThe file identifier that was requested
file_namestringName of the file
content_typestringMIME type of the file (e.g., application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
download_urlstringPresigned URL to download the file
expires_atstringISO 8601 timestamp when the download URL expires

Error Responses

400 Bad Request

Returned when the file ID format is invalid.
{
  "detail": "Invalid file ID format: invalid_id"
}

401 Unauthorized

Returned when authentication fails. See the authentication errors section for details.
{
  "detail": "Invalid API key"
}

404 Not Found

Returned when the file doesn’t exist or you don’t have access to it.
{
  "detail": "File not found"
}

500 Internal Server Error

Returned when the request fails due to a server error.
{
  "detail": "Failed to download file"
}

Notes

File IDs follow a specific format: document_{id} for documents and attachment_{id} for attachments. Use the complete file ID as returned from other endpoints.
The presigned download URL expires after a certain time (indicated by expires_at). Download the file before the URL expires or request a new URL.
Provide the user_email parameter for audit tracking. This helps maintain a record of who downloaded which files and when.

Common MIME Types

ExtensionMIME Type
.pdfapplication/pdf
.docxapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
.docapplication/msword
.xlsxapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.txttext/plain
.pngimage/png
.jpg, .jpegimage/jpeg

Use Cases

This endpoint is useful for:
  • File retrieval - Download files uploaded to or generated by workflows
  • Document export - Export documents to external systems
  • Archival - Save files to long-term storage
  • User downloads - Allow end users to download files through custom interfaces
  • Integration - Connect file storage with other business systems