API keys and scopes

Create keys with only the access they need, pin them to a user, and cap what they spend.

A platform API key lets your server act for your account. Create keys in the developer console under API keys. Each key has a name, the scopes it may use, and optionally a monthly spend cap, an expiry and a user it's pinned to. Creating one accepts the Developer Terms and the Acceptable Use Policy.

The console's Quickstart gives a coding agent a key without showing it the key: its prompt carries a one-time setup code (30 minutes), and the agent's one command trades it for a key that goes from the response straight into the project's .env:

curl -fsS -X POST https://api.noclick.com/v1/setup -d code=nc_setup_... >> .env

That key is named for the task the prompt hands the agent ("Coding agent: build an agent") and has the console's Full access. A code works once; a used or expired one fails with 410. The prompt tells the agent to skip that step when the project already has NOCLICK_API_KEY, so copying another prompt for the same project makes no second key: its code expires unused. Key.setup_code(name=) names the key the same way from your own code. An agent with no account at all can sign itself up and hand the account to you to claim.

A key starts with nk_live_ and is shown once, when you create it. After that the console shows only its prefix, like nk_live_ab12, which is also how you filter activity by key.

Scopes

ScopeLets the key
userscreate, read, update and suspend users, and mint sessions
credentials:requestcreate and delete connections, send connect links, import credentials
credentials:uselist and verify connections and run integration operations through them
credentials:tokenread a connection's OAuth access token
toolsget toolkit definitions and run tool calls
humansask, approve and notify people
approvals:answerapprove or decline a call NoClick holds for your account's owner's yes, as long as the key didn't make it and could make it itself; a key with * doesn't have it unless it's named too
approvals:policyswitch what NoClick holds for a person, for the whole account, or loosen them for one key or connected app (never itself; tightening one takes no scope); a loosening it makes waits a 10-minute undo window and tells the owner; a key with * doesn't have it unless it's named too
keys:createmake secret keys no wider than itself, which never outlive it; a key with * doesn't have it unless it's named too
agentscreate, change and message agents
agents:terminaltake over a coding agent's terminal, which shows its sandbox's keys and tokens; a key with * doesn't have it unless it's named too
account:phoneslink phone numbers to your account and unlink them; a linked number signs in to your account, so a key with * doesn't have it unless it's named too
workflows:variablesread a workflow's variables' values, of a workflow you own or can edit, which no other read of it carries; they hold what its steps are given as secrets, so a key with * doesn't have it unless it's named too
channelsopen and use channels
inboxcreate and read inboxes, and reply
phonebuy phone numbers, route them and place calls
aicall AI models; talking to an agent as a model takes agents
renderdraw a picture or a PDF for a reply from a composition, kept as one of your files; a page of a repo in it takes repos too
sandboxesstart and use sandboxes
operationslist operations, count them, and read an agent turn's tool calls
usageread spend and the activity logs
policyread and set policy
brandread and set your brand
webhooksmanage webhook endpoints and read events
webhooks:revealread a webhook's signing secret; a key with * doesn't have it unless it's named too
mcp_serverscreate and manage hosted MCP servers
storagecreate buckets, read and write their files, and mint signed links
volumescreate volumes, and read and write their files
dictscreate dicts, and read and write their keys
queuescreate queues, and send, receive and settle messages
secretscreate secrets and set their values, which no key can read back
workflowsrun workflows and give them endpoints
appscreate and deploy apps, and set their bindings, secrets, schedules and app services
reposcreate repos, commit, and mint clone links
databasescreate and query databases, migrate, restore and branch them
domainssearch, connect and manage domains
domains:buybuy and renew domains, which charges your account
browsersstart browsers and manage browser profiles
machinesrent and run machines
machines:vettingask for machines for your company from your server, saying who accepted the machines usage policy and when; a key with * doesn't have it unless it's named too
projects:publishmake an app's code public from your server: anyone can then clone it; a key with * doesn't have it unless it's named too

Scopes for cards

ScopeLets the key
cardscreate and manage cards and read their transactions
cards:revealhand out a card's number: a reveal page or a purchase's number

