# Docs labels

A page's labels: read, add and remove.

## List a page's labels

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

Scope: `docs:read`

The page's labels, by name (lower case, as projqo keeps 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).

### Request

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

### Answer: 200

```json
{
  "labels": [
    "release",
    "team"
  ]
}
```

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

## Add labels to a page

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

Scope: `docs:write`

Adds labels to the page (edit rights on it, as in the app): each is made lower case, one word, at most 50 on a page. A label it has already is left as it is.

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

### Body

- `labels` (array of string, required) [1 to 50 items]

### Request

```sh
curl -X POST "https://projqo.example/api/v1/orgs/{org}/pages/6f1c2a9e-3b7d-4e21-9a55-0c8d2f4b7e10/labels" \
  -H "Authorization: Bearer $PROJQO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "labels": [
    "string"
  ]
}'
```

### Answer: 200

```json
{
  "labels": [
    "release",
    "team"
  ]
}
```

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

## Remove a label from a page

`DELETE /orgs/{org}/pages/{page}/labels/{label}`

Scope: `docs:write`

Takes the label (by name) off the page (edit rights on it, as in the app).

### 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).
- `label` (string, required) [1 to 200 characters]

### Request

```sh
curl -X DELETE "https://projqo.example/api/v1/orgs/{org}/pages/6f1c2a9e-3b7d-4e21-9a55-0c8d2f4b7e10/labels/{label}" \
  -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.
- 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).
