# Files

Source: https://projectfeed.app/docs/api/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.

-   [Plan Pro or Enterprise for API keys](https://projectfeed.app/docs/billing)
-   [Scopes media:read, media:write](https://projectfeed.app/docs/api/scopes)

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-destinations).

### POST /api/v1/media/uploads

Scope

media:write

Body parameters

-   `destination` object required
    
    { type, id }. See Upload destinations. canvas also accepts x, y, width, height, and frameId. doc also accepts afterBlockId. customReaction also requires name.
    
-   `fileName` string required
    
    Original file name, up to 255 characters, without slashes or control characters
    
-   `fileSize` number required
    
    Exact size in bytes, from 1 byte to 1 GiB. Some types and image settings have lower limits.
    
-   `mimeType` string
    
    Up to 128 characters. Inferred from the file name when omitted.
    
-   `mediaType` string
    
    lottie or file. Only for JSON files, which default to file.
    
-   `storeOriginal` boolean
    
    GIF and WebP attachments only. Stores the file as uploaded, without resized versions, through a put or multipart transfer. Send true when a form transfer fails with error code 5443, which means the animation has more than 100 megapixels across all its frames. Complete the rejected upload first to release its storage.
    
-   `transfers` string[]
    
    The transfer types your client can run: put, multipart, form, or tus. Without tus, a video up to 200 MB gets a form transfer, and a larger one returns 413. Omit it to keep the default.
    
-   `spriteSheetData` object
    
    PNG files up to 10 MiB, for any destination except doc and image settings. Attaches the sheet as a sprite, and an animated one plays in the sprite viewer. Required: frameWidth, frameHeight, frameCount, columns, rows (whole numbers from 1 to 10,000) and framerate (frames per second, up to 1,000). Frames read left to right, then top to bottom; frameCount may not exceed columns × rows. Optional: frameDurations (milliseconds, one per frame), hasVariableFramerate, isAnimated (false for a still sprite), offsetX, offsetY, spacingX, spacingY, and animations [{name, frames, framerate?, repeatCount?, direction?}] with 0-based frame indexes. The object must serialize to 10,000 bytes of UTF-8 JSON or fewer. Chat messages allow a framerate up to 120 and at most 50 animations. Completion reads the sheet's size and returns 400 when the file is not a PNG or, without offsets or spacing, when columns × frameWidth and rows × frameHeight differ from it, or, with offsets or spacing, when the frames run past it. File reads return the same spriteSheetData.
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/media/uploads' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "destination": {
    "type": "post",
    "id": "pst_abc123"
  },
  "fileName": "diagram.png",
  "fileSize": 245760
}'
```

Response

JSON

```
{
  "uploadToken": "signed-upload-token",
  "expiresAt": 1789407000000,
  "transfer": { "type": "form", "url": "https://upload.example.com/f3b2c1" }
}
```

### POST /api/v1/media/uploads/complete

Scope

media:write

Body parameters

-   `uploadToken` string required
    
    Token returned by prepare
    
-   `parts` array
    
    [{ partNumber, etag }]. Required for put and multipart transfers. For a put transfer, send one part with partNumber 1.
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/media/uploads/complete' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "uploadToken": "signed-upload-token"
}'
```

Response

JSON

```
{
  "id": "att_abc123",
  "target": "post",
  "parentId": "pst_abc123",
  "fileName": "report.pdf",
  "fileSize": 245760,
  "fileType": "document",
  "status": "ready",
  "url": "https://projectfeed.app/api/media/signed/report.pdf",
  "thumbnailUrl": null
}
```

### POST /api/v1/media/uploads/cancel

Scope

media:write

Body parameters

-   `uploadToken` string required
    
    Token returned by prepare
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/media/uploads/cancel' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "uploadToken": "signed-upload-token"
}'
```

Response

JSON

```
{ "id": "0b8a6f0e-5c1d-4f5e-9d3a-2f6f6f0e1a11", "status": "cancelled" }
```

### POST /api/v1/media/uploads/status

Scope

media:write

Body parameters

-   `uploadToken` string required
    
    Token returned by prepare
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/media/uploads/status' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "uploadToken": "signed-upload-token"
}'
```

