Auth & Token Issuance
Every request authenticates with a cn_ Bearer token.
Minting a token
- Open
/[workspaceSlug]/admin/api-tokensin the Canopy app. - Click New token, give it a descriptive name.
- Choose a scope:
read(GET only) orread_write(GET + POST/PATCH/DELETE). - Optionally set an expiry.
- Copy the token — it begins with
cn_and is shown exactly once. Store it as a secret.
Sending the token
Pass it in the Authorization header on every request.
cURL
curl -H "Authorization: Bearer cn_xxxxxxxx" \
https://app.canopymethod.ai/api/v1/accountsTypeScript
const res = await fetch("https://app.canopymethod.ai/api/v1/accounts", {
headers: { Authorization: `Bearer ${process.env.CANOPY_TOKEN}` },
});Python
import os, requests
res = requests.get(
"https://app.canopymethod.ai/api/v1/accounts",
headers={"Authorization": f"Bearer {os.environ['CANOPY_TOKEN']}"},
)Scopes
A read token can only call GET endpoints. If it hits a write endpoint (POST/PATCH/DELETE) the API responds 403 with a WWW-Authenticate: Bearer scope="read_write" header. Mint a read_write token to write.
Revocation
Revoke a token from the same admin page. A revoked or expired token gets 401 with {"error":"token_revoked"} (or token_expired).
Rate limits
When you exceed the limit you get 429 with a Retry-After header and X-RateLimit-Limit / X-RateLimit-Remaining / X-RateLimit-Reset. Back off and retry after Retry-After seconds.
Never embed a token in client-side code. Treat
cn_ tokens like passwords — keep them server-side and in secret stores.