Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.agentmark.co/llms.txt

Use this file to discover all available pages before exploring further.

All API endpoints (except health checks and capabilities) require two headers:
HeaderDescription
AuthorizationYour API key — Bearer sk_agentmark_...
X-Agentmark-App-IdYour application ID — app_...
The gateway also accepts the legacy X-Puzzlet-App-Id header (per verify-api-key.ts:12), but new integrations should use X-Agentmark-App-Id.

Creating an API key

  1. Open the AgentMark Dashboard
  2. Switch to the app you want to scope the key to (shown in the breadcrumb)
  3. Navigate to the app’s Settings → API keys page (app-level, not org-level)
  4. Click Create API key
  5. Select a role (SDK, Read-Only, or Full Access) or choose Custom to toggle individual permissions
  6. Copy the key — it is only shown once
API keys enforce per-endpoint permissions. A key with SDK access can ingest traces and read templates but cannot delete anything. See Users and access control for the permission catalog and role presets.

Endpoint permissions

Every API endpoint requires a specific permission. If your API key lacks the required permission, the request returns 403 Forbidden.

Traces and spans

EndpointPermission
POST /v1/tracestrace.write
GET /v1/tracestrace.read
GET /v1/traces/{traceId}trace.read
GET /v1/traces/{traceId}/graphtrace.read
GET /v1/traces/{traceId}/spansspan.read
GET /v1/traces/{traceId}/spans/{spanId}span.read
GET /v1/spansspan.read

Sessions

EndpointPermission
GET /v1/sessionssession.read
GET /v1/sessions/{sessionId}/tracessession.read

Scores

EndpointPermission
POST /v1/scoresscore.write
POST /v1/scores/batchscore.write
GET /v1/scoresscore.read
GET /v1/scores/{scoreId}score.read
GET /v1/scores/aggregationsscore.read
GET /v1/scores/namesscore.read
DELETE /v1/scores/{scoreId}score.delete

Metrics, datasets, experiments, prompts

EndpointPermission
GET /v1/metricstrace.read
GET /v1/configtemplate.read
GET /v1/datasetsdataset.read
POST /v1/datasets/{datasetName}/rowsdataset.write
POST /v1/datasets/{datasetName}/rows/from-tracesdataset.write
POST /v1/datasets/{datasetName}/rows/from-spansdataset.write
GET /v1/experimentsexperiment.read
GET /v1/experiments/{experimentId}experiment.read
GET /v1/promptstemplate.read
GET /v1/runs/{runId}/tracestrace.read
GET /v1/templates/{templatePath}template.read

Annotation queues

EndpointPermission
GET /v1/annotation-queuesannotation_queue.read
POST /v1/annotation-queuesannotation_queue.write
GET /v1/annotation-queues/{queueId}annotation_queue.read
PATCH /v1/annotation-queues/{queueId}annotation_queue.write
DELETE /v1/annotation-queues/{queueId}annotation_queue.delete
GET /v1/annotation-queues/{queueId}/itemsannotation_queue.read
POST /v1/annotation-queues/{queueId}/itemsannotation_queue.write
GET /v1/annotation-queues/{queueId}/items/{itemId}annotation_queue.read
PATCH /v1/annotation-queues/{queueId}/items/{itemId}annotation_queue.write
DELETE /v1/annotation-queues/{queueId}/items/{itemId}annotation_queue.delete
POST /v1/annotation-queues/{queueId}/items/{itemId}/reviewsannotation_queue.review

Unauthenticated

EndpointNotes
GET /v1/capabilitiesNo auth required
GET /healthNo auth required
GET /v1/health/ingestionNo auth required
GET /v1/health/filesNo auth required

Making requests

curl https://api.agentmark.co/v1/traces \
  -H "Authorization: Bearer sk_agentmark_your_key_here" \
  -H "X-Agentmark-App-Id: app_your_app_id_here"

Rate limiting

API requests are rate-limited per tenant. Limits vary by plan — see Billing and usage. When you exceed your rate limit, the API returns 429 Too Many Requests with a Retry-After header indicating how long to wait before retrying.

Span and storage limits

Trace ingestion (POST /v1/traces) enforces monthly quotas depending on your plan:
  • Span limit — maximum number of spans per month (Hobby/Growth tiers)
  • Storage cap — maximum storage used (certain plans only)
When exceeded, the API returns 429 with a span_limit_exceeded or storage_cap_exceeded error code and a Retry-After header. Upgrade your plan at Settings → Billing.

Error responses

Error bodies follow this shape:
{
  "error": {
    "message": "Not authorized"
  }
}
Some errors include a machine-readable code and additional details:
{
  "error": {
    "code": "span_limit_exceeded",
    "message": "Monthly unit limit exceeded. Upgrade your plan for unlimited units.",
    "details": {
      "currentCount": 20000,
      "limit": 20000,
      "upgradeUrl": "https://app.agentmark.co/settings/billing"
    }
  }
}
StatusMeaning
400Invalid request — check the details array for field-level errors
401Missing or invalid Authorization / X-Agentmark-App-Id header
403API key is valid but does not have the required permission for this endpoint
429Rate limited or plan quota exceeded
503Service temporarily overloaded — retry after the interval in the Retry-After header