Skip to content

API keys ​

An API key lets a program or an agent work in CodeKasten as you, on one branch.

Making a key ​

Open Settings > Security on the branch the key is for, give the key a label, and click New API key.

Settings > Security

The key (sk_…) is shown once. Copy it then; afterwards only its label is listed. Revoke a key from the same page.

What a key can do ​

  • It acts for you. Whatever a program creates or changes with it is recorded under your name; what an agent does through the MCP server is recorded as that agent, acting for you ("Claude, for you"), so the history says which was which.
  • It has your role, in the workspace and on its branch, read on every request. If you only read the branch, the key only reads. If the branch is no longer given to you (by name or through a group), or you leave the workspace, it stops working.
  • It is for one branch. A key made on planning reads and writes planning. A workspace key is the exception: it is good for any branch you may change, which is what an agent that keeps its coding sessions uses. A guest cannot make one: their keys are for a branch shared with them.
  • Read only keys can look and nothing else. A key made by somebody who only reads the branch is always read only.
  • It never writes to a protected branch, whatever your role. Make keys for work on a branch that is not protected, and merge from there.

Bookkeeping keys and work keys ​

A key says what it is for:

  • A bookkeeping key (tick Bookkeeping key) is the one the Claude Code plugin keeps on your machine for a workspace: its sessions keep their own records there - the coding session, facts, gaps, memory, feature log - and change nothing else. It is a workspace key.
  • A work key is any other: for changing a product, named by its work ("blog"). A key made before there were kinds is a work key with nothing held back.

Grants: what an agent works with ​

An agent never works with the key itself. At the start of a session the plugin makes a grant from the key: what the key allows, narrowed further (the bookkeeping grant reads your sessions and the team's knowledge, but not the transcripts unless the repository asks), for 12 hours, renewed while the session runs and ended when it ends. A grant can be narrowed again for a subagent, never widened. Under Settings > Security, What your agents hold lists the grants made from your keys; Revoke ends one and everything narrowed from it. Revoking a key ends all of its grants.

Under the same page, Your agents lists the agents acting for you - a coding session each - with what they spent: Pause one and it is refused everything but its questions to you until you Resume it; Stop ends it for good. A grant can also carry a budget (calls, dollars): past it, the agent can only ask you for more.

A repository can give its sessions work keys too: list them in .codekasten.json ("work": ["blog"]) after storing each on the machine (node scripts/login.mjs '~blog' --work blog). A tool call then names the workspace it is for, and is made with that grant, also when a work key is for the workspace the session's own records are in; a call that names none stays with the bookkeeping grant, and a workspace the session holds no grant for is refused.

Plans ​

How many keys a workspace may have, whether it may have workspace keys, how many calls it may make a month and how many agents may be at work at once depend on its plan. A call past the month's limit is answered 402 with the limit in words.

Using it ​

Send the key as a bearer token:

Authorization: Bearer sk_…

It works with the GraphQL endpoint and the MCP server.

Keep it out of the browser

A key is a secret. Do not put it in a web page or a mobile app: keep it on a server that talks to CodeKasten for your page. The example shows the pattern.

Further reading ​

Every picture on this site was saved by a test that had just seen the feature work.