# Quick start

This takes about five minutes. You need a projqo account in an organisation where API access is on, and a terminal with `curl`.

## 1. Make a token

1. In projqo, open the organisation the token is for, then **Personal settings › API tokens**. A token works in that one organisation.
2. Choose **Make a token**.
3. In **Name**, write what it's for, so you know it later, such as "Weekly report script".
4. Under **Scopes**, tick what it needs. For this guide: `org:read` and `tasks:read`.
5. In **Expires after**, pick 30, 90 (the default) or 365 days, and choose **Make token**.
6. Under **Copy your token now**, choose **Copy**. The token starts with `pqt_` and is shown **only once**.

:::note
Guests can't make tokens. If you don't see **API tokens**, ask an organisation admin whether the API is allowed and who can make API tokens (Organisation settings › API).
:::

## 2. Keep it in your terminal

```sh
export PROJQO_TOKEN="pqt_…"
export PROJQO_API="https://<your projqo address>/api/v1"
```

## 3. Check who you are

```sh
curl "$PROJQO_API/me" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

The answer describes the person the token belongs to. A `401` means the token is wrong, expired or revoked: check you copied all of it.

## 4. Find your organisation's id

```sh
curl "$PROJQO_API/orgs" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

The answer lists the organisations this token may use; a personal token has exactly one. Keep its `id`:

```sh
export PROJQO_ORG="<the organisation's id>"
```

## 5. List tasks

Ask for the tasks assigned to you that aren't done, the most recently changed first:

```sh
curl -G "$PROJQO_API/orgs/$PROJQO_ORG/tasks" \
  -H "Authorization: Bearer $PROJQO_TOKEN" \
  --data-urlencode 'q=assignee = currentUser() AND statusCategory != Done' \
  --data-urlencode 'sort=-updated' \
  --data-urlencode 'limit=20'
```

The answer is a page of tasks:

```json
{
  "items": [
    {
      "id": "6f1c2a9e-3b7d-4e21-9a55-0c8d2f4b7e10",
      "key": "WEB-12",
      "summary": "Fix the sign-in redirect",
      "status": { "id": "…", "name": "In progress", "category": "In progress" }
    }
  ],
  "next_cursor": "…"
}
```

Each task carries more fields than shown here; the [reference](/reference/) lists them all. When `next_cursor` isn't `null`, there are more: send it back as `cursor` to get the next page (see [paging](/guides/paging/)).

`q` takes the same query language as Advanced search in projqo. See [the query language](/guides/query-language/).

## 6. Clean up

When you've finished trying things out, revoke the token in **Personal settings › API tokens**. A revoked token stops working at once.

## Next

- [Authentication](/guides/authentication/): tokens, expiry and revoking.
- [Scopes](/guides/scopes/): what each scope allows.
- [Errors](/guides/errors/): what each code means and how to fix it.
