REST API
REST API reference for the routes that an API key can reach.
Reference for the Risicare REST API.
What an API key can do over HTTP in this release
An API key can send spans to the ingest host (POST /v1/spans,
/v1/spans/batch, and OTLP over HTTP at /v1/traces or /v1/otlp/v1/traces). On the API host it can read and create datasets and add cases. It can create and
read evaluations and copy the cases of a run into a dataset. It can read active
fixes, resolve a prompt and record a score. What a key may do inside a route depends on its class
and scopes. These are the routes that the docs cover for an API key. For the
rest, use the dashboard. The MCP server on the dashboard
host reads more with an API key: traces, sessions, agents, cost, runs, datasets
and alert rules.
Base URLs
| API | Base URL | With an API key in this release |
|---|---|---|
| Gateway API (ingest host) | https://ingest.risicare.ai/v1 | Available. SDK span ingestion (you rarely call this directly) — see Gateway Endpoints |
| API host | https://api.risicare.ai/v1 | Available for these routes only: Datasets, Evaluations, Fixes (GET /v1/fixes/active), Prompts (GET /v1/prompts/resolve) and Scores |
| MCP server (dashboard host) | https://app.risicare.ai/api/mcp | Available. Read-only tools for a coding agent — see MCP Server |
| Other areas (projects, team, alerts, webhooks and so on) | — | Not available. Use the dashboard. The MCP server reads alert rules |
https://app.risicare.ai is the dashboard. It accepts a browser sign-in, with one exception: the MCP server at /api/mcp takes an API key. A request with an API key to https://app.risicare.ai/api/v1/... gets 401 (UNAUTHORIZED, "Authentication required").
The sections below are named after the areas of the product. Each section says what you can do with an API key.
Authentication
Send the API key in the Authorization header:
# Canonical (used by the SDKs)
curl -H "Authorization: Bearer rsk-..."On its HTTP routes, the ingest gateway reads only the Authorization header. A request to a
Gateway endpoint that carries the key only in X-API-Key gets
401 (Missing Authorization header). The value must use the Bearer scheme.
The scores route also accepts the key in X-API-Key:
# Alternative on the scores route (for legacy / non-RFC-7235 clients)
curl -H "X-API-Key: rsk-..."Header precedence on the scores route: Authorization is consulted first. If an Authorization header is present at all, X-API-Key is ignored — even when the Authorization value is malformed (missing the Bearer prefix). A malformed Authorization header therefore returns 401 even if a valid X-API-Key is also present. Send only one of the two headers; for new integrations prefer Authorization: Bearer rsk-....
A key's scopes come from its class and from the role of the person who created it — see Key Classes and Scopes.
Key management is dashboard-only
No route creates, lists or revokes API keys for a request that carries an API key. Use Settings → API Keys in the dashboard. See API Keys below.
Traces
The REST API has no trace route for an API key. Read traces in the dashboard: the Traces page lists them and filters them, and a trace page shows the span tree. You can export the list as CSV or JSON (at most 100 traces). The MCP server lists, filters and reads traces with a Secret key.
No route deletes a trace. Deleting a trace is done by the Risicare team on request during the beta — see Data Management.
Sessions
The REST API has no session route for an API key. Read sessions on the Sessions page of the dashboard. The MCP server reads sessions with a Secret key.
No route deletes a session. Deleting a session is done by the Risicare team on request during the beta — see Data Management.
Agents
The REST API has no agent route for an API key. Read agents on the Agents page of the dashboard. The MCP server reads agents with a Secret key.
Diagnoses
Held for the beta. See Diagnose.
Fixes
Held for the beta. See Heal.
The SDK fix runtime reads GET /v1/fixes/active on the API host. An API key can reach this route. The fix runtime is off by default. During the beta the Risicare service gives no fixes to customer projects, so the runtime has no fix to load. See Fix Runtime.
Deployments
Held for the beta. See Deploy.
Projects
Not available with an API key in this release. In the dashboard, the General tab of Settings holds the project name, the Content capture switch, the Behaviour monitoring sensitivity and the Training use switch — see Projects.
API Keys
No route manages API keys for a request that carries an API key. Create, list and revoke keys in the dashboard under Settings → API Keys. Owners and admins can create and revoke keys.
Evaluations
Runs are in the dashboard on the Runs tab of Releases — see Evaluations. An API key can reach these routes on the API host. The evals helper (evals.run in Python, runDataset in npm), the pytest plugin and the command risicare eval gate call them (Python 0.11.0 and npm 0.14.0 and later):
| Route | Use |
|---|---|
POST /v1/evaluations | Create a run |
GET /v1/evaluations/{evaluation_id} | Read a run |
PATCH /v1/evaluations/{evaluation_id} | Close a run |
GET /v1/evaluations/{evaluation_id}/inputs | Read the inputs of a run |
POST /v1/evaluations/{evaluation_id}/results | Post the results of a run. The helper posts them in batches of 50 |
GET /v1/evaluations/{evaluation_id}/verdict | Read the verdict of a run |
An API key can also reach these routes of a run. The SDK does not call them:
| Route | Use |
|---|---|
GET /v1/evaluations/{evaluation_id}/cases | Read the cases of a run, one row per case |
GET /v1/evaluations/{evaluation_id}/results | Read the trial results of a run |
POST /v1/evaluations/{evaluation_id}/cases/copy | Copy cases of a run into a dataset. It needs the scopes evaluations:read, datasets:read and datasets:write |
A secret key has the scopes evaluations:read and evaluations:write. An ingest key does not. This page does not list the request and response bodies of these routes. The SDK helpers send the routes of the first table. The REST API gives an API key no route that lists or deletes runs: use the Runs page. The MCP server lists runs with a secret key.
Datasets
An API key can read datasets on the API host: GET /v1/datasets lists them, and GET /v1/datasets/{dataset_id}/export exports one (the Python pytest plugin uses it). A secret key can also write datasets: POST /v1/datasets creates a dataset, POST /v1/datasets/{dataset_id}/items adds one case to a dataset, and POST /v1/datasets/{dataset_id}/imports imports cases from a file. On the API host, only POST is available on the import path. See Call the api for the body and Rate Limits for the limit of the import route. A secret key has the scopes datasets:read and datasets:write; an ingest key has neither. A holdout share above 0 needs a key made by an owner or an admin. Changing and deleting a dataset or a case is not available with an API key in this release. Use the Datasets page of the dashboard.
Prompts
GET /v1/prompts/resolve on the API host returns a prompt by name, for a label or a version. The SDK call get_prompt (npm: getPrompt) sends it. The key needs the scope prompts:read, which an ingest key and a secret key have. The route supports If-None-Match: the API answers 304 when the label did not move. Other prompt routes, for example the export of prompts, are not available with an API key in this release. Use the Prompts page of the dashboard.
Alerts
The REST API has no alert route for an API key. The MCP server reads alert rules and their history with a secret key. It cannot change them. The Alerts page of the dashboard has the tabs Alert Rules and History. On the Alert Rules tab you create, edit, test and delete rules, and switch a rule on or off. A rule sends its firings to the notification channels that you choose. Add Slack and webhook channels in Settings → Notifications. See Cost Alerts for the fields of a rule.
Scores
Create Score
POST /v1/scores on https://api.risicare.ai records a score. An API key can call it. The SDKs' score() call sends this request. Two bodies are valid. The v2 body sends value and name; the SDKs send it (Python 0.8.0 and npm 0.11.0 and later). The v1 body sends score, a number from 0.0 to 1.0, and may leave out name. Sending both value and score is a 422.
POST https://api.risicare.ai/v1/scores
Content-Type: application/json
Authorization: Bearer rsk-...
{
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"name": "accuracy",
"value": 0.95,
"kind": "annotation",
"comment": "Response matched expected output"
}Request body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
trace_id | string | No | null | Trace to annotate: 32 lowercase hex characters. Any other value returns 422. Give trace_id, session_id or both |
span_id | string | No | null | Specific span (optional): 16 lowercase hex characters. It needs trace_id |
session_id | string | No | null | Session to annotate, 1 to 255 characters. A score can be on a session with no trace |
name | string | With value | "default" with score | Score name/label, 1 to 128 characters. A body with score and no name is stored with the name default |
value | number, string, boolean or null | v2 body | — | A finite number of any range, a string of 1 to 256 characters (a label), or a boolean. A result with judge_failed has no value |
score | number | v1 body | — | A number from 0.0 to 1.0, stored as a numeric score. Do not send it with value |
kind | string | No | "annotation", or "eval" when source is eval | annotation, eval, feedback or outcome |
source | string | No | "api" | Where the score comes from: api, sdk, ui or eval |
comment | string | No | null | Human-readable comment, at most 4,096 characters |
Optional fields for a score from a judge or from an experiment are failure_class, judge_model, judge_version, judge_prompt_hash, judge_failed, trial and experiment_id. The rules for them are in the Changelog.
Returns 201 with the created score object. Requires the member role (or higher) — a viewer-role key receives 403.
The route can also answer:
202when the monthly event quota refused the score. Nothing is written. The body hasrejected: 1,reason: "monthly_quota_exceeded",resetsAtandretryAfterSeconds, and the response has the headerX-Risicare-Quota: exceeded. Try again afterretryAfterSeconds.503with the codeFAILURE_CLASS_CHECK_UNAVAILABLEwhen the API could not check thefailure_class. Nothing is written.
A limit per client IP address applies to this route at the network edge. A request over it gets 429 without a Retry-After header and without the error object.
List Scores
Not available with an API key in this release. The dashboard shows the scores of a trace on the trace page, and the page of a score name (/scores/{name}) shows one score across traces — see Scores.
Webhooks
Not available with an API key in this release. Owners and admins manage webhooks on the Webhooks page of the dashboard: see Webhooks for the form, the 12 events and the delivery counts. Each request carries a signature: see Receive and Verify a Delivery for the headers and the receiver helpers verify_webhook_signature and verifyWebhookSignature.
Agent Topology
Not available with an API key in this release. The Topology tab of the Agents page shows the agent topology.
Data Management
No route erases data for a request that carries an API key. During the beta, erasure is handled by the Risicare team on request: this covers a data subject's data, a trace and a session. See Data Management.
Gateway Endpoints
SDK-facing endpoints for span ingestion. The base URL is https://ingest.risicare.ai. The gateway serves exactly these HTTP ingestion routes: /v1/spans, /v1/spans/batch, /v1/traces and /v1/otlp/v1/traces. It also serves OTLP over gRPC on the same host (the method opentelemetry.proto.collector.trace.v1.TraceService/Export).
On the HTTP routes the gateway reads the API key only from Authorization: Bearer rsk-... — see Authentication. Over gRPC, send the key in the authorization metadata as Bearer rsk-.... The responses, error codes and limits of these routes are under Gateway Responses.
Field names in these request bodies are camelCase. Each span needs a traceId (32 hex characters), a spanId (16 hex characters), a name and a startTime (ISO 8601). parentSpanId, kind, endTime, status, attributes and the other span fields are optional.
Spans
POST /v1/spans
Content-Type: application/json
Authorization: Bearer rsk-...
{
"spans": [
{
"traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
"spanId": "00f067aa0ba902b7",
"name": "llm.call",
"startTime": "2024-01-15T10:00:00Z",
"endTime": "2024-01-15T10:00:01Z",
"attributes": {...}
}
]
}The body is always a spans array, even for a single span. Both published SDKs send spans to this endpoint.
Sending the same span again is safe: a second send with the same content does not make a second span. Do not send a span again to correct it. For about 20 minutes after the first send, a second send with different content is refused after the gateway has answered 200. After that time, a changed span replaces the first one when the two start times are on the same calendar day in storage. When the start times are on different days, the two are stored as two spans.
Batch Spans
POST /v1/spans/batch
Content-Type: application/x-ndjson
Authorization: Bearer rsk-...
{"traceId": "4bf92f3577b34da6a3ce929d0e0e4736", "spanId": "00f067aa0ba902b7", "name": "llm.call", "startTime": "2024-01-15T10:00:00Z"}
{"traceId": "4bf92f3577b34da6a3ce929d0e0e4736", "spanId": "b7ad6b7169203331", "name": "tool.call", "startTime": "2024-01-15T10:00:01Z"}The body is newline-delimited JSON: one span object per line, with no wrapping array.
Trace Ingestion
POST /v1/traces
Content-Type: application/json
Authorization: Bearer rsk-...
{
"traces": [
{
"traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
"spans": [...]
}
]
}Each trace holds its spans and may carry a sessionId. This endpoint is also the OTLP endpoint: it accepts OTLP over HTTP as a JSON body (a top-level resourceSpans) or as a binary protobuf body — see OTLP Ingestion. Neither published SDK sends the native traces body.
OTLP Ingestion
The OTLP endpoint is POST https://ingest.risicare.ai/v1/traces. It accepts OTLP over HTTP as JSON (application/json) or as binary protobuf (application/x-protobuf or application/protobuf). Configure your OTel exporter for an HTTP protocol (e.g. OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf or http/json).
POST /v1/otlp/v1/traces accepts OTLP/JSON only, and POST /v1/spans and POST /v1/spans/batch refuse protobuf (JSON or NDJSON only). The example below uses the JSON form on /v1/otlp/v1/traces; the same JSON body also works on POST /v1/traces.
POST /v1/otlp/v1/traces
Content-Type: application/json
Authorization: Bearer rsk-...
{
"resourceSpans": [
{
"resource": {
"attributes": [
{"key": "service.name", "value": {"stringValue": "my-agent"}}
]
},
"scopeSpans": [
{
"spans": [
{
"traceId": "5b8efff798038103d269b633813fc60c",
"spanId": "eee19b7ec3c1b174",
"name": "llm.call",
"startTimeUnixNano": "1544712660000000000",
"endTimeUnixNano": "1544712661000000000"
}
]
}
]
}
]
}Gzip request bodies are supported via Content-Encoding: gzip (the decompressed payload must still be in a format that the route accepts). The double /v1/ is intentional — gateway prefix + OTLP protocol path.
Gateway Responses
POST /v1/spans and POST /v1/spans/batch answer 200 with this body:
{
"accepted": 2,
"rejected": 1,
"errors": [
{ "index": 2, "error": "<reason>" }
]
}| Field | Description |
|---|---|
accepted | Number of spans that the gateway accepted |
rejected | Number of spans that the gateway rejected |
errors | One entry for each rejected span: index and error (the reason). On /v1/spans, index is the position of the span in the spans array. On /v1/spans/batch, index can differ from the line number of the span when the request has blank lines or lines that do not parse. Absent when no span is rejected |
ignored | Present only when the request has fields that the gateway does not model. The gateway discards those fields. count is the number of distinct field paths, and fields lists up to 10 of them |
With the native traces body, POST /v1/traces answers 200 with tracesAccepted, spansAccepted and spansRejected, and with errors (traceId and spanErrors) when spans are rejected. POST /v1/otlp/v1/traces answers with an OTLP body: partialSuccess (rejectedSpans, errorMessage) reports rejected spans. POST /v1/traces answers the same way when the request has an OTLP body or a Content-Encoding.
A 200 means that the accepted spans are in the gateway's queue. It does not mean that they are stored. The gateway sends the 200 after its queue confirms the spans. If the queue does not confirm them in time, the gateway answers 503 ENQUEUE_UNCONFIRMED. Storage comes after the queue, so a 200 does not prove that a span is stored or visible in the dashboard.
A 200 can report rejected spans. A request in which the gateway rejects some spans, or all of them, still answers 200. Read rejected and errors.
A 200 can report a quota discard. When your organization has used its monthly event quota, the gateway answers 200 with reason: "monthly_quota_exceeded", resetsAt and retryAfterSeconds, and the header X-Risicare-Quota: exceeded. It queues none of the spans. An OTLP answer carries the same reason at the start of partialSuccess.errorMessage. See the Changelog entry for Python 0.6.1 and npm 0.9.1.
Both published SDKs read this body. For them, a 2xx response without accepted and rejected counts is a failure — see Production & Failure Modes.
Gateway Errors
An error response from the gateway has the body below. There are three exceptions, listed after the table.
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded",
"retry_after": 1
}
}retry_after (seconds) is present only on RATE_LIMIT_EXCEEDED, BUFFER_FULL and REDIS_MEMORY_HIGH. Those responses also carry a Retry-After header with the same value.
| Status | Code | Meaning |
|---|---|---|
400 | VALIDATION_ERROR, SERIALIZATION_ERROR, INVALID_TRACE_ID, INVALID_SPAN_ID | The request is not valid |
401 | UNAUTHORIZED | The Authorization: Bearer header is missing or malformed, or the key is not valid |
413 | PAYLOAD_TOO_LARGE | The Content-Length of the request is over the size limit |
413 | DECOMPRESSED_PAYLOAD_TOO_LARGE | On /v1/spans and /v1/spans/batch: the body is over the size limit after gzip decompression |
415 | UNSUPPORTED_CONTENT_ENCODING | On /v1/spans and /v1/spans/batch: the Content-Encoding is not gzip or identity |
429 | RATE_LIMIT_EXCEEDED | The request is over a rate limit. The response has a Retry-After header |
503 | TOO_MANY_SPANS, TOO_MANY_ATTRIBUTES | The request is over a per-request cap. The gateway accepts none of its spans |
503 | ENQUEUE_UNCONFIRMED | The gateway could not confirm that the spans are in its queue |
503 | BUFFER_FULL, REDIS_MEMORY_HIGH | The gateway is at capacity. The response has a Retry-After header |
503 | QUEUE_NEAR_CAPACITY | The ingest queue of the project is at capacity |
503 | INFLIGHT_BYTES_EXHAUSTED, QUEUE_DEPTH_UNKNOWN, ARCHIVE_DEGRADED_NO_HEADROOM, AUTH_UNAVAILABLE, STORAGE_ERROR | A part of the gateway is at capacity or temporarily unavailable |
500 | INTERNAL_ERROR | The gateway could not complete the request |
Three answers do not have this body:
- The OTLP route (
/v1/otlp/v1/traces, and/v1/traceswith an OTLP body or aContent-Encoding) answers a body that it cannot decode or parse with400or413and an OTLP body: the reason is inpartialSuccess.errorMessage. - A request body over the size limit that has no
Content-Lengthheader gets a413without theerrorobject. - A rate limit at the network edge can answer
429without theerrorobject and without aRetry-Afterheader.
Gateway Limits
| Limit | Value | Answer when a request is over the limit |
|---|---|---|
| Spans in one request | 10,000 | 503 TOO_MANY_SPANS |
| Attribute pairs in one request (the total over all its spans) | 24,000 | 503 TOO_MANY_ATTRIBUTES |
| Request body | 10 MB, before and after gzip decompression | 413 (see Gateway Errors) |
| Request rate | Limited per project and per client IP address | 429. The gateway's own limit answers RATE_LIMIT_EXCEEDED with Retry-After |
A request over the span cap or the attribute cap gets 503, not 413. The same request gets the same answer each time, so send fewer spans in each request.
The gateway accepts a gzip request body (Content-Encoding: gzip) on /v1/spans, /v1/spans/batch and /v1/otlp/v1/traces, and on /v1/traces for an OTLP body.
Health Check
GET /healthBasic health check. It answers a fixed healthy status and checks nothing. No health route needs authentication.
Readiness Check
GET /health/readyReturns 200 only when the gateway's dependencies are reachable: Redis, and ClickHouse and PostgreSQL when they are configured. Otherwise it returns 503.
Liveness Check
GET /health/liveReturns 200 if the server process is running.
Ingest Readiness Check
GET /health/ingestReturns 200 when the gateway can reach Redis, and 503 when it cannot.
Error Responses
The ingest gateway has its own error body and its own codes — see Gateway Errors.
The scores route answers an error with this body:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "...",
"details": {}
}
}| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Missing or invalid API key |
AUTHORIZATION_FAILED | 403 | The key's role is not allowed |
VALIDATION_ERROR | 422 | The request body is invalid |
INVALID_CONTENT_LENGTH | 400 | The Content-Length header is not an integer |
REQUEST_TOO_LARGE | 413 | The request body is over 10 MB |
INTERNAL_ERROR | 500 | The API could not complete the request |
FAILURE_CLASS_CHECK_UNAVAILABLE | 503 | The API could not check the failure class. Nothing was written |
A 202 from the scores route is not an error: the monthly event quota refused the score — see Create Score.
A limit at the network edge can answer 429 without this body — see Rate Limits.
A request with an API key to https://app.risicare.ai/api/v1/... gets 401 with the code UNAUTHORIZED and the message "Authentication required", whatever the route.
Rate Limits
The ingest gateway limits requests per project and per client IP address. A request over the gateway's own limit gets 429 RATE_LIMIT_EXCEEDED with a Retry-After header; a limit at the network edge can answer 429 without that header. See Gateway Limits.
The network edge also limits requests per client IP address on these routes of the API host: POST /v1/scores, the dataset and evaluation routes, GET /v1/prompts/resolve and GET /v1/fixes/active. A request over such a limit gets 429 without a Retry-After header and without the error object.
The import route, POST /v1/datasets/{dataset_id}/imports, has a lower limit of its own: 100 requests in 5 minutes for each client IP address. A dry run counts as one request. Callers that share one address share the limit.