# Conventions

## JSON in and out

Requests with a body send JSON (`Content-Type: application/json`), and every answer is JSON, except file downloads. Files are uploaded as `multipart/form-data`.

Uploads are streamed: projqo writes each file as its bytes arrive, checking the organisation's file size limit and its storage on the way. When a file passes either, the answer is `413 too_large` straight away and the connection is closed without reading the rest, so a client sending a large file learns of it early. Nothing of a refused upload is kept.

- One shape for reading and writing: what `GET` returns is what you send back to change it.
- Related things come as small objects: a task's status is `{"id": "…", "name": "In progress", "category": "In progress"}`.
- A reference in a request is an id. A person can also be given by email address, and a task by its key.
- Field names are `snake_case`.
- A parameter the call doesn't know is refused with `400`, so a typing mistake never passes silently.
- Every text field has a limit, the same as in projqo itself. It is shown on the field in the reference, and a longer value is refused with `400`.

## Ids

- Every id is a uuid, written as a string: `"6f1c2a9e-3b7d-4e21-9a55-0c8d2f4b7e10"`.
- A task's address takes its id or its key: `/tasks/WEB-12`. Every task answer carries both. When a task moves to another project its key changes, and the old key still finds it.
- A person has one id in every organisation: their account's id.
- Fields have stable keys that never change when a field is renamed: see [fields](/guides/fields/).

## Dates and times

- Date-times come back in UTC, ending in `Z`: `"2026-12-01T09:30:00Z"`. You may send them with an offset: `"2026-12-01T15:00:00+05:30"`.
- Dates without a time (due dates, start dates, release dates) are `YYYY-MM-DD`: `"2026-12-01"`.
- Relative dates in a query (`today`, `startOfWeek()`) use the time zone of the person behind the token, as projqo does. The organisation's time zone and first day of the week are in `GET /orgs/{org}`.

## Changing things: PATCH

Updates are `PATCH` and name only what changes. Fields with several values take `add` and `remove`:

```json
{
  "summary": "Fix the sign-in redirect on Safari",
  "labels": { "add": ["frontend"], "remove": ["triage"] }
}
```

There is no `PUT`.

## Rich text

Descriptions, comments and page bodies are rich text. Read and write them as projqo's document JSON (its schema is in the reference), or as Markdown by adding `body_format=markdown`. Mentions, task links and page links survive both ways.

## Docs pages: the version you read {#page-versions}

A page reads as its published version, with its number in `version` (0 for a page never published). To change its title or body, send that number with the change:

```json
{ "version": 3, "body": "# Release checklist\n\n- [ ] Tag the build\n", "comment": "Tagging step" }
```

The change is published as the next version (send `"publish": false` to leave it as unpublished changes). When the page has been published since you read it, or someone has changes in its editor that nobody has published yet, the answer is `409 conflict` and nothing changes: read the page again and decide. People with the page open in the editor see your change at once.

## Statuses {#statuses}

| Status       | Means                                                                     |
| ------------ | ------------------------------------------------------------------------- |
| `200`        | Done; the answer has the item or the list.                                |
| `201`        | Created; the answer has the new item.                                     |
| `202`        | Accepted; the work finishes shortly after the answer.                     |
| `204`        | Done; there is no body (most deletes).                                    |
| `207`        | A bulk call where some items worked and some didn't; one result per item. |
| `400` and up | An error, in the shape below. See [errors](/guides/errors/).              |

## The error shape

Every error has the same shape:

```json
{
  "error": {
    "code": "invalid",
    "message": "Give the task a summary.",
    "status": 400,
    "request_id": "…",
    "details": [{ "field": "summary", "code": "required", "message": "Give the task a summary." }]
  }
}
```

- `code` is for your program; it never changes for the same cause.
- `message` is for people, in projqo's words; it may be reworded.
- `details` lists every problem with a value, one per field, so a form can show them all at once.

## X-Request-Id

Every answer, success or error, carries an `X-Request-Id` header, and errors repeat it as `request_id`. Log it. When you write to projqo's support about a call, give the request id: it finds that call in projqo's logs.

## Lists

Lists are paged by cursor, filtered with plain parameters or the query language, and sorted with `sort`. See [paging and lists](/guides/paging/).
