> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudthinker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# API Quickstart

> Create an API token, make your first Public API call, and list recent reviews in about five minutes.

This quickstart takes you from no token to a working call against your workspace in about five minutes. You need the **Developer** or **Admin** role in the workspace you want to read (Viewers can't create tokens), and a terminal with `curl` and [jq](https://jqlang.org), or the [CloudThinker CLI](https://docs.cloudthinker.io/guide/cli/overview.md).

## Create a token and call the API

**1. Create a token**

Open **Account Settings → Security → API tokens** and click **Create token**. Enter a **Token name**, such as `review-report`. Pick the **Workspace**. Under **Choose permissions**, click **Use template** on **Read reviews**. Leave **Expiration** at 30 days and click **Review token**, then **Create token**.

**2. Copy the token**

Copy the token that starts with `ct_pat_`. CloudThinker shows it once. Store it in your secret manager or an environment variable:

```bash theme={null}
export CLOUDTHINKER_TOKEN="<your-token>"
```

**3. Check the token**

Ask the API who the token belongs to and which workspace it can reach, and save the answer:

```bash theme={null}
curl -sS https://app.cloudthinker.io/api/public/v1/token \
  -H "Authorization: Bearer $CLOUDTHINKER_TOKEN" > token.json
jq . token.json
```

```json theme={null}
{
  "token_id": "6d1c…",
  "user_id": "0b9e…",
  "client": "sdk",
  "scopes": ["review:findings:read", "review:releases:read", "review:reviews:read"],
  "workspace_ids": ["3f2a…"],
  "expires_at": "2026-12-14T00:00:00Z",
  "service_account_id": null
}
```

Save the workspace ID for the next calls:

```bash theme={null}
export WORKSPACE_ID=$(jq -r '.workspace_ids[0]' token.json)
```

**4. List your recent reviews**

> [tab] curl
>
> ```bash theme={null}
> curl -sS "https://app.cloudthinker.io/api/public/v1/workspaces/$WORKSPACE_ID/review/reviews?limit=5" \
>   -H "Authorization: Bearer $CLOUDTHINKER_TOKEN"
> ```

> [tab] CLI
>
> ```bash theme={null}
> cloudthinker api review.reviews.list -w "$WORKSPACE_ID" --limit 5
> ```

The CLI reads `CLOUDTHINKER_TOKEN`. Pass the workspace ID (a UUID, not its name) with `-w` after the operation name.

> [!NOTE]
>
> Don't set `CLOUDTHINKER_WORKSPACE` or the global `--workspace` flag together with `CLOUDTHINKER_TOKEN`. The CLI refuses the pair and exits with code 2: "--workspace cannot be used with CLOUDTHINKER\_TOKEN".

## What to expect

| Result | Meaning |
| - | - |
| `200` with `items` | The token works. `items` is empty when the workspace has no reviews yet. |
| `401` `token_invalid` | The token was mistyped, revoked or has expired. Create a new one. |
| `404` `workspace_not_found` | The workspace ID isn't the one the token was created for. Use the ID from `GET /v1/token`. |
| `403` `scope_missing` | The token doesn't have `review:reviews:read`. Create a token with the **Read reviews** template. |

See [API Errors](https://docs.cloudthinker.io/guide/api/errors.md) for every code.

## Next steps

> [card] [Approvals for API Runs](https://docs.cloudthinker.io/guide/api/approvals.md#start-a-run-and-get-its-answer)
>
> Start an agent run and read its answer.

> [card] [API Tokens](https://docs.cloudthinker.io/guide/api/tokens.md)
>
> Pick scopes, add a service account and revoke tokens.

> [card] [Use CloudThinker in CI/CD](https://docs.cloudthinker.io/guide/api/ci-cd.md)
>
> Call CloudThinker from GitHub Actions or GitLab CI.

> [card] [API reference](https://docs.cloudthinker.io/api-reference/token/get.md)
>
> See every operation, field and scope.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.