SDKs & API
Authentication
Authenticate SDK and API calls with an AI system's API key.
Every call to the AgentID API carries the API key of one AI system. Create keys on the system's Integration tab; see API keys.
Base URL
https://app.getagentid.com/api/v1The SDKs use this base URL by default. Override it with baseUrl (Node.js) or base_url (Python) only if AgentID gives you a different one.
Sending the key
Use one of these headers. If both are present, x-agentid-api-key wins.
POST /api/v1/guard HTTP/1.1
Host: app.getagentid.com
x-agentid-api-key: sk_live_...
Content-Type: application/jsonPOST /api/v1/guard HTTP/1.1
Host: app.getagentid.com
Authorization: Bearer sk_live_...
Content-Type: application/jsonThe SDKs read the key from the AGENTID_API_KEY environment variable when you do not pass it explicitly.
Key scope
- A key belongs to exactly one AI system. When a request includes
system_id, it must be that system; otherwise Guard answers401with reasonsystem_id_mismatch, and the configuration endpoint answers436. - Revoked or unknown keys get
401(unauthorized). - Keys are for server-side use. Do not ship them in browser bundles or mobile apps. For browser rollouts use enrollment tokens; for Claude, the plugin and companion activate their own device credentials.
Multiple keys in one process
To serve several AI systems from one process, pass the key per call:
await agent.guard(
{ system_id: tenantSystemId, input },
{ apiKey: tenantApiKey },
);wrapOpenAI accepts apiKey or a resolveApiKey(request) callback for the same purpose.
Correlation header
Send x-correlation-id to trace a request end to end. AgentID echoes it (or a generated value) in the response. The SDKs set it to the client_event_id when they log an event.