Response

JSON

```
{
  "id": "0b8a6f0e-5c1d-4f5e-9d3a-2f6f6f0e1a11",
  "target": "doc",
  "status": "awaiting_completion"
}
```

### POST /api/v1/media

Scope

media:write

Body parameters

-   `target` string
    
    post, comment, task, or taskComment. Inferred from the ID you send. If you send it, it must match that ID.
    
-   `postId` string
    
    Post to attach to. Send exactly one of postId, commentId, taskId, or taskCommentId.
    
-   `commentId` string
    
    Post comment to attach to
    
-   `taskId` string
    
    Task to attach to
    
-   `taskCommentId` string
    
    Task comment to attach to
    
-   `fileName` string required
    
    Up to 255 characters, without a leading dot
    
-   `mimeType` string required
    
    MIME type. Raster images and videos are rejected. application/json is stored as a Lottie animation when the content validates as one, otherwise as a file.
    
-   `fileData` string required
    
    Base64-encoded file content
    
-   `width` number
    
    Width in pixels, stored with the file
    
-   `height` number
    
    Height in pixels, stored with the file
    
-   `duration` number
    
    Duration in seconds, stored with the file
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/media' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "target": "post",
  "postId": "pst_abc123",
  "fileName": "brief.pdf",
  "mimeType": "application/pdf",
  "fileData": "JVBERi0xLjQK"
}'
```

Response

JSON

```
{
  "id": "att_abc123",
  "postId": "pst_abc123",
  "fileName": "brief.pdf",
  "originalFileName": "brief.pdf",
  "fileType": "document",
  "fileSize": 245760,
  "mimeType": "application/pdf",
  "url": "https://projectfeed.app/api/media/signed/brief.pdf",
  "thumbnailUrl": null,
  "createdAt": 1775073600000,
  "author": {
    "id": "usr_abc123",
    "name": "Jane Smith",
    "email": "jane@example.com",
    "image": "/api/media/avatars/jane.jpg"
  },
  "post": { "id": "pst_abc123", "title": "Weekly update" }
}
```

### GET /api/v1/media

Scope

media:read

Query parameters

-   `target` string
    
    post, comment, task, or taskComment. Inferred from the parent ID you send, otherwise post.
    
-   `fileType` string
    
    Filter by file type. See File types. Returns 400 for a value that is not listed.
    
-   `projectId` string
    
    Post files only: files on posts in this project (ID or slug)
    
-   `uploaderId` string
    
    Post files only: files uploaded by this user. Use me for your own.
    
-   `createdAfter` number|string
    
    Post files only: uploaded after this time, as Unix milliseconds or an ISO 8601 time with a timezone. Exclusive.
    
-   `createdBefore` number|string
    
    Post files only: uploaded before this time. Exclusive.
    
-   `q` string
    
    Post files only: words in the file name, up to 200 characters. Matches the 200 best hits.
    
-   `sort` string
    
    Post files only: createdAt (default) or fileSize. Sorting by fileSize can order files of the same size by upload time.
    
-   `order` string
    
    Post files only: desc (default) or asc
    
-   `postId` string
    
    Only files on this post
    
-   `commentId` string
    
    Only files on this post comment (sets target to comment)
    
-   `taskId` string
    
    Only files on this task. Accepts a task ID, an identifier such as PRO-42, or a workspace task number (sets target to task).
    
-   `taskCommentId` string
    
    Only files on this task comment (sets target to taskComment)
    
-   `limit` number
    
    1 to 100, default 50
    
-   `cursor` string
    
    The nextCursor value from the previous response, sent unchanged and URL-encoded. See pagination.
    

Request

curl

```
curl --request GET \
  --url 'https://projectfeed.app/api/v1/media' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "items": [
    {
      "id": "att_abc123",
      "postId": "pst_abc123",
      "projectId": "prj_xyz789",
      "authorId": "usr_def456",
      "fileName": "screenshot.png",
      "originalFileName": "screenshot.png",
      "fileType": "image",
      "fileSize": 245760,
      "mimeType": "image/png",
      "order": 0,
      "url": "https://projectfeed.app/api/media/signed/screenshot.png",
      "thumbnailUrl": "https://projectfeed.app/api/media/signed/screenshot-thumb.png",
      "posterUrl": null,
      "srcset": null,
      "downloadUrl": "https://projectfeed.app/api/media/signed/screenshot.png",
      "width": 1920,
      "height": 1080,
      "isProcessing": false,
      "hasError": false,
      "conversionStatus": null,
      "conversionError": null,
      "createdAt": 1775073600000
    }
  ],
  "hasMore": true,
  "nextCursor": "{\"createdAt\":1775073600000,\"id\":\"att_abc123\"}"
}
```

### GET /api/v1/media/stats

Scope

media:read

Query parameters

-   `projectId` string
    
    Only files in this project (ID or slug)
    

Request

curl

```
curl --request GET \
  --url 'https://projectfeed.app/api/v1/media/stats' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "total": 42,
  "images": 30,
  "videos": 6,
  "audio": 1,
  "models": 2,
  "animations": 1,
  "sprites": 0,
  "documents": 2,
  "lotties": 0,
  "exact": true
}
```

### GET /api/v1/media/:id/posts

Scope

media:read

Path parameters

-   `id` string required
    
    File ID (URL path)
    

Request

curl

```
curl --request GET \
  --url 'https://projectfeed.app/api/v1/media/att_abc123/posts' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "posts": [
    {
      "id": "pst_abc123",
      "identifier": "WR-12",
      "title": "Weekly Update",
      "status": "published",
      "projectId": "prj_xyz789",
      "project": { "id": "prj_xyz789", "name": "Website", "slug": "website" },
      "webUrl": "https://projectfeed.app/acme/post/WR-12"
    }
  ],
  "hasMore": false,
  "nextCursor": null
}
```

### POST /api/v1/media/:id/retry-conversion

Scope

media:write

Path parameters

-   `id` string required
    
    File ID (URL path)
    

Body parameters

-   `target` string
    
    post, comment, task, or taskComment. Defaults to post. Required for any file that is not on a post.
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/media/att_abc123/retry-conversion' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "target": "post"
}'
```

