Upload a file to a card
const url = 'https://projects.work.optidata.cloud/api/boards/1/cards/1/files';const form = new FormData();form.append('name', 'example');form.append('size_bytes', '1');form.append('mime_type', 'example');form.append('blob', 'file');form.append('is_editor_upload', 'true');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
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 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form name=example \ --form size_bytes=1 \ --form mime_type=example \ --form blob=@file \ --form is_editor_upload=trueAttaches a file to the card by uploading the binary from the caller’s
machine (multipart form-data with blob). The file is stored in the
tenant’s Optiwork Drive. Editor media uploads (is_editor_upload: true)
are restricted to an image/video allow-list with per-type size limits.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Board id.
Card id (must belong to the board).
Request Bodyrequired
Section titled “Request Bodyrequired”object
File name.
File size in bytes.
File MIME type.
The file content.
Set when uploading media from the card’s rich-text editor (enables the media allow-list and size limits).
Responses
Section titled “Responses”The created file with access URLs.
object
object
Opaque file identifier used in file URLs.
Inline-content URL (renders in the editor).
Signed Optiwork Drive viewer URL.
Example
{ "file": { "id": 5001, "identifier": "f0e1d2c3-7777-4888-9999-aaaabbbbcccc", "download_url": "https://projects.work.optidata.cloud/projects/boards/42/cards/9001/files/f0e1d2c3-7777-4888-9999-aaaabbbbcccc/download", "content_url": "https://projects.work.optidata.cloud/projects/boards/42/cards/9001/files/f0e1d2c3-7777-4888-9999-aaaabbbbcccc/content", "view_url": "https://drive.work.optidata.cloud/view/abc123" }}Missing, invalid or expired bearer passport.
object
Example
{ "error": "JWT passport exception: Missing bearer token in request"}The authenticated user lacks the required board permission.
object
Example
{ "message": "This action is unauthorized."}Resource not found, or a nested resource does not belong to its parent in the path.
object
Example
{ "message": "Not found."}Validation failed.
object
First validation error message.
Map of field name → list of error messages.
object
Example
{ "message": "The name field is required.", "errors": { "name": [ "The name field is required." ] }}