Skip to navigation

API Reference

The RubricHQ API lets you manage agents, metrics, scenarios, and runs, and ingest calls for analysis — programmatically.

Base URL: https://api.rubrichq.io/api/public/v1

All requests are authenticated with an API key: Authorization: Bearer <YOUR_API_KEY>. Create one under Settings → API Keys in the dashboard.

Each key is scoped to one workspace, so client_id is optional everywhere — omit it and the API uses your key’s workspace. Pass it only to target another workspace you can access.

Resources

  • Agents — the AI agents under test, and how RubricHQ reaches them (phone and/or web).
  • Metrics — the rubrics calls and runs are scored on: built-in ones plus your own.
  • Scenarios — scripted test conversations, and the endpoint that runs one against an agent.
  • Runs — the result of running a scenario: status, transcript, recording, metric results.
  • Calls (Observability) — your real production calls, ingested as a recording and/or transcript and scored on the same metrics.

End-to-end in six requests

The steps below take you from nothing to a scored test call and a scored production call. Export your key first:

export RUBRIC_API_KEY="<your key>"
export API="https://api.rubrichq.io/api/public/v1"
1

Create an agent

name and phone_number are always required. An agent you host yourself (agent_source: internal, the default) also needs instructions, language_id and opening_message. Add a web_channel if it can be reached over the web.

curl -X POST $API/agents \
-H "Authorization: Bearer $RUBRIC_API_KEY" -H "Content-Type: application/json" \
-d '{
"name": "Support Bot",
"phone_number": "+15550001234",
"language_id": 15,
"instructions": "You are a friendly support agent for Acme.",
"opening_message": { "type": "assistant-waits-for-user" },
"web_channel": { "transport": "websocket", "websocket_url": "wss://agent.example.com/ws" }
}'

Keep the id from the response — it is your agent_id. (language_id 15 is English (US); GET /languages lists the rest.)

2

Create a metric

A metric applies to an agent only if you attach it with agent_ids, or make it workspace-wide with mark_as_global: true. A metric with neither is saved but never scored.

curl -X POST $API/metrics \
-H "Authorization: Bearer $RUBRIC_API_KEY" -H "Content-Type: application/json" \
-d '{
"name": "Refund policy mentioned",
"llm_instructions": "Did the agent state the 30-day refund policy when asked?",
"agent_ids": [42]
}'
3

Create a scenario

A scenario is the script for RubricHQ’s simulated caller. Pick a persona_id from GET /personas.

curl -X POST $API/scenarios \
-H "Authorization: Bearer $RUBRIC_API_KEY" -H "Content-Type: application/json" \
-d '{
"name": "Refund request",
"instructions": "You bought a blender 10 days ago and want your money back. Ask about the refund policy.",
"outcome": "Agent explains the 30-day refund policy and starts the refund.",
"persona_id": 17,
"agent_ids": [42]
}'
4

Run it

This places a real call to your agent. channel picks how: phone, web, or text.

curl -X POST $API/scenarios/87/run \
-H "Authorization: Bearer $RUBRIC_API_KEY" -H "Content-Type: application/json" \
-d '{ "agent_id": 42, "channel": "web" }'

The response returns a run_id straight away.

5

Poll the run

curl $API/runs/7821 -H "Authorization: Bearer $RUBRIC_API_KEY"

Poll every few seconds until status is completed or failed. Metric results keep filling in for a short while after the call ends — wait until no entry in metric_results has status: "pending".

6

Ingest a production call

Send a recording, a transcript, or both, then poll GET /calls/{id} until analysis_status is completed (or failed / skipped). You may see computed on the way — it means the audio pass is done, not that the call is finished.

curl -X POST $API/calls \
-H "Authorization: Bearer $RUBRIC_API_KEY" -H "Content-Type: application/json" \
-d '{
"call_identifier": "call-abc-123",
"agent_id": 42,
"recording_url": "https://your-storage.com/recordings/call-abc-123.wav",
"transcript": [
{ "role": "AI Assistant", "content": "Hi, this is Acme support. How can I help?" },
{ "role": "User", "content": "I would like a refund for my blender." }
]
}'

Things that apply everywhere

  • Errors come back as { "error": "…" } with a 4xx status — 401 bad or missing key, 402 out of credits, 404 not found in your workspace, 409 duplicate, 422 invalid or missing fields. Missing-field errors also list the required field names.
  • Asynchronous work (ingesting a call, running a scenario, re-running metrics) returns immediately with a pending / queued status. Poll the matching GET endpoint for the result.
  • Credits. Every metric that is scored and every call that is placed consumes credits. Pass metric_ids when ingesting a call or running a scenario to score only the metrics you need.
  • Deleting an agent or scenario archives it: it disappears from lists and lookups, but its history (calls, runs, results) is kept. Deleting a call or a custom metric is permanent.
  • Pagination. List endpoints take page and per_page (max 100) and return a meta object with total_count and total_pages.

Select a resource on the left to see its endpoints, parameters, and example requests.