API
API introduction
Base URL, auth, scopes, errors, OpenAPI, and pagination.
Audryo’s HTTP API is the same contract the product UI and coding agents use. If a guide and the OpenAPI document disagree, OpenAPI wins.
These docs show curl and JavaScript (`fetch`) in tabs. Generate clients for other languages from GET /v1/openapi (also docs/openapi.yml in-repo).
Base URL
{origin}/v1Local default: http://localhost:3100/v1. Set AUDRYO_API_BASE once and reuse it in every example.
Authentication
Authorization: Bearer sf_live_...Create tokens in Settings → Agent access. Scopes:
| Scope | Use when |
|---|---|
read | Inspect contexts, lists, reports |
write | Sync data, draft audiences / Journeys / emails |
deliver | Consent, suppressions, activate, campaign/transactional send |
Tokens are workspace-bound and never inherit another workspace. Prefer the narrowest scope that completes the job.
Discovery endpoints
| Endpoint | Auth | Purpose |
|---|---|---|
GET /v1/agent_manifest | none | Operating model, autonomy, propose vs deliver |
GET /v1/openapi | none | Full OpenAPI document |
GET /v1/bootstrap | Bearer | Workspaces, projects, session bootstrap |
GET /v1/email_icons | none | Icon libraries the editor and renderer share |
Human-readable index: `/llms.txt`.
Resource guides
| Resource | Guide |
|---|---|
| People | Contacts API |
| Activity | Events API |
| Segments | Audiences API |
| Automations | Journeys API |
| Documents | Emails API |
| One-shot sends | Campaigns API |
| One-to-one sends | Transactional email |
Project setup path
Treat setup context as authoritative for first-run progress:
Foundation → Data → Audience → Opportunity → Journey → Message → Sending → Launch
Do not infer readiness from “a Journey exists.” Read delivery context before activation.
Idempotency
Send Idempotency-Key on LLM proposals, test sends, enrollments, campaign send, and transactional send. Keys are cached per (project, operation, key) for 24 hours.
| Behavior | Meaning |
|---|---|
| First success | Response cached |
| Same key, done | Cached response + Idempotent-Replayed: true |
| Same key, in flight | 409 + Retry-After: 2 |
| Random keys each try | Defeats idempotency — derive from your business ids |
Details: Best practices.
Pagination
Most collections use a cursor envelope:
{
"data": [],
"page": { "nextCursor": "...", "hasMore": true, "total": 4213 }
}Pass page[after]=<nextCursor> until hasMore is false. Some list endpoints use an X-Next-Cursor response header instead — follow the OpenAPI entry for that route. Cursors are opaque; don’t parse or invent them.
Errors
Stable envelope on every failure:
{
"error": {
"code": "validation_failed",
"message": "Human-readable explanation",
"requestId": "uuid",
"details": {}
}
}Also echoed as X-Request-Id. Switch on code. Include requestId when you contact support or file an issue.
Common flows
| Goal | Start here |
|---|---|
| First project | Quickstart |
| ESP + DNS | Connect your ESP |
| Sync people | Contacts & events |
| Segment | Audiences |
| Automate | Journeys |
| One-shot send | Campaigns |
| Product-triggered send | Transactional email |
| Realtime sync / events out | Webhooks |
| Agent loop | Agent quickstart |
Related
- API resource guides
- Agent API reference — full operating contract
- Best practices
- OpenAPI:
docs/openapi.yml/GET /v1/openapi