Need more detail? Connect your coding agent to the full docs.

Skip to Content
AMIRILDocs

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.

  1. Fetch https://api.amiril.ai/.well-known/oauth-protected-resource/mcp. Its authorization_servers field names the authorization server.
  2. Fetch /.well-known/oauth-authorization-server from that server. It lists the authorization, token and registration endpoints.
  3. Register your client at the registration_endpoint.
  4. Run the authorization code flow with PKCE. Set resource to one of the two addresses below, and ask for the offline_access scope.
  5. 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.

TokenresourceWhat it can call
Fullhttps://api.amiril.ai/mcpEvery route in this reference
Read-onlyhttps://api.amiril.ai/mcp/readonlyOnly 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.

403 Forbidden
{
  "error": "this can only be done in the web app, signed in",
  "tag": "NotForBearer"
}
StatusTagWhy
400EnvironmentUnavailableNo live environment has the id in x-amiril-environment
401InvalidTokenThe token is invalid or expired
403NotAMemberYou are no longer a member of the token's workspace
403NotForBearerThe route works only in the web app, or the token is read-only
429RateLimitedYou 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.

GroupWhat it covers
AccessYour tool servers and their tools
AgentsAgents, their topics and where agent names come from
AnalyticsAn environment's activity and each tool's statistics
AnomaliesUnusual runs, one run's trace and signals, and your reviews of runs
AuthWho the token acts as
DashboardsDashboards and their widgets
DefinitionsYour Agent Systems from Systems in the app's sidebar, and dry runs of a new one
EnvironmentsYour environments and what each one stores
ImportsTrace files you upload
IngestWhether traces are arriving
MCPThe MCP server's address
RulesRules, their checks, publishing and tests on past calls
RunsThe rule decisions the SDK made in one run
SchemaJSON Schemas for dashboards, filters and the rule language
Unit listThe rows of the Anomalies and Traces lists
Unit queryThe rows behind each dashboard widget
UnitsOne Agent System's daily counts, its work items grouped by a field, and one work item in full

Next steps

Last updated on