Create an API key
An Owner creates API keys on the API keys tab in Settings. Copy the key when it’s created, because it’s shown only once. See API keys for what a key can access and how to revoke one.Authenticate
Send the key on every request in theAuthorization header:
/api/v1 on the same host you use to sign in to Arklex Platform.
To try requests in the app, open API Reference, paste your key into Authentication, and click Test Request on any endpoint. These requests are real, so anything you create appears in the platform.
What you can do
Building scenarios with the assistant isn’t available through the API.
A typical flow
POST /connectionsregisters the agent to test.GET /scenario-groups/{id}/scenariosfinds the scenarios to run.POST /simulationsruns them against the connection. PollGET /simulations/{id}untilstatusissuccess,error, orcancelled.POST /evaluationsscores the run with metrics fromGET /metrics. PollGET /evaluations/{id}for the results.
- Inline scenarios: define scenarios in the
POST /simulationsrequest instead of creating them first. They’re saved into the group you name, and sending the same definitions again reuses them. - Inline transcripts: send conversations you already have to
POST /evaluationsand score them without running a simulation.
Example: start a simulation
This request runs one saved scenario against a connected agent. Replace the host with the one you sign in to, and the IDs with your own.id and status. Poll GET /api/v1/simulations/{id} until the run finishes.
Statuses
Simulations and evaluations share one set of statuses. The API names differ from the app:
New statuses may be added, so treat unknown values as not final.
Conventions
- Errors: every error returns
{"error": {"code": ..., "message": ...}}. Branch onerror.code, not on the HTTP status. - Pagination: lists return
{"data": [...], "pagination": {"total", "page", "page_size"}}. - Timestamps: RFC 3339, in UTC.
- Nulls:
nullmeans the field wasn’t computed, which is different from zero. - Compatibility: within v1, fields, values, and endpoints may be added but aren’t removed or renamed. Ignore fields you don’t recognize.
Retries and idempotency
Send anIdempotency-Key header on create requests so that a retry can’t run twice. Generate one unique value, such as a UUID, per request, and send the same value on every retry.
- Same key and body: you get the original response, with
Idempotent-Replay: true. - Same key while the first attempt is still running:
409 IDEMPOTENCY_IN_PROGRESS. - Same key with a different body:
422 IDEMPOTENCY_KEY_REUSED.
400, 402, or 429 didn’t run, so you can retry it with the same key. Keys expire 24 hours after the first attempt completes.
Rate and concurrency limits
Two different limits return429. Handle them differently:
402 QUOTA_EXCEEDED means your plan’s token allowance is used up. It’s cloud only. See Billing.