# Metadata

Fields (system and custom, by key), task types, statuses, workflows, priorities, resolutions and time tracking: what a project's tasks can hold, read only.

## List fields

`GET /orgs/{org}/fields`

Scope: `tasks:read`

Every field of the organisation's tasks the token's person can see: projqo's own fields and custom ones, each with its key (cf_<key> for a custom field), name and type. Which fields a project's task types have, and their options, are in the project's fields calls.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/fields" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "key": "cf_customer_tier",
      "id": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
      "name": "Customer tier",
      "type": "select",
      "custom": true,
      "description": "The customer's support plan.",
      "writable": true,
      "project": null
    }
  ],
  "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).

## List a project's task types

`GET /orgs/{org}/projects/{project}/task-types`

Scope: `tasks:read`

The task types of the project's type scheme, in its order (Epic, Story, Task, Bug, Subtask and the organisation's own), each with its level, its workflow and whether the token's person may create tasks of it.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `project` (string, required): The project's key (WEB), an old key, or its id. [1 to 60 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/projects/{project}/task-types" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
      "name": "Bug",
      "icon": "bug",
      "level": 0,
      "description": "A problem that stops something working.",
      "default": false,
      "can_create": true,
      "workflow": {
        "id": "5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b",
        "name": "Software workflow"
      }
    }
  ],
  "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).

## List a project's fields

`GET /orgs/{org}/projects/{project}/fields`

Scope: `tasks:read`

Every field the project's tasks have, system and custom, each with its key and type and, per task type, whether it is required and on the create screen. A project with its own field scheme (or a Team project's own fields) answers its own. The options of a list field are in the type's fields call.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `project` (string, required): The project's key (WEB), an old key, or its id. [1 to 60 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/projects/{project}/fields" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "key": "cf_customer_tier",
      "id": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
      "name": "Customer tier",
      "type": "select",
      "custom": true,
      "description": "The customer's support plan.",
      "writable": true,
      "task_types": [
        {
          "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
          "name": "Bug",
          "required": true,
          "on_create_screen": true
        }
      ]
    }
  ],
  "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).

## List a task type's fields

`GET /orgs/{org}/projects/{project}/task-types/{type}/fields`

Scope: `tasks:read`

The fields a task of this type has in the project, in the order the project arranges them: each with its key, type, whether it is required and on the create screen, its default, and a list field's options in this project and type. Use the keys and option ids in POST /projects/{project}/tasks and PATCH /tasks/{task}.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `project` (string, required): The project's key (WEB), an old key, or its id. [1 to 60 characters]
- `type` (string, required): The task type's id or its name (Bug). [1 to 100 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/projects/{project}/task-types/{type}/fields" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "key": "cf_customer_tier",
      "id": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
      "name": "Customer tier",
      "type": "select",
      "custom": true,
      "description": "The customer's support plan.",
      "writable": true,
      "required": true,
      "on_create_screen": true,
      "default_value": null,
      "options": [
        {
          "id": "3f2a9c1e-7b4d-4e8a-9c2f-1a2b3c4d5e6f",
          "value": "Gold",
          "parent_id": null,
          "disabled": false
        }
      ],
      "config": {}
    }
  ],
  "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).

## List statuses

`GET /orgs/{org}/statuses`

Scope: `tasks:read`

The statuses of the organisation's workflows and of the Team projects the token's person can open (as Advanced search offers them), each with its category (todo, in_progress, done) and colour.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/statuses" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "3d4e5f6a-7b8c-4d9e-8f0a-2b3c4d5e6f7a",
      "name": "In progress",
      "category": "in_progress",
      "colour": "blue",
      "icon": "circle_half",
      "description": "Someone is working on it.",
      "project": null
    }
  ],
  "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).

## List a project's statuses

`GET /orgs/{org}/projects/{project}/statuses`

Scope: `tasks:read`

The statuses the project's tasks can be in: those of its task types' workflows, in workflow order, each once.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `project` (string, required): The project's key (WEB), an old key, or its id. [1 to 60 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/projects/{project}/statuses" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "3d4e5f6a-7b8c-4d9e-8f0a-2b3c4d5e6f7a",
      "name": "In progress",
      "category": "in_progress",
      "colour": "blue",
      "icon": "circle_half",
      "description": "Someone is working on it.",
      "project": null
    }
  ],
  "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).

## List a project's workflows

`GET /orgs/{org}/projects/{project}/workflows`

Scope: `tasks:read`

The workflows the project's task types use, each with its statuses and transitions, as a task's View workflow shows them. Needs View workflow in the project (403 refused without it). The transitions a task may run now, after its rules, are in GET /tasks/{task}/transitions.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `project` (string, required): The project's key (WEB), an old key, or its id. [1 to 60 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/projects/{project}/workflows" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b",
      "name": "Software workflow",
      "description": "",
      "kind": "organisation",
      "task_types": [
        {
          "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
          "name": "Bug"
        }
      ],
      "statuses": [
        {
          "id": "3d4e5f6a-7b8c-4d9e-8f0a-2b3c4d5e6f7a",
          "name": "In progress",
          "category": "in_progress",
          "colour": "blue"
        }
      ],
      "transitions": [
        {
          "id": "6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b9c",
          "name": "Start work",
          "to": "3d4e5f6a-7b8c-4d9e-8f0a-2b3c4d5e6f7a",
          "from": [],
          "from_any": true,
          "initial": false,
          "screen": false
        }
      ]
    }
  ],
  "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. refused: The token's person can see the thing but may not do this; the message says why.
- 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).

## List priorities

`GET /orgs/{org}/priorities`

Scope: `tasks:read`

Every priority of the organisation, highest first. A project's tasks take the priorities of its scheme (the project's priorities call).

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/priorities" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "4e5f6a7b-8c9d-4e0f-9a1b-3c4d5e6f7a8b",
      "name": "High",
      "icon": "arrow_up",
      "colour": "#d04437"
    }
  ],
  "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).

## List a project's priorities

`GET /orgs/{org}/projects/{project}/priorities`

Scope: `tasks:read`

The priorities the project's tasks may have (its priority scheme's), highest first, with the one a new task gets.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `project` (string, required): The project's key (WEB), an old key, or its id. [1 to 60 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/projects/{project}/priorities" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "4e5f6a7b-8c9d-4e0f-9a1b-3c4d5e6f7a8b",
      "name": "High",
      "icon": "arrow_up",
      "colour": "#d04437",
      "default": false
    }
  ],
  "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).

## List resolutions

`GET /orgs/{org}/resolutions`

Scope: `tasks:read`

The organisation's resolutions, in its order. A task's resolution is set by the workflow when it is closed (a transition's screen or step), as in the app.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/resolutions" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "7a8b9c0d-1e2f-4a3b-8c4d-5e6f7a8b9c0d",
      "name": "Done"
    }
  ],
  "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).

## Get the time tracking settings

`GET /orgs/{org}/time-tracking`

Scope: `worklogs:read`

The organisation's time tracking: whether it is on (when off, new work logs are refused), the hours in a working day and the days in a working week (what a day and a week of an estimate mean), how times are shown and the unit a bare number means in the app. Work logs and estimates in the API are always seconds and minutes. Organisation admins change these in the app.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/time-tracking" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "enabled": true,
  "hours_per_day": 8,
  "days_per_week": 5,
  "format": "pretty",
  "unit": "minute",
  "copy_comment": true
}
```

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