Attachments

Generate signed download links for files attached to compliance tasks, comments, evidence records, and workflow reviews.

Upload an attachment to any supported entity

POST/v1/attachments

Upload a base64-encoded file and attach it to a task, vendor, risk, comment, or other supported entity type. The file is uploaded to S3 and a database record is created.

Request body

fileNamestringrequired

Name of the file

fileTypestringrequired

MIME type of the file

fileDatastring

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.

s3Keystring

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.

descriptionstring

Description of the attachment

userIdstring

User ID of the user uploading the attachment (required for API key auth, ignored for JWT auth)

entityIdstringrequired

ID of the entity to attach the file to

entityTypeobjectrequired

Type of entity the attachment belongs to

Responses

201Attachment uploaded successfully
idstringrequired

Unique identifier for the attachment

namestringrequired

Original filename

typestringrequired

File type/MIME type

sizenumberrequired

File size in bytes

downloadUrlstringrequired

Signed URL for downloading the file (temporary)

createdAtstringrequired

Upload timestamp

{
  "id": "att_abc123def456",
  "name": "document.pdf",
  "type": "application/pdf",
  "size": 1024000,
  "downloadUrl": "https://bucket.s3.amazonaws.com/path/to/file.pdf?signature=...",
  "createdAt": "2024-01-15T10:30:00Z"
}
400Invalid file data, unsupported file type, or file too large
messagestring
{
  "message": "File size exceeds maximum allowed size of 100MB"
}
401Unauthorized - Invalid authentication
messagestring
{
  "message": "Unauthorized"
}
curl --request POST \
  --url https://api.complianz.ai/v1/attachments \
  --header 'X-API-Key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "fileName": "document.pdf",
    "fileType": "application/pdf",
    "fileData": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg==",
    "s3Key": "org_abc123/uploads/attachment/1700000000000-rbac-matrix.xlsx",
    "description": "Meeting notes from Q4 planning session",
    "userId": "usr_abc123def456",
    "entityId": "tsk_abc123def456",
    "entityType": "task"
  }'

Get shared attachment download URL

GET/v1/attachments/{attachmentId}/download

Generate a signed download URL for a shared attachment linked to comments, evidence records, or compliance workflow reviews.

Path parameters

attachmentIdstringrequired

Unique attachment identifier

Responses

200Download URL generated successfully
downloadUrlstring

Signed URL for downloading the file

expiresInnumber

URL expiration time in seconds

{
  "downloadUrl": "https://bucket.s3.amazonaws.com/path/to/file.pdf?signature=...",
  "expiresIn": 900
}
curl --request GET \
  --url https://api.complianz.ai/v1/attachments/<attachmentId>/download \
  --header 'X-API-Key: <api-key>'