# Docs attachments

Files on a page, with their versions: upload (multipart), list, download and delete.

## List a page's files

`GET /orgs/{org}/pages/{page}/attachments`

Scope: `docs:read`

The page's files by name, each with its versions (a file uploaded again under the same name is its next version), as the page's Files show them.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `page` (string (uuid), required): A page's id (any item of the tree: page, live doc, folder, smart link).

### Query parameters

- `limit` (integer): How many items a page holds, 1 to 200. [from 1 to 200; default 50]
- `cursor` (string): The next_cursor of the previous page; leave it out for the first page. [at most 1000 characters]
- `count` (string): true adds total, the number of items in the whole list. [one of: true, false]
- `fields` (string): Only these fields, comma-separated: id, name, mime, size, version, comment, labels, created_at, added_by, content_url, versions. id always comes; the fields not asked for are left out, required or not.

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/pages/6f1c2a9e-3b7d-4e21-9a55-0c8d2f4b7e10/attachments" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
      "name": "plan.pdf",
      "mime": "application/pdf",
      "size": 48213,
      "version": 2,
      "comment": "",
      "labels": [],
      "created_at": "2026-12-01T10:20:00.000Z",
      "added_by": {
        "id": "8d0e5f7a-1c2b-4d3e-8f9a-0b1c2d3e4f5a",
        "name": "Priya Shah"
      },
      "content_url": "/api/v1/orgs/acme/pages/1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d/attachments/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/content",
      "versions": []
    }
  ],
  "next_cursor": null
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation.
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Upload files to a page

`POST /orgs/{org}/pages/{page}/attachments`

Scope: `docs:write`

Uploads 1 to 10 files to the page, as multipart/form-data, as the page's Files do: it needs edit rights on the page and "Add attachments" in the space. A file with the name of one already there becomes its next version. Each file must be within the organisation's file size limit (413 too_large); one refused file refuses the whole call. The files are streamed to the file store as they arrive: the organisation's file size limit and its storage limit are checked as the bytes come, and the call answers 413 too_large as soon as one is passed (the rest of the body isn't read, and nothing of the call is kept).

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `page` (string (uuid), required): A page's id (any item of the tree: page, live doc, folder, smart link).

### Headers

- `Idempotency-Key` (string): A unique key (such as a uuid): the same key and body within 24 hours gets the first answer again without a second create; another body gets 422. [1 to 200 characters]

### Body

- `file` (array of string, required): 1 to 10 files, each as a part named file (or files). [1 to 10 items]
- `comment` (string): A note kept with the files (at most 500 characters).

### Request

```sh
curl -X POST "https://projqo.example/api/v1/orgs/{org}/pages/6f1c2a9e-3b7d-4e21-9a55-0c8d2f4b7e10/attachments" \
  -H "Authorization: Bearer $PROJQO_TOKEN" \
  -F "file=@report.pdf" \
  -F "comment=string"
```

### Answer: 201

```json
{
  "items": [
    {
      "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
      "name": "plan.pdf",
      "mime": "application/pdf",
      "size": 48213,
      "version": 2,
      "comment": "",
      "labels": [],
      "created_at": "2026-12-01T10:20:00.000Z",
      "added_by": {
        "id": "8d0e5f7a-1c2b-4d3e-8f9a-0b1c2d3e4f5a",
        "name": "Priya Shah"
      },
      "content_url": "/api/v1/orgs/acme/pages/1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d/attachments/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/content",
      "versions": []
    }
  ]
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation. refused: The token's person can see the thing but may not do this; the message says why. read_only: The organisation is read-only (over the Free plan's people, or a payment is overdue).
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 409 `archived`: archived: The item (or its project) is archived, so it can't be changed. limit_reached: A limit was reached (of the plan, or of how many of something one person may have).
- 413 `too_large`: too_large: The body or a file is larger than allowed.
- 415 `unsupported_media_type`: unsupported_media_type: The body isn't JSON.
- 422 `idempotency_key_reused`: idempotency_key_reused: The same Idempotency-Key was sent within 24 hours with a different body.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Get a file's details

`GET /orgs/{org}/pages/{page}/attachments/{attachment}`

Scope: `docs:read`

One of the page's files (by the id of any of its versions), with its versions.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `page` (string (uuid), required): A page's id (any item of the tree: page, live doc, folder, smart link).
- `attachment` (string (uuid), required): A file's id (any of its versions).

### Query parameters

- `fields` (string): Only these fields, comma-separated: id, name, mime, size, version, comment, labels, created_at, added_by, content_url, versions. id always comes; the fields not asked for are left out, required or not.

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/pages/6f1c2a9e-3b7d-4e21-9a55-0c8d2f4b7e10/attachments/6f1c2a9e-3b7d-4e21-9a55-0c8d2f4b7e10" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
  "name": "plan.pdf",
  "mime": "application/pdf",
  "size": 48213,
  "version": 2,
  "comment": "",
  "labels": [],
  "created_at": "2026-12-01T10:20:00.000Z",
  "added_by": {
    "id": "8d0e5f7a-1c2b-4d3e-8f9a-0b1c2d3e4f5a",
    "name": "Priya Shah"
  },
  "content_url": "/api/v1/orgs/acme/pages/1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d/attachments/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/content",
  "versions": []
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation.
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Delete a file

`DELETE /orgs/{org}/pages/{page}/attachments/{attachment}`

Scope: `docs:write`

Moves the file (every version) to the space's file trash, as the page's Files do: with edit rights on the page or "Delete attachments" in the space. With version=true, deletes only that version for good ("Delete attachments").

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `page` (string (uuid), required): A page's id (any item of the tree: page, live doc, folder, smart link).
- `attachment` (string (uuid), required): A file's id (any of its versions).

### Query parameters

- `version` (string): true: delete only this version, for good. [one of: true, false]

### Request

```sh
curl -X DELETE "https://projqo.example/api/v1/orgs/{org}/pages/6f1c2a9e-3b7d-4e21-9a55-0c8d2f4b7e10/attachments/6f1c2a9e-3b7d-4e21-9a55-0c8d2f4b7e10" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 204

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation. refused: The token's person can see the thing but may not do this; the message says why. read_only: The organisation is read-only (over the Free plan's people, or a payment is overdue).
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 409 `archived`: archived: The item (or its project) is archived, so it can't be changed. conflict: The thing changed since it was read, or the change clashes with its state.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Download a file

`GET /orgs/{org}/pages/{page}/attachments/{attachment}/content`

Scope: `docs:read`

The bytes of that version of the file, with its type and the app's download headers (a Content-Disposition naming it, and the headers that keep a browser from running anything in it).

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `page` (string (uuid), required): A page's id (any item of the tree: page, live doc, folder, smart link).
- `attachment` (string (uuid), required): A file's id (any of its versions).

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/pages/6f1c2a9e-3b7d-4e21-9a55-0c8d2f4b7e10/attachments/6f1c2a9e-3b7d-4e21-9a55-0c8d2f4b7e10/content" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
"string"
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation.
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).
