Skip to content

Add a file or link attachment to a task

POST
/tasks/{id}/attachments
Code sample: Shell / cURL
curl --request POST \
--url https://example.com/api/v1/tasks/example/attachments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "commentId": "example", "kind": "link", "title": "example", "url": "https://example.com" }'

Registers an already-uploaded file (kind omitted or "file": the url from POST /uploads/file or POST /uploads/url (after the PUT), an s3: key, a /uploads/ path or an absolute http(s) URL) or an external link (kind: "link" with url and an optional title) on the task. A storage key (of either kind) must belong to this workspace, or the request is a 400. An optional commentId places it on a comment of the same task; a comment of another task is a 404. Requires the tasks.manage permission.

id
required

Resource identifier (CUID2).

string
>= 1 characters

Resource identifier (CUID2).

Media typeapplication/json
Any of:
object
commentId

Comment of the same task the attachment arrived on. A comment of another task is a 404.

string
>= 1 characters
kind
required
string
Allowed value: link
title

Display title. Omitted, the page title from the link’s embed metadata is used, else its host and path.

string
>= 1 characters <= 500 characters
url
required

Absolute http(s) URL of the linked resource.

string format: uri
<= 2048 characters

The created attachment.

Media typeapplication/json
object
data
required

A file or link attached to a task.

object
commentId
required

The comment of this task the attachment arrived on, when it did.

string | null
createdAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
fileName
required

File name, or the title of a link.

string
fileSize
required

File size in bytes; 0 for a link.

integer
>= -9007199254740991 <= 9007199254740991
fileUrl
required

Stored file reference (/api/v1/files/..., s3:, /uploads/), or the linked URL.

string
id
required
string
kind
required

“file” for an uploaded file, “link” for an external URL (Loom, Figma, Drive…).

string
Allowed values: file link
mimeType
required

“text/uri-list” for a link.

string
uploadedById
required

WorkspaceMember id of the uploader.

string

Example

{
"data": {
"kind": "file"
}
}

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

Not found.

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.