# ClickUp
<!--
ref: @integrations/clickup
type: protocol
tags: [API, integration, clickup, project-management, tracker, curly]
triggers: [authentication errors, need to decode ClickUp URLs, bulk export tasks, manage tasks and lists]
trigger_prompt: When you encounter authentication issues with ClickUp, need to extract IDs from URLs, or want to automate task management and exports.
complements: [@integrations/curly, @integrations/index]
audience: [agent-author, claude-code-user, terminal-only]
version: 14
updated_at: 2026-10-24T21:16:23.164Z
-->

Read and write ClickUp tasks, lists, and spaces through `curly clickup` — including the raw-`Authorization` auth quirk that makes a `Bearer` prefix fail with a misleading OAUTH_019.

> **Use `curly clickup`. Don't roll your own `curl https://api.clickup.com/...`.**
> ClickUp's auth quirk is silent: a `Bearer` prefix in `Authorization` returns `OAUTH_019` ("Oauth token not found") which reads like a token problem but is actually a header-shape problem. `curly clickup` sends the personal token raw in `Authorization`, which is what the v2 API expects.

## When to Use

- Read open Bugs / Improvements / phase lists on a ClickUp space
- Decode an app URL (`https://app.clickup.com/.../v/b/{s|li|t}/{id}`) into the API id you need
- Create or update tasks, comments, custom-field values, statuses
- Bulk-export a list to a local cache so you don't re-hit the API in a loop

## Setup

```bash
curly init clickup    # hidden prompt for the token → ~/.curly.yaml
```

`clickup` is a built-in service — host and the raw-`Authorization` auth mode ship with curly, so the token is all you supply. Get it at https://app.clickup.com/settings/apps → **Personal Token** (`pk_<userid>_<token>`). Setup flow and troubleshooting: [`@integrations/curly`](/@integrations/curly).

The personal token embeds the user id (the digits between the two underscores). That's the same id you'll see as `creator.id` on tasks you create — useful when verifying that a script ran "as you."

Verify:

```bash
curly clickup /team | jq '.teams[] | {id, name}'
```

If you see `OAUTH_019`, something is sending `Bearer`. Check the service entry — config is data, so read it rather than reading the script:

```bash
yq '.services.clickup | {host, auth, auth_header}' ~/.curly.yaml
# → auth: header   auth_header: Authorization     ✅
# → auth: bearer                                  ❌  hand-written entry predating the built-in
```

Fix it by re-running `init` with the right fields — it updates in place and leaves your token alone:

```bash
curly init clickup auth=header auth_header=Authorization
```

## Critical Gotchas (read first)

### ⚠️ Auth header is RAW, not Bearer

```
Authorization: pk_12345_ABCDEFG          ✅
Authorization: Bearer pk_12345_ABCDEFG   ❌  → {"err":"Oauth token not found","ECODE":"OAUTH_019"}
```

This is the only ClickUp gotcha that costs hours. `curly clickup` handles it; raw `curl` users get bitten.

### ⚠️ "Team" in the API means "Workspace" in the UI

The URL `https://app.clickup.com/{team_id}/...` and the API path `/team/{team_id}` both refer to what the UI now calls a **Workspace**. ClickUp renamed it in the UI but not in the API. When you see `team_id` in API responses, that's the workspace.

### ⚠️ ID grammar — five levels, all numeric

```
Workspace (team)  →  Space  →  Folder  →  List  →  Task
   90100000000       901000000001       901000000002  901000000003   86abc1def
```

- Workspace / Space / Folder / List ids are big numerics (~12 digits).
- Task ids are short alphanumeric (`86abc1def`) — looks like a hash but is a sortable id.
- **Folders can be hidden** (`folder.hidden = true`). A list in a hidden folder is reachable directly by list id but won't show in the parent folder's child list. You can have "folderless lists" too — query `space/{id}/list` (with no folder), not just `folder/{id}/list`.

### ⚠️ Decoding a ClickUp app URL

`https://app.clickup.com/{team_id}/v/b/{kind}/{id}` — the `/v/b/` segment is "board view." The id after it depends on the `{kind}`:

