Skip to content

Upload a file to attach to a task or a deal

POST
/uploads/file
Code sample: Shell / cURL
curl --request POST \
--url https://example.com/api/v1/uploads/file \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@file \
--form purpose=task

Accepts one multipart attachment up to 25 MB in the authenticated workspace. Executables (.exe, .msi, .sh, .bat, .jar, …) are refused by extension. HTML, HTM, SVG, JS, MJS and TS are allowed and served as attachment downloads with application/octet-stream and X-Content-Type-Options: nosniff. MIME is derived from the filename, ignoring the client hint. Returns url and its fileUrl alias with fileName, fileSize and mimeType; pass the returned data object unchanged to POST /tasks/{id}/attachments. With purpose=deal the file must be a type a deal accepts, is stored apart from task attachments, and is attached with POST /deals/{id}/attachments by the same member; it requires the Sales module and deals.manage (404 MODULE_DISABLED or 403 otherwise). MCP upload-file accepts the equivalent fileName and fileBase64 (25 MB decoded), then add-task-attachment accepts url, name, fileSize and mimeType. The same storage validation and workspace quota apply to both interfaces. REST uploads have a separate workspace/user quota bucket using the configured write limit (default 60 requests per minute). A 429 returns Retry-After and RateLimit headers.

Media typemultipart/form-data
object
file
required

Any attachment up to 25 MB. HTML, SVG and source code are served as inert downloads. Executable types (.exe, .sh, .bat, …) are refused by extension. MIME is determined by the server.

string format: binary
purpose

“task” (default) for a task, ticket or project attachment; “deal” for a file to attach to a deal with POST /deals/{id}/attachments, which must be PDF or DOCX.

string
Allowed values: task deal

File stored.

Media typeapplication/json
object
data
required

Reference and metadata of an uploaded file, ready to attach to a task.

object
fileName
required

Original file name, as uploaded.

string
fileSize
required

File size in bytes.

integer
>= -9007199254740991 <= 9007199254740991
fileUrl
required

Alias of url accepted directly by POST /tasks/{id}/attachments.

string
mimeType
required

Server-derived MIME type from the file extension; source and markup use application/octet-stream.

string
url
required

Relative /api/v1/files/... URL of the stored file. Pass it as fileUrl to POST /tasks/{id}/attachments.

string

Example generated

{
"data": {
"fileName": "example",
"fileSize": 1,
"fileUrl": "example",
"mimeType": "example",
"url": "example"
}
}

Validation error. Parse failures include field paths and expectations.

Media typeapplication/json

Validation error with safe field paths and expected values; submitted values are never returned.

object
error
required
object
code
required

Stable machine-readable error code.

string
issues
Array<object>
object
expected
required
string
message
required
string
path
required
Array<string | number>
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

purpose=deal and the Sales module is turned off (MODULE_DISABLED).

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Workspace storage quota exceeded.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.