curl --request POST \
--url https://api.trycomp.ai/v1/tasks/{taskId}/attachments \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"fileName": "document.pdf",
"fileType": "application/pdf"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({fileName: 'document.pdf', fileType: 'application/pdf'})
};
fetch('https://api.trycomp.ai/v1/tasks/{taskId}/attachments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.trycomp.ai/v1/tasks/{taskId}/attachments"
payload = {
"fileName": "document.pdf",
"fileType": "application/pdf"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "att_abc123def456",
"entityId": "tsk_abc123def456",
"entityType": "task",
"fileName": "evidence.pdf",
"fileType": "application/pdf",
"fileSize": 123456,
"createdAt": "2024-01-01T00:00:00Z",
"createdBy": "usr_abc123def456"
}{
"message": "File exceeds maximum allowed size"
}{
"message": "Unauthorized"
}{
"message": "Task with ID tsk_abc123def456 not found"
}Upload task evidence | Comp AI API
Upload an evidence attachment to a task so auditors and reviewers can trace completion back to source documentation.
curl --request POST \
--url https://api.trycomp.ai/v1/tasks/{taskId}/attachments \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"fileName": "document.pdf",
"fileType": "application/pdf"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({fileName: 'document.pdf', fileType: 'application/pdf'})
};
fetch('https://api.trycomp.ai/v1/tasks/{taskId}/attachments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.trycomp.ai/v1/tasks/{taskId}/attachments"
payload = {
"fileName": "document.pdf",
"fileType": "application/pdf"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "att_abc123def456",
"entityId": "tsk_abc123def456",
"entityType": "task",
"fileName": "evidence.pdf",
"fileType": "application/pdf",
"fileSize": 123456,
"createdAt": "2024-01-01T00:00:00Z",
"createdBy": "usr_abc123def456"
}{
"message": "File exceeds maximum allowed size"
}{
"message": "Unauthorized"
}{
"message": "Task with ID tsk_abc123def456 not found"
}Authorizations
API key for authentication
Path Parameters
Unique task identifier
"tsk_abc123def456"
Body
Name of the file
255"document.pdf"
MIME type of the file
"application/pdf"
Base64-encoded file contents. For the web UI / direct callers. AI/MCP clients should instead upload via /v1/uploads/presign (purpose=attachment) and pass s3Key — base64 through an LLM is impractically slow and times out. Provide exactly one of fileData or s3Key.
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg=="
Key of a file already uploaded via /v1/uploads/presign (purpose=attachment). The server fetches the bytes from storage — no base64 needed. Provide exactly one of fileData or s3Key.
"org_abc123/uploads/attachment/1700000000000-rbac-matrix.xlsx"
Description of the attachment
500"Meeting notes from Q4 planning session"
User ID of the user uploading the attachment (required for API key auth, ignored for JWT auth)
"usr_abc123def456"
Response
Attachment uploaded successfully
Unique identifier for the attachment
"att_abc123def456"
Original filename
"document.pdf"
File type/MIME type
"application/pdf"
File size in bytes
1024000
Signed URL for downloading the file (temporary)
"https://bucket.s3.amazonaws.com/path/to/file.pdf?signature=..."
Upload timestamp
"2024-01-15T10:30:00Z"
Was this page helpful?

