Create, Use and Revoke API Keys
Quick answer
An API key lets your own scripts, the Account API and AI tools on your computer (Claude Code, Codex, Cursor, VS Code) work with your campaigns. Claude and ChatGPT don't need a key: you sign in with your Traffic Creator account instead.
Create a Key#
- In the dashboard, open API & MCP in the sidebar.
- Under Create a key, enter a Key name that says where you will use it, for example "Claude Code on my laptop".
- Choose the Access:
- Full access: create, change, pause and resume campaigns, and read everything. A full-access key can spend your credits.
- Read only: campaigns, statistics, credits and payments. Nothing can be changed or spent.
- Under Expires after, choose when the key stops working: 30 days, 90 days, 1 year (the default) or Never.
- Click Create API key.
- Click Copy and store the key somewhere safe, for example as the environment variable
TRAFFIC_CREATOR_API_KEY. Then click I have saved it — hide key.
The full key is shown only this once. If you lose it, revoke it and create a new one.
You can have up to five active keys. Use one key per tool or script, so you can revoke one without breaking the others.
Use the Key#
- Account API (your own code): send the key in the
X-API-KEYheader. See Authenticate API requests. - AI tools (Claude Code, Codex, Cursor, VS Code): the tool sends it as
Authorization: Bearer <key>. See Connect Claude Code, Connect Codex and Connect Cursor, VS Code and other MCP clients.
Key Expiry#
Under Your keys, each key shows the day it expires. From that day on, requests with the key fail with 401 and the message This API key expired on …, and an AI tool connected with the key stops working too. An expired key can't be extended: create a new key and put it into your tool or script. Expired keys are listed below your active keys and no longer count toward the five active keys. You can still revoke them to tidy up the list.
A short end date is a good choice for keys you give to an AI tool or a test script. Apps you connected by signing in, such as Claude or ChatGPT, have no end date.
Revoke a Key#
Under Your keys, click Revoke next to the key. It stops working at once. Your dashboard login is not affected.
Your keys are also revoked automatically when you:
- change or reset your password,
- set a password for the first time,
- click Sign out everywhere in your profile.
Afterwards, create new keys for your tools. Apps you connected by signing in are disconnected at the same time, so sign in again in Claude or ChatGPT.
This doesn't stop an older read-only key. Revoke it with Revoke previous key.
Disconnect an App#
Apps you connected by signing in, such as Claude or ChatGPT, are listed under Connected apps on the same page. Click Disconnect to end the app's access at once. To use it again, connect it again from the app.
Server IP Restriction#
If our team has limited your account's API access to approved server IP addresses, the page shows a Server access note with the approved addresses. Keys then only work from those addresses. Contact support to add or change an address.
Previous Read-Only Key#
If you have an older read-only key (it starts with tgp_read_), it keeps working on the Reporting API only, not on the Account API or the MCP server. You can stop it with Revoke previous key. New keys are always created under Create a key.
Keep Keys Safe#
- Store keys in an environment variable or a secrets manager, never in code you commit.
- Never put a key in browser code, a public repository, a screenshot or a chat message.
- We never ask for your key. If you send us a failing request, remove the key first.
- If a key may have leaked, revoke it at once, check your campaigns and balance for anything you don't recognize, and contact support.
Troubleshooting#
| Problem | What to check |
|---|---|
| Create API key can't be clicked | Enter a key name. If you already have five active keys, revoke one first. If Server access says it's waiting for your server's IP address, contact support. |
| Full access can't be selected | Your account has read-only API access. Contact support if you need full access. |
Requests fail with 401 and This API key expired on … | The key reached the end date you chose. Create a new key and update your tools. |
| Requests fail with 401 after a password change | Changing the password revoked your API keys. Create a new key and update your tools. |
| Requests fail with 403 | The key is read only, your server's IP address is not approved, API access is switched off, or your e-mail address isn't verified yet. See Common API error messages. |
| Lost the key | It can't be shown again. Revoke it and create a new one. |
Was this article helpful?
Still need help?
Open a ticket from your dashboard. Include your project ID and a screenshot for the fastest help.