Attach an existing Optiwork Drive file to a card
POST
/boards/{board}/cards/{card}/files/attach
const url = 'https://projects.work.optidata.cloud/api/boards/1/cards/1/files/attach';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"brand-guidelines.pdf","size_bytes":482133,"mime_type":"application/pdf","meta":{"node_id":7788,"drive_id":1}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://projects.work.optidata.cloud/api/boards/1/cards/1/files/attach \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "brand-guidelines.pdf", "size_bytes": 482133, "mime_type": "application/pdf", "meta": { "node_id": 7788, "drive_id": 1 } }'Links a file that already lives in the tenant’s Optiwork Drive to the
card, without uploading new content. Provide the Drive node metadata in
meta instead of a binary blob.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”board
required
integer
Board id.
card
required
integer
Card id (must belong to the board).
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
name
required
string
size_bytes
required
integer
mime_type
required
string
meta
required
Optiwork Drive node metadata identifying the file to link.
object
Example
{ "name": "brand-guidelines.pdf", "size_bytes": 482133, "mime_type": "application/pdf", "meta": { "node_id": 7788, "drive_id": 1 }}Responses
Section titled “Responses”The linked file with access URLs.
Media typeapplication/json
object
file
object
id
integer
identifier
Opaque file identifier used in file URLs.
string
download_url
string format: uri
content_url
Inline-content URL (renders in the editor).
string format: uri
view_url
Signed Optiwork Drive viewer URL.
string | null format: uri
Examplegenerated
{ "file": { "id": 1, "identifier": "example", "download_url": "https://example.com", "content_url": "https://example.com", "view_url": "https://example.com" }}Missing, invalid or expired bearer passport.
Media typeapplication/json
object
error
string
Example
{ "error": "JWT passport exception: Missing bearer token in request"}The authenticated user lacks the required board permission.
Media typeapplication/json
object
message
string
Example
{ "message": "This action is unauthorized."}Resource not found, or a nested resource does not belong to its parent in the path.
Media typeapplication/json
object
message
string
Example
{ "message": "Not found."}Validation failed.
Media typeapplication/json
object
message
First validation error message.
string
errors
Map of field name → list of error messages.
object
key
additional properties
Array<string>
Example
{ "message": "The name field is required.", "errors": { "name": [ "The name field is required." ] }}