Skip to main content
The Egma REST API gives you programmatic access to everything the platform manages — agents, tests, runs, graders, traces, and more. Every operation available in the Egma web interface is backed by this API, so you can integrate Egma into CI pipelines, build custom dashboards, or automate any part of your simulation workflow.

Base URL

The API runs on port 3100 by default (controlled by the PORT environment variable). Point all requests at your Egma instance:
For a local Docker Compose installation, that is http://localhost:3100. The web interface runs separately on port 3101; use port 3100 for all API calls.
If you deploy Egma behind a reverse proxy, the API and web interface share a single origin. Use the origin your proxy exposes rather than a port-suffixed address in that case.

Authentication

Every request must carry an API key in the Authorization header:
The key encodes your tenancy — organization and project scope — so you never include an organization ID or project ID in the URL path. Egma resolves both from the credential itself. See Authentication for how to create and manage keys.

Request and Response Format

All request bodies and all responses are JSON. Set Content-Type: application/json on every request that sends a body. Here is a minimal example — fetching your API keys with curl:

Pagination

All paginated list endpoints return a top-level items array and a next_cursor field. The cursor is the ID of the last item in the page:
When next_cursor is null, you have reached the last page. To fetch the next page, pass the cursor as a query parameter:
Always check next_cursor rather than comparing the length of items to a page size — the last page may be a full page, and the cursor is the only reliable end-of-results signal.

Errors

All error responses follow a consistent shape:
The error field is a stable snake_case code your code can branch on. The message field is a plain-English sentence meant for developers — it may improve across releases, so do not match against it programmatically.

HTTP Status Codes

Rate Limiting

Egma applies a fixed-window rate limit of 600 requests per minute per organization by default (configurable via EGMA_RATE_LIMIT_PER_MINUTE). The limit is keyed on your organization, not on the individual key — rotating a key does not reset your budget. When you exceed the limit, the API returns 429 with a Retry-After header indicating how many seconds remain until the window resets:

OTLP Trace Ingest

Egma accepts OpenTelemetry traces at the standard OTLP/HTTP endpoint:
This is how you connect a live voice agent to Egma — configure your OpenTelemetry exporter to target your Egma instance and Egma picks up the spans automatically, with no custom integration code required.

Protobuf encoding

Send Content-Type: application/x-protobuf for the standard binary format used by most OpenTelemetry SDKs.

JSON encoding

Send Content-Type: application/json for the OTLP JSON format, useful for debugging with curl.
Compression: gzip is supported. Set Content-Encoding: gzip when sending a compressed body. The maximum body size is 20 MiB (matching the OpenTelemetry Collector default). Authentication: pass your project-scoped API key in the Authorization: Bearer egma_sk_... header, exactly as with every other API request. Trace ingest requires a project-scoped key — an org-wide key without a project association cannot file spans. The response follows the OTLP ExportTraceServiceResponse schema, including a partialSuccess field when some spans were rejected. Your exporter reads this natively.

Health Check

Returns the reachability status of both Egma’s databases. Useful for container health checks and load balancer probes.
Returns 200 when healthy, 503 when either store is unreachable. The status field is either "ok" or "unavailable". This endpoint does not require authentication.