API
Overview
Authentication, error format and HTTP conventions for the OpenPerf API.
The OpenPerf HTTP API powers the dashboard, the openperf CLI and CI automation. Every endpoint below is generated directly from the API's OpenAPI specification.
Authentication
Endpoints declare their accepted authentication schemes on each page:
- API token (
bearer): Create a token under Settings → API, as described in API tokens. Send it in theAuthorizationheader:
curl https://api.example.com/api/v1/projects \
-H "Authorization: Bearer $OPENPERF_AUTH_TOKEN"Replace api.example.com with the host of your OpenPerf API. A token works for one organization, so requests never name it. Endpoints that change data require a write-scoped token; a read-only token receives 403.
- Session cookie (
cookie): Dashboard endpoints authenticate with thebetter-auth.session_tokencookie (__Secure-better-auth.session_tokenin production) and an active organization context. Calling a session-only endpoint with an API token returns403withAPI_TOKEN_NOT_ALLOWED. - Public: Health endpoints (
/health/live,/health/ready) require no authentication.
Errors
A failed request returns a JSON body with a stable code, a message for people, details, which is always null, and the requestId of the request:
{
"code": "API_TOKEN_INVALID",
"message": "…",
"details": null,
"requestId": "…"
}| Status | Meaning |
|---|---|
400 | The request body or a parameter is not valid. The code is VALIDATION_ERROR. |
401 | The session or token is missing, mistyped, revoked or expired. |
403 | The caller may not access this endpoint or may not change data. |
404 | The requested resource does not exist in this organization. |
409 | The resource already exists or conflicts with the current state. |
429 | Too many requests. Wait before you retry. |