Monitors API Endpoints
Monitors (workloads), ingest, and comparison Run endpoints.
Base URL: https://app.peerlm.com/api/v1. In API field names, workload means Monitor and audit means comparison Run.
List and create Monitors
GET /workloads
Returns active Monitors with the exact production model, candidate policy, resolved candidates, tags, and timestamps.
POST /workloads
curl -X POST https://app.peerlm.com/api/v1/workloads -H "X-API-Key: <YOUR_PEERLM_API_KEY>" -H "Content-Type: application/json" -d '{
"name": "Support assistant",
"current_model_id": "catalog-model-uuid",
"candidate_policy": {
"mode": "rolling",
"categories": ["cost_efficient", "frontier"],
"maxCandidates": 5
}
}'name is required. A Run also requires an exact current_model_id; current_model is only a preserved display string. Creation uses the same organization Monitor capacity lock as the dashboard. The legacy candidate_model_ids field creates a manual policy.
Ingest production traffic
POST /ingest
curl -X POST "https://app.peerlm.com/api/v1/ingest?monitorId=MONITOR_UUID" -H "X-API-Key: <YOUR_PEERLM_API_KEY>" -H "Content-Type: application/json" -d '{
"records": [{
"prompt": "Summarize this ticket",
"systemPrompt": "You are a support assistant.",
"response": "Captured production answer",
"model": "provider/model-version",
"tokensIn": 24,
"tokensOut": 63,
"latencyMs": 410,
"metadata": {
"traceId": "trace-123",
"spanId": "span-456"
}
}]
}'Supply monitorId or workloadId in the body, or monitorId in the query. A batch can contain at most 500 records. sampleRate defaults to 1. If no Monitor ID is supplied, the endpoint attempts to create one under the organization capacity limit.
Every usable record needs a prompt. The production response, exact model, system prompt, token counts, latency, trace identity, and structural metadata strengthen observed control, economics, latency, replayability, and writeback respectively. PeerLM redacts content unless redactClientSide says it has already been redacted.
POST /otel
Accepts OTLP/HTTP traces in JSON or protobuf. Authenticate with the same API key and set peerlm.monitor_id per resource. The receiver resolves the destination per resource, so a collector batch can safely contain several services.
List and start comparison Runs
GET /audits
Optional query parameters: workload_id, status, and limit (default 50, maximum 100).
POST /audits
curl -X POST https://app.peerlm.com/api/v1/audits -H "X-API-Key: <YOUR_PEERLM_API_KEY>" -H "Content-Type: application/json" -d '{
"workload_id": "monitor-uuid",
"candidate_model_ids": ["candidate-uuid"],
"sample_size": 150,
"control_mode": "observed",
"judges": { "mode": "auto", "count": 5 }
}'A ready corpus, exact production model, at least one candidate, and read-write scope are required. sample_size defaults to 150 and must satisfy the minimum useful sample and every critical-category requirement. control_mode is observed or replayed. Judge count is clamped to a safety maximum of 7; manual judge IDs are Enterprise-only.
Optional criteria influence the pairwise prompt. Optional validators accept only normalized exact text, RFC 6901 JSON paths, JSON Schema, or safe regex. The Monitor's decision contract and judge pool are frozen onto the Run; request fields cannot bypass them.
GET /audits/:auditId
Returns execution status, progress, frozen candidates, results summary, methodology, customer-safe failure text, recommendations, Monitor, and corpus. The recommendation kind is a sibling of resultsSummary inside the recommendations array.
Prompt CI
POST /deploys
Available on every paid plan. Prompt CI holds the production model constant and generates both the old and new prompt variants at Run time. It never treats the previously captured response as the control.
curl -X POST https://app.peerlm.com/api/v1/deploys -H "X-API-Key: <YOUR_PEERLM_API_KEY>" -H "Content-Type: application/json" -d '{
"workload_id": "monitor-uuid",
"system_prompt": "New production prompt",
"previous_system_prompt": "Current production prompt",
"commit_ref": "a1b2c3d",
"sample_size": 150
}'Provide system_prompt or system_prompt_id. The previous prompt can be supplied inline or resolved from the corpus's dominant system prompt. Deploy Runs bypass daily debounce and always count against the organization-pooled allowance.
status separately from evidence outcome. Advisory policy fails measured regression and execution errors; blocking policy also fails mixed, inconclusive, timed-out, submitted, and other no-evidence results.The GitHub Action wraps this endpoint and fails the job on a quality regression.
Usage
GET /usage
Returns plan, active Monitor limit, organization-pooled Run usage and reset time, per-Monitor automation caps, and recent usage. Legacy overage and Suite fields may appear for compatibility. inferenceIncluded is true for the customer-facing plan model.