Skip to main content
The REST API runs Pecta quality gates server-side and returns a gate verdict in a single HTTP response. This is the right integration mode when you cannot run Node.js in-process — for example, in Python or Go services, batch pipelines, or automated testing. Gate latency is 50–100 ms end-to-end because the evaluation happens on Pecta’s infrastructure rather than inside your process. All /v1/* endpoints require an Authorization: Bearer <key> header. Use your publishable key (pk_live_...) for evaluation requests.
1

Get an API key

Sign in at pecta.ai, open Settings → API keys, and create a new key. Copy the pk_live_... value — it is only shown once.Store it in an environment variable:
2

Send your first evaluation

POST agent output to /v1/evaluate. The minimum required fields are agent_id and output. Include tool and latency_ms to enable the latency gate and to improve dashboard visibility.
3

Read the response

A successful evaluation returns HTTP 200 with the verdict, per-gate detail, total latency, and the agent’s current reputation score.
When a gate fails, passed is false and the failing gate includes a reason string:
4

Handle errors

API errors return a non-2xx status with a structured body:
Common status codes:

Request body reference

Never send sensitive user data in input or output fields beyond what gates need to evaluate. Pecta does not store these fields, but minimising what you send is good practice.