Files
Upload files to posts, tasks, comments, docs, chat, and canvases, then list, read, and delete them. The endpoints live under /media in the URL.
Native session clients can subscribe to mobile:files with organizationId, optional projectId and fileType filters, cursor and limit. It returns the web Files page's flat, combined-source library as items and nextCursor. Each item includes typed Media, size, source, project and creation time. Media uses absolute proxy URLs with requiresAuth and cacheKey. List limits default to 25 and allow up to 50.
Session tokens accept GET /api/v1/media and GET /api/v1/media/:id with media:read. Send Authorization: Bearer with X-Project-Feed-Workspace. Viewers can read accessible files. Access to the containing post, comment, or task is still checked. Session tokens can also upload your own avatar, and viewers need only profile:write for it. Workspace owners and admins can upload the workspace logo from a session.
Endpoints
Every path starts with /api/v1/media. Uploading also needs the write scope of the destination, such as docs:write for a doc. See Upload destinations.
Upload a file
- 1.
Prepare the upload
Send the destination, file name, and exact size to
POST /api/v1/media/uploads. The response has anuploadToken, anexpiresAttime, and atransferobject that says how to send the bytes. - 2.
Transfer the bytes
Send the file to the URL in transfer, using the method for its type. Send your API credentials only to Project Feed, never to a transfer URL.
- 3.
Complete the upload
Send the
uploadTokentoPOST /api/v1/media/uploads/complete, withpartsfor put and multipart transfers. The response describes the new attachment.
POST /api/v1/media/uploads
Authorization: Bearer pf_YOUR_API_KEY
Content-Type: application/json
{"destination":{"type":"post","id":"pst_abc123"},"fileName":"diagram.png","fileSize":245760}
# transfer.type is form, so send the file field to transfer.url
curl --fail-with-body -F "file=@diagram.png" "$UPLOAD_URL"
POST /api/v1/media/uploads/complete
Authorization: Bearer pf_YOUR_API_KEY
Content-Type: application/json
{"uploadToken":"TOKEN_FROM_PREPARE"}Transfer URLs stop working at expiresAt, so start the transfer before then. The upload token stays valid for six hours after you prepare. It is bound to the user, workspace, file, and destination that prepared it. Prepare is not idempotent: each call returns a new token.
Complete is safe to retry with the same token. After a dropped connection, send the same request again, or call the status endpoint to see whether the file is attached. A completed upload returns the same attachment every time. Video completion can return a status of processing until playback is ready. A doc can return pending while the doc update is saved, then attached.
The workspace storage limit, file validation, and IP allowlist apply as they do in the app. The prepare request body is limited to 64 KB. Prepare and the JSON upload together allow 50 requests per hour per API key, on top of the normal REST rate limit.
Transfer types
The transfer.type in the prepare response depends on the file.
| Type | Used for | How to send | Size limit |
|---|---|---|---|
form | Images up to 10 MiB, except SVG and storeOriginal uploads. Video up to 200 MB when transfers leaves out tus. | Send a multipart form with the file in a field named file to url. Do not send parts when you complete. | 10 MiB for images, 200 MB for video |
tus | Video, unless transfers leaves out tus | Resumable upload over TUS 1.0. A HEAD request returns Upload-Offset. Send each PATCH from that offset with Content-Type: application/offset+octet-stream and Tus-Resumable: 1.0.0. Do not send parts when you complete. | 1 GiB |
put | Files up to 50 MiB that do not use form or tus | PUT the file body to url with the returned headers. Read the ETag response header and complete with parts: [{ partNumber: 1, etag }]. | 50 MiB |
multipart | Files over 50 MiB that do not use tus | PUT each consecutive byte range to its part url with the returned headers. Every part has a size (25 MiB, except a shorter last part). Complete with every partNumber and ETag. | 1 GiB |
The size limit is 1 GiB for every type except these. Standalone USD and USDA models are limited to 64 MiB, embedded glTF to 16 MB, and Lottie JSON uploaded with mediaType lottie to 10 MB. See supported file formats for what each format previews as.
Upload destinations
The destination decides where the file goes and what the request needs. A key needs media:write for every destination, plus the scope in the table. Your workspace role and access to the destination are checked again when you complete.
| Destination | id is | Scopes | Who can upload |
|---|---|---|---|
post | Post ID | media:write | The post author |
newPost | Project ID | media:write | Anyone who can post in the project. For a post you have not created yet; see below. |
comment | Post comment ID | media:write | The comment author |
task | Task ID | media:write | Anyone who can edit the task. Viewers cannot upload. |
taskComment | Task comment ID | media:write | The comment author |
newTaskComment | Task ID | media:write | Anyone who can edit the task. For a comment you have not created yet; see below. |
chatMessage | Chat message ID | media:write and chat:write | The message author, with write access to the room |
newChatMessage | Chat room ID | media:write and chat:write | Anyone with write access to the room. For a message you have not sent yet; see below. |
canvas | Canvas ID | media:write and canvas:write | Anyone who can edit the canvas. Archived canvases return 409. |
doc | Doc ID | media:write and docs:write | Anyone who can edit the doc |
Posts, comments, tasks, task comments, and chat messages hold up to 10 files each. A canvas upload creates a media item. Its x, y, width, and height default to 0, 0, 400, and 300, and frameId places it in a frame. A doc upload inserts a media block after afterBlockId, or at the end when you leave it out. Read the doc content to find block IDs. If the block has been removed, prepare a new upload with a current block.
A post upload adds the file to the post's current version. To add it to a new version instead, skip complete and send the uploadToken and parts in uploads to POST /api/v1/posts/:id/versions.
To create a post with its files, prepare each upload with destination newPost and the project ID. Skip complete and send the uploadToken and parts in uploads to POST /api/v1/posts. The post appears with every file already attached.
A task upload adds the file to the task. To attach a file to a comment you are about to create, prepare it with destination newTaskComment and the task ID. It does not count toward the task's own files. Skip complete and send the uploadToken and parts in uploads to POST /api/v1/tasks/:id/comments.
To send a message with its files, prepare each upload with destination newChatMessage and the room ID. Skip complete and send the uploadToken and parts in uploads to POST /api/v1/chat/rooms/:roomId/threads/:threadId/messages or POST /api/v1/chat/rooms/:roomId/threads. The message appears with every file already attached.
Image settings accept PNG, JPEG, GIF, and WebP, and the image is public, as it is in the app.
| Destination | id is | Scopes | Who can change it | Size limit |
|---|---|---|---|---|
avatar | Your user ID | media:write and profile:write | Only your own avatar | 5 MiB, 2 MiB for GIF |
workspaceLogo | Workspace ID | media:write | Owners and admins | 5 MiB |
portalLogo | Client portal ID | media:write | Owners and admins | 5 MiB |
projectHeader | Project ID | media:write and projects:write | Anyone who can change the project's settings | 10 MiB |
projectIcon | Project ID | media:write and projects:write | Anyone who can change the project's settings | 10 MiB |
customReaction | Workspace ID, plus name | media:write and reactions:write | Owners and admins | 256 KiB |
A custom reaction name is 2 to 32 letters, numbers, or underscores and must not already exist.
The CLI runs these steps for you:
pf media upload diagram.png --doc doc_abc123 --after-block BLOCK_ID
pf media upload review.mp4 --post pst_abc123 --resume-state ./upload.json
pf media upload model.glb --task tsk_abc123
pf media upload reference.png --canvas cnv_abc123 --x 200 --y 100
pf media upload logo.png --workspace-logo ws_abc123
pf media upload celebrate.gif --custom-reaction ws_abc123 --name celebrate
pf media cancel-upload --upload-token "$UPLOAD_TOKEN"Upload in one JSON request
POST /api/v1/media sends the file as base64 in fileData. It attaches to a post, post comment, task, or task comment, and needs exactly one parent ID. It is meant for small files: the file is limited to 50 MiB, and a request body over about 70 MB returns 413. It rejects raster images and videos, which use the prepare flow, and it returns 403 in workspaces with file encryption on.
The file must match its declared MIME type for audio, PDF, SVG, Rive, and 3D model types. Other types are stored as they arrive and served as downloads, never rendered in the browser. The same upload rules apply: the post or comment author, or a task editor, can upload, and each item holds up to 10 files.
File types
Every file has one fileType. The same values are used by the fileType filter and by POST /api/v1/media/direct.
| fileType | Holds | Accepted by |
|---|---|---|
image | Raster images and SVG | Prepare. JSON upload for SVG only. |
video | Video | Prepare |
audio | Audio | Prepare, JSON upload |
document | Prepare, JSON upload | |
model | 3D models | Prepare, JSON upload |
animation | Rive animations | Prepare, JSON upload |
lottie | Lottie JSON | Prepare with mediaType lottie. JSON upload when the content validates as Lottie. |
sprite | Sprite sheets | Installed tools only (POST /api/v1/media/direct) |
file | Everything else, such as text, code, data, Office documents, and archives | Prepare, JSON upload |
List and read files
List, get, and delete cover files on posts, comments, tasks, and task comments. Files added to chat messages, canvases, and docs, and image settings, are not returned. Reads follow the parent's visibility. Listing files for a post, comment, or task comment you cannot see returns an empty page. A task filter for a task that does not exist returns 404, and one you cannot access returns 403. An unrecognized cursor starts again from the first page.
The list returns items and hasMore. nextCursor is null on the last page. Treat the cursor as an opaque string. See pagination.
Each file has id, fileName, originalFileName, fileType, fileSize, mimeType, url, thumbnailUrl, width, height, duration, order, posterUrl and srcset for video posters and responsive images, downloadUrl, isProcessing, hasError, conversionStatus (processing, ready, error, or null), conversionError, and createdAt in milliseconds. Files on posts also have postId, projectId, and authorId. width, height, and duration are left out when they do not apply. url links to the file. Links can expire, so read the file again for a fresh one instead of storing it. A single file also has an author with id, name, email, and image.
The parent fields depend on the target. List items for non-post targets use target and parentId. A single file has these.
| Target | Parent ID fields | Extra fields |
|---|---|---|
post | postId | post with id and title. No target or parent field. |
comment | commentId, postId | parent: { kind, id, postId } |
task | taskId | parent: { kind, id, title } |
taskComment | taskCommentId, taskId | parent: { kind, id, taskId } |
Delete a file
Who can delete depends on the target. For a post file, the post author or a workspace owner or admin. For a comment file, the comment author or an owner or admin. For a task file, the person who uploaded it or an owner or admin, and never a viewer. For a task comment file, the uploader, the comment author, or an owner or admin. The response is { "success": true }.
A file under a retention policy returns 409. Storage for a deleted file is cleaned up after a 7-day grace period.
Errors
Errors use the format on the errors page. These are the statuses specific to files.
| Status | When |
|---|---|
| 400 | The request body, file name, or ID is invalid. The upload token is invalid or expired (prepare again). The uploaded bytes do not match the declared type. A base64 body is malformed or empty. |
| 403 | The key is missing media:write or the destination's scope. You cannot edit the destination. The workspace storage limit is reached or the workspace IP allowlist blocks the request. The workspace has file encryption on and you used POST /api/v1/media. |
| 404 | The destination or the file does not exist, or you cannot see it. |
| 409 | A custom reaction with that name exists. The canvas is archived or the frame is locked. The doc block you pointed at is gone. A file under a retention policy cannot be deleted. |
| 413 | The file or request body is over its limit, or the destination already has 10 files. |
| 429 | The upload rate limit or the normal REST rate limit was hit. Wait for the Retry-After header. |
| 503 | The upload service is temporarily unavailable. Retry after the number of seconds in Retry-After. |
Installed tools
POST /api/v1/media/direct is the last step of the upload flow that installed tools use. It receives no file bytes. It attaches a file that earlier steps already uploaded and confirmed, so it needs values those steps return. For new scripts, use the prepare flow instead.
| Field | Returned by |
|---|---|
reservationId | The reserve step: /api/upload/request, /api/upload/images-request, or /api/upload/stream-request. |
mediaBlobId and dedupConfirmationKey | The confirm step: /api/upload/confirm, /api/upload/images-confirm, or /api/upload/stream-confirm. They are returned only when the file was registered with its contentHash. Send both or neither. |
r2Key, cfImageId, or cfStreamVideoId | The confirm step for the matching file, image, or video. |
Send each value back unchanged. The request must identify exactly one uploaded file. Only the post author can attach, and a post holds up to 10 files. Sending the same uploaded file to the same post again returns the existing attachment ID. The request body is limited to 64 KB and returns 413 above it. Invalid metadata returns 400, a post you did not write returns 403, and a post in another workspace returns 404. The response is 201 with { "id": "att_abc123" }.
Next steps
- Posts: attach an uploaded file to a new post version.
- Supported file formats: check how each format previews.
- Errors: read the error format and retry guidance.