| Kind | Resolves to | API call |
|---|---|---|
| `s/{id}` | Space | `GET /space/{id}` |
| `f/{id}` | Folder | `GET /folder/{id}` |
| `li/{id}` | List | `GET /list/{id}` |
| `t/{id}` | Task (or workspace home if id == team_id) | `GET /task/{id}` |
| `dc/{id}` | Doc | (no public v2 docs API; UI only) |

Heuristic: if `{id}` equals the `{team_id}` in the URL, the link is the workspace home, not a task.

### ⚠️ Pagination is page-based, 100 tasks/page, and silently caps

`GET /list/{id}/task?page=N` returns up to 100 tasks. There is no `total` field. To know if you're done, check whether `tasks.length < 100`. **Closed tasks are excluded by default** — pass `&include_closed=true` to see them, and pass `&archived=true` if you want archived ones too (separate flag).

```bash
page=0
while :; do
  body=$(curly clickup "/list/${LIST_ID}/task?page=${page}&archived=false&include_closed=false")
  jq -r '.tasks[] | "[\(.status.status)] \(.id)  \(.name)"' <<<"$body"
  count=$(jq '.tasks | length' <<<"$body")
  [ "$count" -lt 100 ] && break
  page=$((page+1))
done
```

### ⚠️ Rate limit: 100 req/min per token

ClickUp returns HTTP 429 when you exceed it. There is **no** `Retry-After` header — back off and retry. For bulk reads, `sleep 0.7` between calls keeps you well under the line (≈ 85 req/min).

### ⚠️ Custom statuses live on the space (or list override)

Statuses are NOT a fixed enum. `GET /space/{id}` returns the space's `statuses` array; lists can override via `override_statuses: true`. When filtering or updating, send the `status` **name** (e.g. `"in progress"`), not the id (`p901000000001_AbCdEfGh`). The id form is used in webhooks and is not always interchangeable.

## Common Errors

| HTTP | `ECODE` / `err` | Usually means |
|---|---|---|
| 401 | `OAUTH_019` "Oauth token not found" | `Bearer` prefix on Authorization, or token is empty/wrong |
| 401 | `OAUTH_017` "Authorization failed" | Token valid but lacks scope for the resource |
| 404 | `TEAM_110` etc. | Wrong id, or the resource is in a workspace your token isn't in |
| 429 | (no body code) | Rate limited; sleep and retry |
| 500 | `OPP_001` etc. | ClickUp transient; retry once before alarming |

Always check the `ECODE` string — HTTP status alone is not enough to disambiguate.

## Cheat Sheet

### Discovery

| Op | Call |
|----|------|
| List workspaces | `curly clickup /team` |
| List spaces in a workspace | `curly clickup /team/{team_id}/space?archived=false` |
| List folders in a space | `curly clickup /space/{space_id}/folder` |
| List folderless lists in a space | `curly clickup /space/{space_id}/list` |
| List lists in a folder | `curly clickup /folder/{folder_id}/list` |
| Space metadata + statuses | `curly clickup /space/{space_id}` |
| List metadata | `curly clickup /list/{list_id}` |

### Tasks — read

| Op | Call |
|----|------|
| One task | `curly clickup /task/{task_id}` |
| One task with subtasks | `curly clickup "/task/{task_id}?include_subtasks=true"` |
| One task with markdown body | `curly clickup "/task/{task_id}?include_markdown_description=true"` |
| List tasks (paginated) | `curly clickup "/list/{list_id}/task?archived=false&page=0"` |
| Include closed | `curly clickup "/list/{list_id}/task?include_closed=true&page=0"` |
| Filter by assignee | `curly clickup "/list/{list_id}/task?assignees[]={user_id}"` |
| Workspace-wide filtered query | `curly clickup "/team/{team_id}/task?space_ids[]={space_id}&statuses[]=to%20do"` |

### Tasks — write

| Op | Call |
|----|------|
| Create | `curly clickup /list/{list_id}/task -X POST -d @body.json` |
| Update | `curly clickup /task/{task_id} -X PUT -d '{"status":"in progress"}'` |
| Comment | `curly clickup /task/{task_id}/comment -X POST -d '{"comment_text":"..."}'` |
| Set custom field | `curly clickup /task/{task_id}/field/{field_id} -X POST -d '{"value":"..."}'` |
| Add tag | `curly clickup /task/{task_id}/tag/{tag_name} -X POST` |
| Delete | `curly clickup /task/{task_id} -X DELETE` |