Response

JSON

```
{
  "retried": true,
  "media": {
    "id": "att_abc123",
    "fileName": "robot.step",
    "isProcessing": true,
    "hasError": false,
    "conversionStatus": "processing"
  }
}
```

### PUT /api/v1/posts/:id/media/order

Scopes

posts:write

media:write

Path parameters

-   `id` string required
    
    Post ID, number, or identifier (URL path)
    

Body parameters

-   `mediaIds` string[] required
    
    Every file ID on the post, in the new order
    
-   `expectedUpdatedAt` number
    
    The post's updatedAt from your last read
    

Request

curl

```
curl --request PUT \
  --url 'https://projectfeed.app/api/v1/posts/att_abc123/media/order' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "mediaIds": [
    "mediaIds_abc123"
  ]
}'
```

Response

JSON

```
{
  "media": [
    { "id": "att_def456", "order": 0, "fileName": "after.png" },
    { "id": "att_abc123", "order": 1, "fileName": "before.png" }
  ]
}
```

### PUT /api/v1/posts/:id/media/compare

Scopes

posts:write

media:write

Path parameters

-   `id` string required
    
    Post ID, number, or identifier (URL path)
    

Body parameters

-   `before` string required
    
    File ID shown as before
    
-   `after` string required
    
    File ID shown as after
    
-   `beforeLabel` string
    
    Label for the before side, up to 40 characters. Default Before
    
-   `afterLabel` string
    
    Label for the after side, up to 40 characters. Default After
    
