Skip to main content
Every request to the A2Agent API must include your API key as a Bearer token in the Authorization header. Requests that omit the header or supply an invalid key are rejected before they reach any model. You can create and manage your keys from the A2Agent dashboard.

Header Format

Include the following header with every API request:
Replace YOUR_A2AGENT_KEY with the key you copied from your dashboard. Keys are sensitive — treat them like passwords.

OpenAI SDK

Pass your key to the api_key argument when instantiating the client. The SDK attaches the Authorization header automatically on every request.
OpenAI SDK — pass key and base URL
Alternatively, export OPENAI_API_KEY=YOUR_A2AGENT_KEY in your shell and omit the api_key argument — the SDK will pick it up from the environment.

Anthropic SDK

The Anthropic SDK reads authentication credentials from two environment variables. Set both before initialising the client:
Anthropic SDK — set auth environment variables

curl

You can authenticate raw HTTP requests by adding the Authorization header directly to your curl command:
curl — Bearer token in Authorization header

Error Responses

If authentication or authorisation fails, the API returns one of the following HTTP status codes:
Never expose your API key in client-side JavaScript, mobile app bundles, or public version-control repositories. If a key is accidentally leaked, revoke it immediately from your dashboard and issue a new one.
To create your first key, sign in to your A2Agent account and navigate to API Keys.