HTTP API
Call Amiril's HTTP API from your own code with an OAuth access token. Find the base URL, the sign-in steps for a token, the environment header and the errors.
The HTTP API reads and changes the data in your Amiril workspace. Every request goes to https://api.amiril.ai, and every path starts with /api. The pages under HTTP API in the sidebar list every route an access token can call.
Access tokens
Send an OAuth access token in the Authorization header.
GET /api/rules HTTP/1.1
Host: api.amiril.ai
Authorization: Bearer <access-token>Your code gets a token through an OAuth 2.1 sign-in. A person signs in once in the browser and picks a workspace. Any OAuth 2.1 client library with discovery and PKCE runs these steps for you.
- Fetch
https://api.amiril.ai/.well-known/oauth-protected-resource/mcp. Itsauthorization_serversfield names the authorization server. - Fetch
/.well-known/oauth-authorization-serverfrom that server. It lists the authorization, token and registration endpoints. - Register your client at the
registration_endpoint. - Run the authorization code flow with PKCE. Set
resourceto one of the two addresses below, and ask for theoffline_accessscope. - Call the API. The access token expires after five minutes, so use the refresh token to get a new one without another sign-in.
The resource you ask for decides what the token can call.
| Token | resource | What it can call |
|---|---|---|
| Full | https://api.amiril.ai/mcp | Every route in this reference |
| Read-only | https://api.amiril.ai/mcp/readonly | Only the routes that read or dry-run |
The token acts as the person who signed in, in the workspace they picked. Their role in that workspace decides what it may change. Each route says which token it needs. No token can change members, invitations, API keys or workspace settings. Manage those in the web app.
An AI assistant gets the same token when it connects to Amiril.
Tokens for a script
The HTTP API takes no API key. An API key only sends traces and lets the SDK fetch your rules. For a script that runs on its own, such as a CI job, run steps 1 to 4 once on a machine with a browser. Save the refresh token where the job can read it and write it back, such as a secret manager. A refresh can return a new refresh token, and then the old one may stop working. Save the new token after each refresh.
Environment header
The workspace comes from the token, and no header changes it. A request acts in your production environment unless you send another environment's id in x-amiril-environment. GET /api/environments lists the ids.
Errors
A refused request answers with an HTTP status and a JSON body. error says what went wrong. tag names the case, so your code can branch on it.
{
"error": "this can only be done in the web app, signed in",
"tag": "NotForBearer"
}| Status | Tag | Why |
|---|---|---|
400 | EnvironmentUnavailable | No live environment has the id in x-amiril-environment |
401 | InvalidToken | The token is invalid or expired |
403 | NotAMember | You are no longer a member of the token's workspace |
403 | NotForBearer | The route works only in the web app, or the token is read-only |
429 | RateLimited | You sent more than 300 requests a minute in one workspace. Wait for the seconds in Retry-After |
Route groups
Each group takes its name from its paths, so a few names differ from the app's. To list runs, open Unit list.
| Group | What it covers |
|---|---|
| Access | Your tool servers and their tools |
| Agents | Agents, their topics and where agent names come from |
| Analytics | An environment's activity and each tool's statistics |
| Anomalies | Unusual runs, one run's trace and signals, and your reviews of runs |
| Auth | Who the token acts as |
| Dashboards | Dashboards and their widgets |
| Definitions | Your Agent Systems from Systems in the app's sidebar, and dry runs of a new one |
| Environments | Your environments and what each one stores |
| Imports | Trace files you upload |
| Ingest | Whether traces are arriving |
| MCP | The MCP server's address |
| Rules | Rules, their checks, publishing and tests on past calls |
| Runs | The rule decisions the SDK made in one run |
| Schema | JSON Schemas for dashboards, filters and the rule language |
| Unit list | The rows of the Anomalies and Traces lists |
| Unit query | The rows behind each dashboard widget |
| Units | One Agent System's daily counts, its work items grouped by a field, and one work item in full |
Next steps
SDK configuration
Every option of the Amiril SDK's init and every environment variable it reads, in Python and TypeScript, with its type, its default and what it does.
Set up environments and API keys
Create an environment such as Staging and an API key that sends to it, so test runs stay out of production. Then put the key where each service runs.
Connect an AI assistant to Amiril
Add Amiril's MCP server to Claude Code, the Claude app, Cursor, VS Code or ChatGPT. Sign in with your Amiril account, then ask about your agents.
Last updated on