### Members & assignees

| Op | Call |
|----|------|
| Workspace members | `curly clickup /team` (members are inside each team) |
| List-scoped members | `curly clickup /list/{list_id}/member` |
| Search by email/handle | client-side filter on the `/team` payload — no server search endpoint |

## Patterns

### Anything non-trivial: bun + `-d @file.json`, not inline `-d '...'`

ClickUp task bodies routinely contain markdown with backticks, em-dashes, embedded quotes, and newlines. Inline `-d '{...}'` will eventually mangle one of them. Write to a tempfile:

```bash
cat > /tmp/task.json <<'JSON'
{
  "name": "CSV export fails: date column doesn't parse",
  "markdown_description": "## Repro\n1. ...\n2. ...\n\n## Expected\n...\n",
  "status": "to do",
  "priority": 2,
  "tags": ["bug","export"]
}
JSON
curly clickup /list/{list_id}/task -X POST -d @/tmp/task.json
```

The single-quoted `'JSON'` heredoc delimiter passes `$`, backticks, and backslashes through verbatim.

### URL → API in one line

When the user pastes a ClickUp app URL, extract ids with sed:

```bash
URL='https://app.clickup.com/90100000000/v/b/li/901000000004'
TEAM=$(sed -nE 's#.*clickup.com/([0-9]+)/.*#\1#p' <<<"$URL")
KIND=$(sed -nE 's#.*/v/b/([a-z]+)/.*#\1#p' <<<"$URL")
ID=$(sed   -nE 's#.*/v/b/[a-z]+/([A-Za-z0-9]+).*#\1#p' <<<"$URL")
echo "team=$TEAM kind=$KIND id=$ID"
case "$KIND" in
  s)  curly clickup "/space/$ID" ;;
  f)  curly clickup "/folder/$ID" ;;
  li) curly clickup "/list/$ID" ;;
  t)  curly clickup "/task/$ID" ;;
esac
```

### Local cache to avoid re-hitting the API in a loop

```bash
mkdir -p .clickup
curly clickup "/list/${LIST_ID}/task?archived=false&include_closed=false&page=0" \
  > .clickup/list-${LIST_ID}.json
jq -r '.tasks[] | "[\(.status.status)] \(.id)  \(.name)"' .clickup/list-${LIST_ID}.json
```

For projects: gitignore the cache, refresh on demand, and never let the UI become the source of truth in a script. **`.clickup/` belongs in `.gitignore`.**

### Bulk-export to JSONL (TS + bun)

For >50 tasks or anything composing logic (dedup, project to a different schema, write to disk + DB), drop to a script. Same shape as `@integrations/notion`'s recipes:

The token lives in `~/.curly.yaml`, so read it from there — don't reintroduce a `CLICKUP_TOKEN` env var just for the script:

```ts
// scripts/clickup-export.ts — `bun run scripts/clickup-export.ts <list_id>`
const token = (await Bun.$`yq -r '.services.clickup.token' ~/.curly.yaml`.text()).trim();
const listId = process.argv[2];
const out = Bun.file(`.clickup/${listId}.jsonl`).writer();
for (let page = 0; ; page++) {
  const r = await fetch(
    `https://api.clickup.com/api/v2/list/${listId}/task?archived=false&page=${page}`,
    { headers: { Authorization: token } } // <- raw, NOT `Bearer ${token}`
  );
  const { tasks } = await r.json();
  for (const t of tasks) out.write(JSON.stringify(t) + "\n");
  if (tasks.length < 100) break;
  await Bun.sleep(700);
}
await out.end();
```

## See Also

- `@integrations/curly` — the wrapper itself (auth modes, token sourcing)
- `@integrations/index` — full list of integrations
- ClickUp API reference: <https://clickup.com/api> (OpenAPI: <https://api.clickup.com/api/v2/openapi.json>)

---

*Related: `@integrations/agent-browser` · `@protocol/protocol-api` · `@integrations/notion` · `@integrations/loom` · `@protocol/ask-lifecycle`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*