The console offers sets of these: Full access is every scope except the five that read secrets, credentials:token, cards:reveal, webhooks:reveal, agents:terminal and workflows:variables, approvals:answer, which says yes for your account's owner, approvals:policy, which switches what waits for them, machines:vetting, which accepts the machines usage policy for your company, keys:create, which makes keys, projects:publish, which makes an app's code public, and account:phones, which links a phone that signs in to your account (each of those it offers on its own, beside Full access); GET /v1/account lists Full access in meta.scopes, and the scopes it leaves out, each held by naming it, in meta.explicit_scopes (a key with * also holds credentials:token); Read-only is usage and operations; or pick your own. Only grant credentials:token to code that must call providers directly, since it can read your users' access tokens, cards:reveal only to code that hands a card's number to a person or announces purchases, webhooks:reveal only to the receiver that verifies deliveries, agents:terminal only to the server that opens a terminal for the person who'll drive it, workflows:variables only to code that must read a variable's value itself, for the workflows you own or edit, approvals:answer only to the code that decides on your behalf, on a key of its own, approvals:policy only to the code that sets your approval switches, machines:vetting only to the sign-up flow that records who accepted the machines usage policy, keys:create only to the code that hands its workers keys of their own, projects:publish only to the code that publishes your apps' code, and account:phones only to the code a person links their own phone through.

A call a key's scopes don't cover fails with noclick.PermissionDenied. Reading, waiting on and cancelling one operation by its id needs no scope.

Let your code make keys

One of your account's own secret keys that names keys:create makes keys from your server, so code that runs a fleet of workers hands each its own key without you minting them in the console:

worker = noclick.Key.create("queue worker 7", ["queues", "agents"], spend_cap_usd_per_month=20)
os.environ["WORKER_KEY"] = worker.secret   # shown this once

Over HTTP it's POST /v1/keys. A key it makes is never wider than the key making it, and each way it would be is refused with noclick.PermissionDenied naming the field:

  • Scopes: only scopes the key holds itself; * only from a key holding *, and a scope a key holds only when it's named (keys:create among them) only from one that names it.
  • Cap: when the key has a monthly spend cap, the new key needs one too, at most that.
  • Expiry: when the key expires, the new key does too, no later.
  • Approval settings: the new key starts with the approval settings the key set for itself.
  • Lifetime: the new key names the key that made it (minted_by), and revoking a key revokes every key it made, and theirs.

It makes secret keys only (a publishable key is yours to make, signed in), and only a key acting for your whole account makes any: a key pinned to a user, a session, an app's code, an MCP connection or an agent's turn is refused.

Pin a key to a user

A key pinned to a user always acts for that user, without as_user, and can't act for any other: naming another user fails with noclick.PermissionDenied. Use one for a service that only ever works for one customer.

For code in a browser, don't use a pinned key: mint a session, which expires.

Cap a key's spend

A key's monthly spend cap limits everything done with that key. Once it's reached, calls with the key fail with noclick.SpendCapExceeded until the next month or until you raise the cap. You can change a key's name and cap at any time in the console.

Publishable keys

A web page can't hold a secret key: anyone can read it from the page. A publishable key starts with nk_pub_ and is safe to ship in a page, because it can call only the endpoints you've made public and listed on it, such as a shared agent's chat or a workflow's public endpoint. It reads nothing else, and spends only through those endpoints.

Create one in the console under API keys, choosing Publishable as the key type. For each one you pick:

  • Endpoints: the public endpoints it may call. A key with none calls nothing.
  • Per-visitor limit: how many calls one visitor (by IP address) may make a minute; more fail with 429 and noclick.RateLimited. The default is 20.
  • Allowed origins: the sites that may use it from a browser, like https://acmebooking.com. A call from any other origin, or with none, fails with 403 and noclick.PermissionDenied; with none listed, any site may.

A publishable key is shown in full at any time, since it isn't a secret, and it still has a monthly spend cap: the turns and runs its visitors start count against it, as well as against your other caps. Change its endpoints, limit and origins from its row's menu; calls to an endpoint you take off it, or one that stops being public (an agent whose page you turn off), are refused at once.

A visitor never learns about your account's money or rules: a call a cap, your balance or your policy stops answers 409 with not_available, and the reason shows in your activity instead. A call for a user whose spending you paused answers 402 spending_paused with only what you wrote for that user: its user_message, action and since. Any other route refuses a publishable key with 403. To act as one of your users in the browser, with their own agents and connections, mint a session instead.

Keys NoClick gives your apps

An app you deploy on NoClick whose repository asks for a key to your account is given one by NoClick once you agree to what it can do. It's listed here with your other keys, naming its app (project_id in GET /v1/keys), and you cap, rename and revoke it the same way. It has no value to show: its app's production release holds a bearer of its own, starting nk_app_, that works only while that release serves. It never holds *, keys:create, approvals:answer or approvals:policy.

Revoke a key

Revoking a key stops it at once, along with every session it minted. To rotate a key, create the new one, deploy it, then revoke the old one.