Skip to main content
Every request to the A2Agent API must be authenticated with an API key. Keys are created in the console, scoped to your account, and billed against your prepaid balance. You can create multiple keys — for example, one per project or environment — and revoke any of them independently at any time.

Creating an API Key

1

Log In

Sign in to your account at https://a2agent.me/login.
2

Navigate to API Keys

In the console sidebar, click API Keys to open the key management page.
3

Create a New Key

Click Create Key. Optionally enter a descriptive label (for example, production or dev-laptop) to help you identify the key later.
4

Copy the Key Value

The full key is displayed exactly once immediately after creation. Copy it to a secure location such as a password manager or environment variable file. You will not be able to retrieve the full value again after closing this dialog.
5

Note the Base URL

Your base URL is the same for all keys and all models:
Save this alongside your key so you can configure clients in one go.

Using Your API Key

Pass your API key in the Authorization header as a Bearer token on every request.

OpenAI-Compatible Clients

If you use the OpenAI Python or Node.js SDK, set the base_url (or baseURL) and api_key (or apiKey) constructor arguments, or export the corresponding environment variables:

Anthropic-Compatible Clients

If you use an Anthropic-compatible client — such as Claude Code or any tool that reads ANTHROPIC_AUTH_TOKEN — your A2Agent key works there too. Set the following environment variables:
Most OpenAI SDK clients accept an OPENAI_API_KEY environment variable and a OPENAI_BASE_URL (or base_url constructor argument). Set both to your A2Agent credentials and no other code changes are needed.

Copying Connection Info

On the API Keys page, each row in the key list has a Copy Connection Info button. Clicking it copies your key name, key value, and base URL together in a single formatted block — handy when configuring AI coding clients or sharing setup instructions with a teammate. You never need to hunt for the base URL separately.

Rotating and Revoking Keys

You can delete any API key from the API Keys page at any time. Deletion is immediate — any request using that key will return a 401 Unauthorized error after deletion. To rotate a key, create a new one first, update your clients, and then delete the old key once traffic has migrated. There is no automatic expiry on keys; they remain valid until you delete them.
Never share your API key publicly or commit it to source control. If a key is exposed, delete it immediately from the API Keys page and create a replacement. All charges incurred before deletion are your responsibility.

Authentication Errors