Skip to content

Upload an attachment to any supported entity

POST
/v1/attachments
curl --request POST \
--url https://api.varman.io/v1/attachments \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <X-API-Key>' \
--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" }'

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.

Media typeapplication/json
object
fileName
required

Name of the file

string
<= 255 characters

Example

document.pdf
fileType
required

MIME type of the file

string

Example

application/pdf
fileData

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.

string

Example

iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg==
s3Key

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.

string

Example

org_abc123/uploads/attachment/1700000000000-rbac-matrix.xlsx
description

Description of the attachment

string
<= 500 characters

Example

Meeting notes from Q4 planning session
userId

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

string

Example

usr_abc123def456
entityId
required

ID of the entity to attach the file to

string

Example

tsk_abc123def456
entityType
required

Type of entity the attachment belongs to

string
Allowed values: task vendor risk comment trust_nda task_item background_check employment_onboard employment_offboard offboarding_checklist context asset customer audit_request

Example

task

Attachment uploaded successfully

Media typeapplication/json
object
id
required

Unique identifier for the attachment

string
name
required

Original filename

string
type
required

File type/MIME type

string
size
required

File size in bytes

number
downloadUrl
required

Signed URL for downloading the file (temporary)

string
createdAt
required

Upload timestamp

string format: date-time

Example

{
"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"
}

Invalid file data, unsupported file type, or file too large

Media typeapplication/json
object
message
string

Example

{
"message": "File size exceeds maximum allowed size of 100MB"
}

Unauthorized - Invalid authentication

Media typeapplication/json
object
message
string

Example

{
"message": "Unauthorized"
}