-   `expectedUpdatedAt` number
    
    The post's updatedAt from your last read
    

Request

curl

```
curl --request PUT \
  --url 'https://projectfeed.app/api/v1/posts/att_abc123/media/compare' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "before": "att_abc123",
  "after": "att_def456",
  "beforeLabel": "Day",
  "afterLabel": "Night"
}'
```

Response

JSON

```
{
  "media": [
    {
      "id": "att_abc123",
      "fileName": "day.png",
      "compare": { "pairId": "3f2a…", "role": "before", "label": "Day" }
    },
    {
      "id": "att_def456",
      "fileName": "night.png",
      "compare": { "pairId": "3f2a…", "role": "after", "label": "Night" }
    }
  ]
}
```

### DELETE /api/v1/posts/:id/media/:mediaId/compare

Scopes

posts:write

media:write

Path parameters

-   `id` string required
    
    Post ID, number, or identifier (URL path)
    
-   `mediaId` string required
    
    Either file ID in the pair
    

Request

curl

```
curl --request DELETE \
  --url 'https://projectfeed.app/api/v1/posts/att_abc123/media/att_abc123/compare' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "media": [
    { "id": "att_abc123", "fileName": "day.png", "compare": null },
    { "id": "att_def456", "fileName": "night.png", "compare": null }
  ]
}
```

### GET /api/v1/media/:id

Scope

media:read

Path parameters

-   `id` string required
    
    File ID (URL path)
    

Query parameters

-   `target` string
    
    post, comment, task, or taskComment. Defaults to post. Required for any file that is not on a post.
    

Request

curl

```
curl --request GET \
  --url 'https://projectfeed.app/api/v1/media/att_abc123' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "id": "att_abc123",
  "postId": "pst_abc123",
  "fileName": "brief.pdf",
  "originalFileName": "brief.pdf",
  "fileType": "document",
  "fileSize": 245760,
  "mimeType": "application/pdf",
  "url": "https://projectfeed.app/api/media/signed/brief.pdf",
  "thumbnailUrl": null,
  "createdAt": 1775073600000,
  "author": {
    "id": "usr_abc123",
    "name": "Jane Smith",
    "email": "jane@example.com",
    "image": "/api/media/avatars/jane.jpg"
  },
  "post": { "id": "pst_abc123", "title": "Weekly update" }
}
```

### PATCH /api/v1/media/:id

Scope

media:write

Path parameters

-   `id` string required
    
    Post file ID (URL path)
    

Body parameters

-   `spriteSheetData` object required
    
    The same object as on upload, or null to clear it. The grid is checked against the image's recorded size. A sprite published from Aseprite with an atlas returns 409.
    

Request

curl

```
curl --request PATCH \
  --url 'https://projectfeed.app/api/v1/media/att_abc123' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "spriteSheetData": {
    "frameWidth": 32,
    "frameHeight": 32,
    "frameCount": 4,
    "columns": 4,
    "rows": 1,
    "framerate": 10,
    "frameDurations": [
      100,
      100,
      100,
      150
    ],
    "animations": [
      {
        "name": "walk",
        "frames": [
          0,
          1,
          2,
          3
        ]
      }
    ]
  }
}'
```

Response

JSON

```
{
  "id": "att_abc123",
  "postId": "pst_abc123",
  "fileName": "walk.png",
  "originalFileName": "walk.png",
  "fileType": "sprite",
  "fileSize": 4096,
  "mimeType": "image/png",
  "url": "https://projectfeed.app/api/media/signed/walk.png",
  "thumbnailUrl": null,
  "width": 128,
  "height": 32,
  "spriteSheetData": {
    "frameWidth": 32,
    "frameHeight": 32,
    "frameCount": 4,
    "columns": 4,
    "rows": 1,
    "framerate": 10,
    "frameDurations": [100, 100, 100, 150],
    "animations": [{ "name": "walk", "frames": [0, 1, 2, 3] }]
  },
  "createdAt": 1775073600000
}
```

