Send the credential in the Authorization header: Authorization: Bearer hk_live_…. The same header works for REST, the SDK, the CLI and the MCP connector.
Keys are made on the Connect page (/dashboard/connect). An owner or admin makes any key; a developer, or a full key, makes keys narrower than itself, limited to one project. A key is shown once and stored only as a hash. It works until it is revoked, unless you give it an expiry date, and an owner or admin can pause it without revoking it (below). Revoking takes effect immediately.
One key builds everything: projects, services and deploys, from your laptop, CI or your AI. Each app gets its own key automatically (HARAKUMO_API_KEY): it works for every service in that project, AI and email included, and nothing outside it. Credentials lists every other credential an app meets.
Kinds of key
| Key | Acts as | Can |
|---|---|---|
| Full, whole workspace | developer | Create, change and delete resources in every project, deploy, send mail, use AI, buy domains from the Balance. It can also delete projects. |
| App key (HARAKUMO_API_KEY) | the app | Made by the platform for each app and set at every deploy. It works for every service in that project, AI and email included, and nothing outside it. Never shown. |
| App key, one project | the app | Made with projectId alone (or scope: "app"): the runtime calls on that project only, as HARAKUMO_API_KEY makes them (data, storage, AI, email, sign-in, payments, agents). It cannot deploy, read env values, read or change function code, reach Repos or change domains: 403 scope_missing. |
| Full, one project | developer | Made with scope: "full" and projectId. The same as a full workspace key, but only on that project's endpoints, plus sending mail as that project and calling AI for it. Workspace-wide endpoints refuse it. |
| Read-only, whole workspace | viewer | GET requests, plus reads sent as POST (vector query, memory search, storage download links). No environment variables, no SQL, no uploads. |
| Read-only, one project | viewer | Reads on that project only. |
No API key can manage billing or members, make a key wider than itself, or move money out: withdrawals, refunds and payout setup need the workspace owner signed in to the dashboard. A full key may make keys limited to one project in its reach, and revoke the ones it made.
Which key to give what
| Use | Key |
|---|---|
| Your laptop, CI, setup scripts | Full, whole workspace |
| An app hosted on Harakumo | Nothing to make: its own key is set for it (HARAKUMO_API_KEY) |
| A deployed app that uses its database, storage, payments, vectors, memory or auth pool | App key, one project (projectId alone) |
| A deployed app that also sends mail or calls the AI Gateway | App key, one project: it sends mail and calls AI for its own project, paid for by the workspace |
| CI or a deploy script for one project | Full, one project (scope: "full" with projectId) |
| Dashboards, monitoring, read-only AI assistants | Read-only |
Where a project key works
A project key passes every route that names its project: /api/projects/<id>/…, and item routes whose resource belongs to it — /api/databases/:id, /api/storage/:id, /api/functions/:id, /api/vectors/:id, /api/memory/:id, /api/agents/:id, /api/payments/:accountId, /api/auth-pools/:id, /api/deployments/:id.
It also sends mail (POST /api/mail/send) and calls the AI Gateway (/api/ai/chat, /api/ai/playground, /api/ai/v1/chat/completions and /api/ai/embeddings) for its own project. Leave projectId out (for AI, also the X-Harakumo-Project header) and the call acts for the key's project; naming another project is refused. The email quota and the AI spend are the workspace's, as with any key, and a read-only key can neither send mail nor spend on AI.
On the routes that cover the workspace it reads and keeps its own project's share, without naming the project: its AI calls and spend (/api/ai/requests), its mail log (GET /api/mail/messages) and suppression entries (/api/mail/suppressions), its usage (GET /api/usage) and the project's own repo (/api/repos; an app key does not reach the repo). Another project there is refused with 403 key_project_mismatch. The rest refuse it with 403 key_workspace_endpoint: listing projects, mail settings and sending domains, /api/domains/*, making a repo, and billing.
Its mail goes out only as its own project. It sends from an address on the project's own sending domain (the domain of the project's saved From address) or from the shared no-reply; another domain of the workspace answers 403 from_not_project_domain. It never sends under another project's name or sender name, or a close variant of one (a name that contains one of five letters or more, or is one letter off one of six or more): 403 sender_name_other_project. A variant of a name its own project's name already contains is its own ("Fruitly API" may send as "Fruitly Receipts"), but another project's exact name never is. The same rules apply when it changes its project's mailFrom or mailSenderName with PATCH /api/projects/:id. To move a project to a new sending domain, a person sets its From address on the Mail page.
Create a key with the API
curl -X POST https://harakumo.com/api/orgs/<workspaceId>/api-keys \
-H "Authorization: Bearer $HARAKUMO_API_KEY" -H "content-type: application/json" \
-d '{ "name": "notes-app production", "projectId": 12 }'
# 201 → { "key": { "id", "prefix", "scope": "app", "access", "project_id" }, "secret": "hk_live_…" } (secret shown once)
# projectId alone makes an app key: runtime calls only, never deploys, env values or code.
# A deploy key for project 12 (CI): -d '{ "name": "ci deploy", "scope": "full", "projectId": 12 }'A key for the whole workspace needs an owner or admin. A developer, or a full key, may make a key narrower than itself: limited to one project in its reach, no wider access, no mail access and no later end (POST /api/projects/:id/keys { name, scope }, or this route with projectId). A read key or an app key makes none.
Expiry and pause
- Give a key an end date:
PUT /api/orgs/:id/api-keys/:keyId/expiry { days }(1 to 730, counted from now) or{ expiresAt }(a date within 730 days);null, orDELETEon the same path, means it never expires. Past the date every request with it is refused with 401key_expired. An expired key given a new date works again. - Pause a key that may have leaked but that an app you cannot update yet still holds:
POST /api/orgs/:id/api-keys/:keyId/pause. Every request with it is refused with 403key_pauseduntilDELETEon the same path resumes it. Nothing else about the key changes. - Both need an owner or admin, answer the key with its state (active, expired, paused or revoked), and are written in the workspace's audit log. The same controls are on the Connect page and in an admin's AI connector (set_api_key_expiry, pause_api_key).
- A key made by a person whose account Harakumo has suspended is refused too (403
key_creator_suspended) until the account is restored. Create a new key for the app.
Other credentials
Every credential an app meets, with who makes it and how it is rotated, is in Credentials.
| Credential | Where it comes from | Acts as |
|---|---|---|
| Browser session | Signing in to the dashboard; an httpOnly cookie, 30 days | You, with your role in the chosen workspace |
| Connector token (hk_mcp_…) | Connecting Claude, ChatGPT or another MCP client (OAuth) | You, read-only or read-and-manage, in one workspace or all of them |
| Auth-pool client secret (as_…) | Enabling an auth pool | Only that pool's sign-in actions — never anything else |
| Auth-pool client id (ap_…) | Enabling an auth pool | Publishable: browser sign-in for that pool, when turned on |
Choosing a workspace
A key belongs to one workspace. A session or an all-workspaces connector acts in the workspace named by ?org=<id> or the x-harakumo-org header, else the one last chosen in the dashboard.
When a key is refused
| Status | Message | What to do |
|---|---|---|
401 unauthorized | Authentication required | The header is missing, or the key was revoked or mistyped. Make a key on the Connect page. |
401 key_expired | This API key expired on … | Give the key a new date, or create a new key. |
403 key_paused | This API key is paused | An owner or admin resumes it on the Connect page. |
403 key_creator_suspended | This API key was created by an account that is suspended | Create a new key; nothing has been deleted. |
403 key_read_only | This API key is read-only | Use a full key for writes. A read key runs SQL that only reads. |
403 key_project_mismatch | This API key only works on project N | Use a key for that project, or a workspace key. |
403 key_workspace_endpoint | This API key only works on project N; this endpoint covers the whole workspace | Use a workspace key for routes that cover the whole workspace (listing projects, launching an app). |
403 scope_missing | This is an app key: it makes its app's runtime calls … | An app key makes its app's runtime calls only: deploy, read settings or delete with a workspace key, or in the dashboard. |
403 role_forbidden | Your role (developer) does not allow this action | The action needs an admin or owner (members, keys for the whole workspace, billing); a developer, or a full key, makes keys limited to one project and revokes the ones it made. The SDK stops what only an owner or admin may do before sending when it holds a key, with dashboard_url. |
403 org_forbidden | This API key belongs to another workspace | Use a key made in the workspace the request names. |
| 404 | Not found | The id does not exist or belongs to another workspace — the two look the same on purpose. |
Reference
import Harakumo from '@harakumo/sdk';
const hk = new Harakumo({ apiKey: process.env.HARAKUMO_API_KEY }); // baseUrl defaults to https://harakumo.com
// Errors throw HarakumoError with .status and .body (the JSON the API sent).harakumo login --key hk_live_… # or set HARAKUMO_API_KEY; --key and --url work on every command
harakumo whoamiAuthorization: Bearer hk_live_…
GET /api/orgs/:id/api-keys # list (admin+); secrets are never returned
POST /api/orgs/:id/api-keys { "name", "scope"?: "app" | "full" | "read", "access"?: "full" | "read", "projectId"?, "expiresInDays"? } # projectId without scope: an app key
PUT /api/orgs/:id/api-keys/:keyId/expiry { "days": 90 } | { "expiresAt": "2027-01-31" } | { "days": null }
DELETE /api/orgs/:id/api-keys/:keyId/expiry # never expires
POST /api/orgs/:id/api-keys/:keyId/pause # 403 key_paused until DELETE resumes it
DELETE /api/orgs/:id/api-keys/:keyId # revoke