Endpoint
GET /tasks/{task_id}/files
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
| Parameter | Type | Required | Description |
|---|
task_id | integer | Yes | Unique identifier for the task |
Request Example
curl -X GET "https://platform.chamelio.ai/tasks/12345/files" \
-H "X-API-Key: ca_your_api_key_here"
import requests
task_id = 12345
url = f"https://platform.chamelio.ai/tasks/{task_id}/files"
headers = {
"X-API-Key": "ca_your_api_key_here"
}
response = requests.get(url, headers=headers)
print(response.json())
const taskId = 12345;
const response = await fetch(
`https://platform.chamelio.ai/tasks/${taskId}/files`,
{
method: 'GET',
headers: {
'X-API-Key': 'ca_your_api_key_here'
}
}
);
const data = await response.json();
console.log(data);
Response
Success Response
Status Code: 200 OK
{
"task_id": 12345,
"files": [
{
"file_id": "document_789",
"file_name": "acme_contract.pdf",
"variable_id": "contract_file",
"created_at": "2025-01-20T10:30:00Z",
"step_id": "intake_step"
},
{
"file_id": "document_790",
"file_name": "reviewed_contract.pdf",
"variable_id": null,
"created_at": "2025-01-20T10:45:00Z",
"step_id": "review_step"
},
{
"file_id": "attachment_123",
"file_name": "insurance_certificate.pdf",
"variable_id": "insurance_doc",
"created_at": "2025-01-20T11:00:00Z",
"step_id": "approval_step"
}
],
"total_files": 3
}
Response Fields
| Field | Type | Description |
|---|
task_id | integer | ID of the task |
files | array | List of files associated with the task (maximum 10 files returned) |
total_files | integer | Total number of files for this task |
File Object Fields
| Field | Type | Description |
|---|
file_id | string | Unique file identifier (format: document_{id} for documents, attachment_{id} for attachments) |
file_name | string | Name of the file |
variable_id | string | ID of the variable this file is associated with (null if generated by a step) |
created_at | string | ISO 8601 timestamp when the file was created/uploaded |
step_id | string | ID of the workflow step that created or collected this file |
Error Responses
401 Unauthorized
Returned when authentication fails. See the authentication errors section for details.
{
"detail": "Invalid API key"
}
404 Not Found
Returned when the task doesn’t exist or you don’t have access to it.
{
"detail": "Task not found"
}
500 Internal Server Error
Returned when the request fails due to a server error.
{
"detail": "Failed to list task files"
}
Notes
This endpoint returns up to 10 files by default. If the task has more than 10 files, only the first 10 are returned. Use the total_files count to determine if there are more files.
Use the file_id from this response with the Download File endpoint to retrieve the actual file content.
File IDs are prefixed with document_ for documents and attachment_ for attachments. Ensure you pass the complete file ID including the prefix when downloading files.
Use Cases
This endpoint is useful for:
- File inventory - List all files involved in a workflow task
- Document tracking - Track which documents were uploaded or generated at each step
- Bulk download - Retrieve file IDs for downloading all task-related files
- Audit trails - Document what files were part of a workflow execution