Skip to content

REST API Overview

The DiscoTrace REST API exposes workspace-scoped JSON endpoints under https://app.discotrace.com/api/v1 backed by an auto-synced OpenAPI 3.1 specification.

  • Base URL: https://app.discotrace.com/api/v1
  • Live OpenAPI 3.1 JSON: https://app.discotrace.com/api/v1/openapi.json (mirrored at /docs/openapi.json)
  • Endpoint-by-endpoint reference: Browse the auto-generated REST API Reference section in the left sidebar.

Pass your workspace API key (dt_live_... or dt_test_...) in the Authorization header (or X-API-Key):

Terminal window
curl -sS -H "Authorization: Bearer $DISCOTRACE_API_KEY" \
https://app.discotrace.com/api/v1/studies

Each key carries explicit scopes checked on every route:

Scope Allowed Operations
read GET /me, GET /credits, POST /credits/estimate, GET /studies, GET /studies/{slug}, GET /studies/{slug}/runs, GET /studies/{slug}/traces, GET /studies/{slug}/reservations, GET /studies/{slug}/opportunities, GET /studies/{slug}/drafts, GET /jobs, GET /jobs/{id}
write POST /studies, POST /studies/{slug}/drafts, PATCH /studies/{slug}/drafts/{id}
run POST /jobs, and POST /studies when queue_run: true

API keys are strictly blocked from team membership, share links, billing, and key-creation endpoints (HTTP 403 forbidden_for_api_key).

State-mutating endpoints that create studies or queue runs (POST /studies and POST /jobs) accept an optional Idempotency-Key header valid for 24 hours:

Terminal window
curl -sS -X POST https://app.discotrace.com/api/v1/jobs \
-H "Authorization: Bearer $DISCOTRACE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: recheck-core-discovery-2026-11-29" \
-d '{"study_slug":"core-discovery","job_kind":"recheck_pass"}'
  • If a request with the same key already completed, the API replays the exact original status code and JSON body with header x-idempotent-replay: true.
  • If a concurrent request with the same key is still executing, the API returns HTTP 409 with code: "idempotency_in_progress" and retryable: true.

All 4xx and 5xx responses share one uniform JSON envelope including a human-actionable resolveUrl:

{
"error": {
"code": "insufficient_scope",
"message": "API key is missing required scope 'run'.",
"retryable": false,
"resolveUrl": "https://app.discotrace.com/w/acme/api"
}
}
HTTP Status Typical error.code Meaning
400 invalid_study_input, invalid_job_kind, invalid_draft_status Request payload failed validation.
401 missing_api_key, invalid_api_key Missing, revoked, or expired Bearer key.
403 insufficient_scope, forbidden_for_api_key Key lacks the required scope or called a session-only route.
404 study_not_found, draft_not_found, job_not_found Resource does not exist in the authenticated workspace.
409 study_slug_exists, idempotency_in_progress Duplicate slug or concurrent idempotency claim.

When calling POST /api/v1/jobs:

  • 201 Created means the job entered queued immediately (either dry_run: true, dt_test_ key, or quoted credits are within both auto_approve_credits and available balance).
  • 202 Accepted means the job was saved in awaiting_approval state. Present resolveUrl from the response body to a workspace owner for 1-click portal approval.