### DELETE /api/v1/media/:id

Scope

media:write

Path parameters

-   `id` string required
    
    File ID (URL path)
    

Query parameters

-   `target` string
    
    post, comment, task, or taskComment. Defaults to post. Required for any file that is not on a post.
    

Request

curl

```
curl --request DELETE \
  --url 'https://projectfeed.app/api/v1/media/att_abc123' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{ "success": true }
```

### POST /api/v1/media/direct

Scope

media:write

Body parameters

-   `postId` string required
    
    Post to attach to. You must be its author.
    
-   `fileName` string required
    
    Up to 255 characters, without slashes, control characters, or a leading dot
    
-   `fileType` string required
    
    One of the values in File types, including sprite
    
-   `fileSize` number required
    
    Byte count, from 1 byte to 1 GiB
    
-   `mimeType` string
    
    MIME type, up to 128 characters
    
-   `width` number
    
    Whole number of pixels, 1 to 100,000
    
-   `height` number
    
    Whole number of pixels, 1 to 100,000
    
-   `duration` number
    
    Seconds, greater than 0 and up to 604,800
    
-   `contentHash` string
    
    SHA-256 of the file as 64 lowercase hex characters
    
-   `r2Key` string
    
    Storage identifier from the confirm step for files and audio, up to 1,024 characters. Send exactly one of r2Key, cfImageId, or cfStreamVideoId.
    
-   `cfImageId` string
    
    Storage identifier from the confirm step for images
    
-   `cfStreamVideoId` string
    
    Storage identifier from the confirm step for video
    
-   `reservationId` string
    
    Returned by the reserve step
    
-   `mediaBlobId` string
    
    Returned by the confirm step when the file was registered for reuse. Send it with dedupConfirmationKey.
    
-   `dedupConfirmationKey` string
    
    Returned with mediaBlobId, up to 200 characters
    
-   `spriteSheetData` object
    
    Frame grid for a sprite sheet. Only valid with fileType sprite.
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/media/direct' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "postId": "pst_abc123",
  "fileName": "hero.glb",
  "fileType": "model",
  "fileSize": 1048576,
  "mimeType": "model/gltf-binary",
  "r2Key": "uploads/2026/04/01/hero.glb",
  "contentHash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
  "reservationId": "upl_abc123"
}'
```

Response

JSON

```
{ "id": "att_abc123" }
```

## Upload a file

1.  1.
    
    ### Prepare the upload
    
    Send the destination, file name, and exact size to `POST /api/v1/media/uploads`. The response has an `uploadToken`, an `expiresAt` time, and a `transfer` object that says how to send the bytes.
    
2.  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.  3.
    
    ### Complete the upload
    
    Send the `uploadToken` to `POST /api/v1/media/uploads/complete`, with `parts` for put and multipart transfers. The response describes the new attachment.
    

HTTP

```
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](https://projectfeed.app/docs/api/rate-limits).

## 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](https://projectfeed.app/docs/files/supported-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.

To show an uploaded file inside a post, task description, or doc, write `![caption](media:<mediaId>)` in its Markdown content. See [formatted text](https://projectfeed.app/docs/api/posts).

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`](https://projectfeed.app/docs/api/posts).

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`](https://projectfeed.app/docs/api/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`](https://projectfeed.app/docs/api/tasks).

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`](https://projectfeed.app/docs/api/chat) or [`POST /api/v1/chat/rooms/:roomId/threads`](https://projectfeed.app/docs/api/chat). 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:

Shell

```
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` | PDF | 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](https://projectfeed.app/docs/api/conventions#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](https://projectfeed.app/docs/api/errors). 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](https://projectfeed.app/docs/installed-tools/developers) 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](https://projectfeed.app/docs/api/posts): attach an uploaded file to a new post version.
-   [Supported file formats](https://projectfeed.app/docs/files/supported-formats): check how each format previews.
-   [Errors](https://projectfeed.app/docs/api/errors): read the error format and retry guidance.
