Authentication
Sign in with OAuth, or call the server from your own code with a team API key.
The server accepts two kinds of bearer token on the same endpoint. People sign in with OAuth from their MCP client. Code that runs without a person, such as a reporting pipeline or an internal AI tool, sends a team API key. Both see the same tools, with the exceptions listed under what a key can do.
| OAuth sign-in | Team API key | |
|---|---|---|
| Token | Issued to the MCP client after the person signs in | ck_team_ followed by 40 letters and digits |
| Acts as | The signed-in person | The team that issued the key |
| Needs | Pro, a Pro trial, Team or Student on that person's account | An active ChartKit Enterprise team licence |
| Chart colours | The team palette, else the person's saved palette | The team palette, else ChartKit's default colours |
| Deck tools | Available while the person has the deck open in Chrome | Not available |
OAuth sign-in
MCP clients that implement the MCP authorization spec handle this flow themselves. You only give them the server URL. For reference, this is what happens.
Discovery
A request without a valid token gets
401with aWWW-Authenticateheader. Itsresource_metadatapoints tohttps://www.getchartkit.app/.well-known/oauth-protected-resource/mcp, which names the authorization server.Registration
The client registers itself at
https://www.getchartkit.app/oauth/register(dynamic client registration), so there is no client id to set up.Sign-in
The client opens
https://www.getchartkit.app/authorize, which sends the person to the ChartKit sign-in page. They sign in with Google, using the same account as the ChartKit extension. The scope ischartkit.Token
The client exchanges the code at
https://www.getchartkit.app/oauth/tokenand sends the access token asAuthorization: Beareron every request.
Every tool call checks the person's plan. Without Pro, a trial, Team or Student, the call returns an error result that links to the dashboard, and nothing is drawn. Connecting and listing tools work on any plan.
Team API keys
A team API key lets your own code call the server without a person signing in. It belongs to a ChartKit Enterprise team, not to the employee who created it, so it keeps working when that person leaves the team.
Create a key
Open the team page
Sign in at www.getchartkit.app/team as an owner or admin of a licensed ChartKit Enterprise team.
Name the key
In the API keys panel, enter a name that says where the key runs, such as
reporting-pipeline-prod, and create it.Copy the secret
The secret is shown once. Store it in your secret manager or deployment environment, for example as
CHARTKIT_API_KEY. ChartKit keeps only a hash and cannot show it again.
A team can have up to 20 active keys. If nobody on your side has team admin access, ChartKit can issue a key for you. Write to support@getchartkit.app.
Send the key
Send the key in the Authorization header of every request. There is no token exchange and no expiry.
What a key can do
- Charts use the team palette that an admin saved on the team page. With no team palette saved, ChartKit's default colours apply.
- Tool calls need the team's licence to be active. When it lapses, every tool call returns an error result saying the licence is not active. The key itself stays valid, so calls work again once the licence is renewed.
insert_chart_into_slides,list_open_decksandlist_charts_in_deckare left out oftools/list, and calling one returns an error result. They act on a deck that a signed-in person has open in Chrome. Insert the chart with the Google Slides API instead, as the Python guide shows.
Revoke and rotate
Revoke a key from the same panel. Revocation takes effect immediately, and the next request with that key gets HTTP 401. To rotate a key without downtime:
Create a new key and store it next to the old one.
Deploy your service with the new key and check that its requests succeed.
Revoke the old key.
Keep keys safe
- Read the key from an environment variable or a secret manager. Never commit it to a repository or paste it into a notebook.
- Use keys only from server-side code. A key in browser JavaScript or a mobile app can be read by anyone who has the app.
- Create one key per service and environment, so you can revoke one without stopping the others.
- Rotate keys on a schedule and when someone with access to them leaves.
- If a key leaks, revoke it first, then issue a replacement.
Anyone who holds a key can draw charts as your team and use your team's licence. Treat it like a database password.
Connect a client with a key
These examples read the key from the CHARTKIT_API_KEY environment variable. In the plain Claude Code command, your shell expands the variable once and Claude Code stores the key in its config. The project file form keeps only the variable name.
Coding tools and editors
Model APIs and HTTP
The Claude API and OpenAI API call the server from their own infrastructure, so the URL must be public, which it is. Both run the tool calls and return the model's answer; to read structuredContent yourself, call the server directly as the Python guide does.
Requests without a valid token
A missing, malformed, unknown or revoked token gets HTTP 401 before any JSON-RPC handling. This is the response to a request without a token.