Skip to main content
The Relay API is organized around REST principles. It accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes.

Base URL

All API requests should be made to:

Authentication

Authenticate requests by including your API key in the X-API-Key header:
API keys are created in the Relay dashboard under Settings > API Keys.
Keep your API key secure. Do not share it in public repositories or client-side code.

Request format

  • Content-Type: application/json for all requests with a body
  • Method: Use appropriate HTTP methods (GET, POST, PATCH, DELETE)
  • IDs: All resource IDs are UUIDs

Response format

All responses are JSON-encoded. Successful responses include the requested resource or a confirmation.

HTTP status codes

Error responses

Errors return a JSON object with a detail field:
Validation errors (422) include details about which fields failed:

Pagination

List endpoints support pagination with page and page_size parameters:
Paginated responses include:

Idempotency

POST requests that create resources are not idempotent. To avoid duplicates, track the returned id from successful requests.

Versioning

The API version is included in the URL path: /api/v1/... Breaking changes will be introduced in new versions (e.g., /api/v2/...). Existing versions remain supported.

Resource hierarchy

Common patterns

Presigned URL uploads

Audio file uploads use presigned URLs for direct-to-storage uploads:
  1. Request URL: POST to get a presigned upload URL
  2. Upload: POST the file to the presigned URL
  3. Confirm: POST to confirm the upload completed
This keeps large files off the API servers and enables faster uploads.

Async operations

Training and inference are async operations:
  1. Create: POST to create a job
  2. Poll: GET the job periodically to check status
  3. Results: Read results when status is completed

Draft and publish

Annotation sets follow a draft → publish workflow:
  1. Create set (starts as draft)
  2. Add/edit annotations
  3. Publish (locks the set)
  4. Use for training

API endpoints

Authentication

Manage API keys

Datasets

Create and manage datasets

Audio Files

Upload and manage audio

Annotations

Label audio artifacts

Training

Train detection models

Inference

Detect artifacts in audio