{"openapi":"3.1.0","info":{"title":"OneSend API","version":"0.1.0","description":"The OneSend API sends email through the provider accounts connected to your workspace, such as Resend, Brevo, Amazon SES, Mailgun or SMTP. Messages are routed according to your routing policy and sent through the next provider if one fails or reaches its limit.\n\n**Authentication.** Authenticate with `Authorization: Bearer <token>`: an API key (`os_live_…`, test keys `os_test_…`) or a session token (`oes_…`) from POST /auth/login. API key permissions: Full access (`full`: sending, reading and content), Sending only (`send`, the default), Read only (`read`), Admin (`admin`: Full access plus configuration and API key management) and Conversion tracking (`os_pub_…`, only POST /t/conversion). Test keys never deliver: they can only send, render templates and read the workspace's sandboxed emails (with the `read` or `full` scope) and templates. See the bearer security scheme for details.\n\n**Base URL.** All endpoints are under `/v1`. Errors return a JSON body with `error.type`, `error.code` and `error.message` (a sentence you can show to people); validation errors list each field in `error.details`.","license":{"name":"OneSend License","url":"https://onesend.email/legal/license/"}},"servers":[{"url":"https://your-server.example","description":"Your OneSend server: replace the placeholder with the address of your installation."}],"security":[{"bearer":[]}],"tags":[{"name":"Emails","description":"Send, inspect and cancel email. Each email shows the providers it was routed through."},{"name":"Sending providers","description":"Provider accounts connected to this workspace (shown as Sending providers in the dashboard). Credentials are encrypted at rest and never returned."},{"name":"Provider catalog","description":"Catalog of supported providers and the credentials each one needs."},{"name":"Routing","description":"Policies decide provider order, caps, rules and what happens when quota runs out."},{"name":"Senders & domains","description":"Add a domain once; OneSend registers it on every provider and merges the DNS."},{"name":"DNS hosts","description":"Connect the DNS host of your domains (Cloudflare, Hostinger, GoDaddy, Route 53 and more) with your own API token so OneSend can write records, or get exact instructions for any other host. Tokens are encrypted at rest and never returned."},{"name":"Templates","description":"Block-based templates with variables, conditional blocks and conditional styling."},{"name":"Gallery","description":"The hosted template gallery: browse templates and copy them into your workspace, and share your own for review. Public on the server that hosts it; other servers read it from ONESEND_GALLERY_URL and fall back to the bundled starter templates."},{"name":"Contacts","description":"Contacts and their attributes. Emails are unique per workspace (stored lowercased)."},{"name":"Lists","description":"Static lists of contacts. A contact can be in many lists."},{"name":"Segments","description":"Saved conditions over attributes, list membership, engagement and status."},{"name":"Imports","description":"CSV import: upload, map columns, start, then poll for the result."},{"name":"Campaigns","description":"Marketing campaigns: draft, schedule, send through your providers, and report."},{"name":"Automations","description":"Automated journeys: a trigger (list, form, attribute change, custom event, date, campaign engagement, conversion or manual) and steps (emails, waits, branches, attribute and list updates, webhooks, splits), with versions, test runs and reports per step."},{"name":"Events","description":"Custom events from your app (`POST /v1/events/track`) that start automations, reach goals and continue waiting runs."},{"name":"Forms","description":"Hosted signup forms with double opt-in, embed code and submissions."},{"name":"Archive","description":"Public archive of past campaigns: settings and per-campaign visibility."},{"name":"Statistics","description":"Delivery and engagement statistics with filters."},{"name":"Deliverability","description":"Safeguards that protect your provider accounts: automatic campaign pause on high bounce or complaint rates, a workspace guard, warm-up of new sending domains, pacing per mailbox provider, address quality checks, sunsetting of inactive contacts and best time to send."},{"name":"Conversions","description":"Credit purchases, sign-ups and other goals to the email that drove them."},{"name":"Suppressions","description":"One suppression list shared by every provider."},{"name":"Analytics","description":"Deliverability totals by provider, quota usage and the event log."},{"name":"Webhooks","description":"Outgoing events to your app, Slack or Discord."},{"name":"API keys","description":"Create and revoke API keys. The full key is returned only once."},{"name":"AI assistant","description":"Optional assistant that uses your own model provider key: summaries, reply drafts, subject lines, template generation, rewriting, triage suggestions and questions about your inbox. Off until turned on; suggestions are never applied automatically."},{"name":"Workspace","description":"Workspace name and settings, such as tracking defaults and the attribution window."},{"name":"Auth","description":"Dashboard accounts and session tokens."},{"name":"Account","description":"Your own account: profile, password, email address, two-factor authentication and sessions. Session only."},{"name":"Team","description":"Workspace members, roles (owner, admin, member, viewer) and invitations."},{"name":"Audit log","description":"Who changed members, roles, API keys, sending providers, domains and settings, and when."},{"name":"Admin","description":"Instance administration for people listed in ONESEND_ADMIN_EMAILS: status page incidents and self-checks."},{"name":"Tools","description":"Deliverability tools: DNS checker for any domain, DMARC and SPF builders, header analyzer, address checker and pre-send content check. Results are not stored."},{"name":"Compatibility","description":"Send endpoints that accept the Resend, SendGrid and Postmark payloads, for moving an app to OneSend without code changes. Outside /v1; authenticate with a OneSend API key the way that provider's SDK passes its key."},{"name":"Public endpoints","description":"Endpoints outside /v1: browser conversions, provider webhooks, inbound ingest and health. Most do not use an API key."}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"API key","description":"Send `Authorization: Bearer <token>`. The token is an API key or a session token (`oes_…`) returned by `POST /v1/auth/login` and `POST /v1/auth/signup`. The dashboard uses the `onesend_session` cookie instead; cookie requests that change data must also send `X-OneSend-Client: dashboard`.\n\nAPI key permissions (as shown on the dashboard's API keys page):\n- **Full access** (`full`): the data plane: sending, reading, and content (templates, contacts, lists, campaigns, automations, forms). Not configuration.\n- **Sending only** (`send`, the default for new keys): sending email (including inbox replies and campaign test sends) and recording conversions.\n- **Read only** (`read`): read-only endpoints.\n- **Admin** (`admin`, created through the API only): Full access plus configuration (sending providers, routing, domains, DNS hosts, webhooks, workspace settings, AI connections, mailboxes, inbound endpoints, license, team) and API key management. Only a signed-in workspace owner or admin can create one.\n- **Conversion tracking** (`os_pub_…`): accepted only by `POST /t/conversion`; safe to put in a web page.\n\nAn endpoint that needs a wider permission returns 403 `insufficient_scope`; configuration changes with a non-admin key name the `admin` scope. Owner-only actions need the owner, signed in. OAuth access tokens (`oat_…`) are for `/mcp`; sent directly they can only read and send (403 `oauth_token_not_allowed`). Live keys start with `os_live_`. Test keys (`os_test_…`) are a sandbox: email sent with them is logged as `sandboxed` and not delivered, and they can only send, render templates and read the workspace's sandboxed emails (with the `read` or `full` scope; every test key of the workspace sees them all) and templates (403 `test_key_not_allowed` elsewhere)."},"postmarkServerToken":{"type":"apiKey","in":"header","name":"X-Postmark-Server-Token","description":"Your OneSend API key (`os_live_…` or `os_test_…`) in the header the Postmark SDKs use for the server token."}},"schemas":{"ErrorBody":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string","enum":["invalid_request","unauthorized","payment_required","forbidden","not_found","conflict","rate_limited","provider_error","internal"]},"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["type","code","message"]}},"required":["error"]},"ToolFinding":{"type":"object","properties":{"level":{"type":"string","enum":["ok","info","warning","error"],"description":"ok: passed · info: worth knowing · warning: may hurt delivery · error: fails or very likely hurts delivery"},"code":{"type":"string"},"message":{"type":"string"}},"required":["level","code","message"]}},"parameters":{}},"paths":{"/t/conversion":{"post":{"operationId":"recordBrowserConversion","tags":["Public endpoints"],"security":[{"bearer":[]}],"summary":"Record a conversion from a web page","description":"Called by `/t/onesend.js` (`onesend.convert()`). Authenticate with a Conversion tracking key (`os_pub_…`) in `Authorization: Bearer`. A conversion is attributed only through the `os_ct` click token that OneSend adds to campaign links; the response is the same whether or not anything was attributed. To attribute by email address or message id, call `POST /v1/conversions` from your server with a secret key. CORS allows any origin.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","description":"The `os_ct` click token from the landing URL. `onesend.token()` returns it."},"goal":{"type":"string","example":"purchase"},"value":{"type":"number","example":49},"currency":{"type":"string","example":"USD"},"idempotencyKey":{"type":"string","description":"For example the order id. Repeated keys are recorded once.","example":"order_1042"}}}}}},"responses":{"200":{"description":"Accepted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]}}}},"400":{"description":"The body is not a JSON object or a field is not valid (`invalid_json`, `validation_failed`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"No Conversion tracking key, or an unknown or revoked one (`publishable_key_required`, `invalid_key`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many conversions from this client or for this key (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/t/onesend.js":{"get":{"operationId":"getConversionScript","tags":["Public endpoints"],"security":[],"summary":"Conversion tracking script","description":"Browser script (under 2 KB). Add `<script src=\"https://<your server>/t/onesend.js\" data-key=\"os_pub_…\" async></script>` to your pages, then call `onesend.convert({ goal, value, currency, id })`. `convert()` also accepts `key` to override `data-key`.","responses":{"200":{"description":"JavaScript","content":{"application/javascript":{"schema":{"type":"string"}}}}}}},"/hooks/{provider}/{connectionId}/{token}":{"post":{"operationId":"receiveProviderWebhook","tags":["Public endpoints"],"security":[],"summary":"Receive a provider webhook","description":"Delivery events from a sending provider. Use the `webhookUrl` returned by `GET /v1/connections/{id}`; its last segment is a secret token derived from `ONESEND_SECRET`. OneSend registers this URL with providers that support it. Without a valid token, the request is accepted only when the provider signature verifies (Resend, MailerSend, Mailgun with a signing key).","parameters":[{"schema":{"type":"string","example":"resend"},"required":true,"name":"provider","in":"path"},{"schema":{"type":"string"},"required":true,"name":"connectionId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"token","in":"path"}],"requestBody":{"description":"The provider's own webhook payload.","content":{"application/json":{"schema":{}}}},"responses":{"200":{"description":"Processed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"received":{"type":"number"},"ignored":{"type":"boolean"}},"required":["ok"]}}}},"400":{"description":"The body could not be parsed (`unparseable`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Unknown webhook URL or invalid provider signature (`invalid_hook_token`, `invalid_signature`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"Unknown connection (`connection_not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/healthz":{"get":{"operationId":"getHealth","tags":["Public endpoints"],"security":[],"summary":"Health check","description":"Returns 200 when the server can reach its database, 503 otherwise. Use it for load balancer and container health checks.","responses":{"200":{"description":"Healthy","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"version":{"type":"string"},"time":{"type":"string"}},"required":["ok","version","time"]}}}},"503":{"description":"The database is not reachable","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"error":{"type":"string","enum":["database_unavailable"]}},"required":["ok","error"]}}}}}}},"/v1/forms":{"get":{"operationId":"listForms","tags":["Forms"],"summary":"List signup forms","description":"Each form includes submission and confirmation counts and its public URLs.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["form"]},"name":{"type":"string"},"status":{"type":"string","enum":["active","disabled"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]*$","description":"Contact attribute key (`first_name`, `company`, …). `email` is always present and is not listed here."},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","number","date","boolean","category","email"],"default":"text"},"required":{"type":"boolean"},"placeholder":{"type":["string","null"],"maxLength":200},"options":{"type":["array","null"],"items":{"type":"string","maxLength":120},"maxItems":50,"description":"Choices for `category` fields."}},"required":["key","label"]}},"listIds":{"type":"array","items":{"type":"string"}},"consentText":{"type":["string","null"]},"consentVersion":{"type":"number"},"doubleOptIn":{"type":"boolean"},"successMessage":{"type":["string","null"]},"redirectUrl":{"type":["string","null"]},"fromName":{"type":["string","null"]},"fromEmail":{"type":["string","null"]},"replyTo":{"type":["string","null"]},"confirmation":{"type":["object","null"],"properties":{"subject":{"type":"string","maxLength":200},"heading":{"type":"string","maxLength":200},"body":{"type":"string","maxLength":5000,"description":"Plain text; blank lines separate paragraphs. `{{ form_name }}` and `{{ workspace_name }}` are available."},"buttonLabel":{"type":"string","maxLength":60}}},"welcomeTemplateId":{"type":["string","null"]},"style":{"type":"object","properties":{"primary":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"background":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"text":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"font":{"type":"string","maxLength":200},"logoUrl":{"type":"string","maxLength":500},"title":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":1000},"buttonLabel":{"type":"string","maxLength":60},"useBrand":{"type":"boolean","description":"Use the workspace brand (logo, colors, font) for values not set here. Default true."}}},"allowedOrigins":{"type":"array","items":{"type":"string"}},"stats":{"type":"object","properties":{"submissions":{"type":"number"},"confirmations":{"type":"number"},"pending":{"type":"number"},"confirmationRate":{"type":["number","null"]}},"required":["submissions","confirmations","pending","confirmationRate"]},"urls":{"type":"object","properties":{"hosted":{"type":"string"},"submit":{"type":"string"},"script":{"type":"string"}},"required":["hosted","submit","script"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","fields","listIds","consentText","consentVersion","doubleOptIn","successMessage","redirectUrl","fromName","fromEmail","replyTo","confirmation","welcomeTemplateId","style","allowedOrigins","stats","urls","createdAt","updatedAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createForm","tags":["Forms"],"summary":"Create a signup form","description":"Double opt-in is on unless `doubleOptIn: false`. The response includes the hosted page URL; `GET /v1/forms/{id}/embed` returns the embed code.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"status":{"type":"string","enum":["active","disabled"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]*$","description":"Contact attribute key (`first_name`, `company`, …). `email` is always present and is not listed here."},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","number","date","boolean","category","email"],"default":"text"},"required":{"type":"boolean"},"placeholder":{"type":["string","null"],"maxLength":200},"options":{"type":["array","null"],"items":{"type":"string","maxLength":120},"maxItems":50,"description":"Choices for `category` fields."}},"required":["key","label"]},"maxItems":20},"listIds":{"type":"array","items":{"type":"string"},"maxItems":20,"description":"Lists a contact is added to when they subscribe (after confirming, with double opt-in)."},"consentText":{"type":["string","null"],"maxLength":2000,"description":"Shown next to a required checkbox. Changing it starts a new consent version."},"doubleOptIn":{"type":"boolean","description":"Default true: new contacts stay `pending` until they confirm by email."},"successMessage":{"type":["string","null"],"maxLength":2000},"redirectUrl":{"type":["string","null"],"maxLength":2000,"format":"uri","description":"After a successful submit, go here instead of showing the success message (http or https)."},"fromName":{"type":["string","null"],"maxLength":120},"fromEmail":{"type":["string","null"],"format":"email","description":"Sender of the confirmation and welcome email. Defaults to no-reply@ your first verified domain."},"replyTo":{"type":["string","null"],"format":"email"},"confirmation":{"type":["object","null"],"properties":{"subject":{"type":"string","maxLength":200},"heading":{"type":"string","maxLength":200},"body":{"type":"string","maxLength":5000,"description":"Plain text; blank lines separate paragraphs. `{{ form_name }}` and `{{ workspace_name }}` are available."},"buttonLabel":{"type":"string","maxLength":60}}},"welcomeTemplateId":{"type":["string","null"],"description":"Template sent once the contact is subscribed."},"style":{"type":"object","properties":{"primary":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"background":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"text":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"font":{"type":"string","maxLength":200},"logoUrl":{"type":"string","maxLength":500},"title":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":1000},"buttonLabel":{"type":"string","maxLength":60},"useBrand":{"type":"boolean","description":"Use the workspace brand (logo, colors, font) for values not set here. Default true."}}},"allowedOrigins":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":20,"description":"Websites allowed to post this form (for example `https://www.example.com`). Empty: any site."}},"required":["name"],"additionalProperties":false,"example":{"name":"Newsletter","fields":[{"key":"first_name","label":"First name","type":"text"}],"listIds":["lst_…"],"consentText":"I agree to receive the monthly newsletter. I can unsubscribe at any time."}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["form"]},"name":{"type":"string"},"status":{"type":"string","enum":["active","disabled"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]*$","description":"Contact attribute key (`first_name`, `company`, …). `email` is always present and is not listed here."},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","number","date","boolean","category","email"],"default":"text"},"required":{"type":"boolean"},"placeholder":{"type":["string","null"],"maxLength":200},"options":{"type":["array","null"],"items":{"type":"string","maxLength":120},"maxItems":50,"description":"Choices for `category` fields."}},"required":["key","label"]}},"listIds":{"type":"array","items":{"type":"string"}},"consentText":{"type":["string","null"]},"consentVersion":{"type":"number"},"doubleOptIn":{"type":"boolean"},"successMessage":{"type":["string","null"]},"redirectUrl":{"type":["string","null"]},"fromName":{"type":["string","null"]},"fromEmail":{"type":["string","null"]},"replyTo":{"type":["string","null"]},"confirmation":{"type":["object","null"],"properties":{"subject":{"type":"string","maxLength":200},"heading":{"type":"string","maxLength":200},"body":{"type":"string","maxLength":5000,"description":"Plain text; blank lines separate paragraphs. `{{ form_name }}` and `{{ workspace_name }}` are available."},"buttonLabel":{"type":"string","maxLength":60}}},"welcomeTemplateId":{"type":["string","null"]},"style":{"type":"object","properties":{"primary":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"background":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"text":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"font":{"type":"string","maxLength":200},"logoUrl":{"type":"string","maxLength":500},"title":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":1000},"buttonLabel":{"type":"string","maxLength":60},"useBrand":{"type":"boolean","description":"Use the workspace brand (logo, colors, font) for values not set here. Default true."}}},"allowedOrigins":{"type":"array","items":{"type":"string"}},"stats":{"type":"object","properties":{"submissions":{"type":"number"},"confirmations":{"type":"number"},"pending":{"type":"number"},"confirmationRate":{"type":["number","null"]}},"required":["submissions","confirmations","pending","confirmationRate"]},"urls":{"type":"object","properties":{"hosted":{"type":"string"},"submit":{"type":"string"},"script":{"type":"string"}},"required":["hosted","submit","script"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","fields","listIds","consentText","consentVersion","doubleOptIn","successMessage","redirectUrl","fromName","fromEmail","replyTo","confirmation","welcomeTemplateId","style","allowedOrigins","stats","urls","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/forms/preview":{"post":{"operationId":"previewForms","tags":["Forms"],"summary":"Preview a form","description":"The hosted page HTML for unsaved settings (for a live preview). Nothing is stored.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"status":{"type":"string","enum":["active","disabled"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]*$","description":"Contact attribute key (`first_name`, `company`, …). `email` is always present and is not listed here."},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","number","date","boolean","category","email"],"default":"text"},"required":{"type":"boolean"},"placeholder":{"type":["string","null"],"maxLength":200},"options":{"type":["array","null"],"items":{"type":"string","maxLength":120},"maxItems":50,"description":"Choices for `category` fields."}},"required":["key","label"]},"maxItems":20},"listIds":{"type":"array","items":{"type":"string"},"maxItems":20,"description":"Lists a contact is added to when they subscribe (after confirming, with double opt-in)."},"consentText":{"type":["string","null"],"maxLength":2000,"description":"Shown next to a required checkbox. Changing it starts a new consent version."},"doubleOptIn":{"type":"boolean","description":"Default true: new contacts stay `pending` until they confirm by email."},"successMessage":{"type":["string","null"],"maxLength":2000},"redirectUrl":{"type":["string","null"],"maxLength":2000,"format":"uri","description":"After a successful submit, go here instead of showing the success message (http or https)."},"fromName":{"type":["string","null"],"maxLength":120},"fromEmail":{"type":["string","null"],"format":"email","description":"Sender of the confirmation and welcome email. Defaults to no-reply@ your first verified domain."},"replyTo":{"type":["string","null"],"format":"email"},"confirmation":{"type":["object","null"],"properties":{"subject":{"type":"string","maxLength":200},"heading":{"type":"string","maxLength":200},"body":{"type":"string","maxLength":5000,"description":"Plain text; blank lines separate paragraphs. `{{ form_name }}` and `{{ workspace_name }}` are available."},"buttonLabel":{"type":"string","maxLength":60}}},"welcomeTemplateId":{"type":["string","null"],"description":"Template sent once the contact is subscribed."},"style":{"type":"object","properties":{"primary":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"background":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"text":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"font":{"type":"string","maxLength":200},"logoUrl":{"type":"string","maxLength":500},"title":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":1000},"buttonLabel":{"type":"string","maxLength":60},"useBrand":{"type":"boolean","description":"Use the workspace brand (logo, colors, font) for values not set here. Default true."}}},"allowedOrigins":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":20,"description":"Websites allowed to post this form (for example `https://www.example.com`). Empty: any site."}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"html":{"type":"string"}},"required":["html"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/forms/{id}":{"get":{"operationId":"getForm","tags":["Forms"],"summary":"Get a signup form","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["form"]},"name":{"type":"string"},"status":{"type":"string","enum":["active","disabled"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]*$","description":"Contact attribute key (`first_name`, `company`, …). `email` is always present and is not listed here."},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","number","date","boolean","category","email"],"default":"text"},"required":{"type":"boolean"},"placeholder":{"type":["string","null"],"maxLength":200},"options":{"type":["array","null"],"items":{"type":"string","maxLength":120},"maxItems":50,"description":"Choices for `category` fields."}},"required":["key","label"]}},"listIds":{"type":"array","items":{"type":"string"}},"consentText":{"type":["string","null"]},"consentVersion":{"type":"number"},"doubleOptIn":{"type":"boolean"},"successMessage":{"type":["string","null"]},"redirectUrl":{"type":["string","null"]},"fromName":{"type":["string","null"]},"fromEmail":{"type":["string","null"]},"replyTo":{"type":["string","null"]},"confirmation":{"type":["object","null"],"properties":{"subject":{"type":"string","maxLength":200},"heading":{"type":"string","maxLength":200},"body":{"type":"string","maxLength":5000,"description":"Plain text; blank lines separate paragraphs. `{{ form_name }}` and `{{ workspace_name }}` are available."},"buttonLabel":{"type":"string","maxLength":60}}},"welcomeTemplateId":{"type":["string","null"]},"style":{"type":"object","properties":{"primary":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"background":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"text":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"font":{"type":"string","maxLength":200},"logoUrl":{"type":"string","maxLength":500},"title":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":1000},"buttonLabel":{"type":"string","maxLength":60},"useBrand":{"type":"boolean","description":"Use the workspace brand (logo, colors, font) for values not set here. Default true."}}},"allowedOrigins":{"type":"array","items":{"type":"string"}},"stats":{"type":"object","properties":{"submissions":{"type":"number"},"confirmations":{"type":"number"},"pending":{"type":"number"},"confirmationRate":{"type":["number","null"]}},"required":["submissions","confirmations","pending","confirmationRate"]},"urls":{"type":"object","properties":{"hosted":{"type":"string"},"submit":{"type":"string"},"script":{"type":"string"}},"required":["hosted","submit","script"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","fields","listIds","consentText","consentVersion","doubleOptIn","successMessage","redirectUrl","fromName","fromEmail","replyTo","confirmation","welcomeTemplateId","style","allowedOrigins","stats","urls","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateForm","tags":["Forms"],"summary":"Update a signup form","description":"Changing `consentText` increases `consentVersion`; consent proof records the version each contact agreed to.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"status":{"type":"string","enum":["active","disabled"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]*$","description":"Contact attribute key (`first_name`, `company`, …). `email` is always present and is not listed here."},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","number","date","boolean","category","email"],"default":"text"},"required":{"type":"boolean"},"placeholder":{"type":["string","null"],"maxLength":200},"options":{"type":["array","null"],"items":{"type":"string","maxLength":120},"maxItems":50,"description":"Choices for `category` fields."}},"required":["key","label"]},"maxItems":20},"listIds":{"type":"array","items":{"type":"string"},"maxItems":20,"description":"Lists a contact is added to when they subscribe (after confirming, with double opt-in)."},"consentText":{"type":["string","null"],"maxLength":2000,"description":"Shown next to a required checkbox. Changing it starts a new consent version."},"doubleOptIn":{"type":"boolean","description":"Default true: new contacts stay `pending` until they confirm by email."},"successMessage":{"type":["string","null"],"maxLength":2000},"redirectUrl":{"type":["string","null"],"maxLength":2000,"format":"uri","description":"After a successful submit, go here instead of showing the success message (http or https)."},"fromName":{"type":["string","null"],"maxLength":120},"fromEmail":{"type":["string","null"],"format":"email","description":"Sender of the confirmation and welcome email. Defaults to no-reply@ your first verified domain."},"replyTo":{"type":["string","null"],"format":"email"},"confirmation":{"type":["object","null"],"properties":{"subject":{"type":"string","maxLength":200},"heading":{"type":"string","maxLength":200},"body":{"type":"string","maxLength":5000,"description":"Plain text; blank lines separate paragraphs. `{{ form_name }}` and `{{ workspace_name }}` are available."},"buttonLabel":{"type":"string","maxLength":60}}},"welcomeTemplateId":{"type":["string","null"],"description":"Template sent once the contact is subscribed."},"style":{"type":"object","properties":{"primary":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"background":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"text":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"font":{"type":"string","maxLength":200},"logoUrl":{"type":"string","maxLength":500},"title":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":1000},"buttonLabel":{"type":"string","maxLength":60},"useBrand":{"type":"boolean","description":"Use the workspace brand (logo, colors, font) for values not set here. Default true."}}},"allowedOrigins":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":20,"description":"Websites allowed to post this form (for example `https://www.example.com`). Empty: any site."}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["form"]},"name":{"type":"string"},"status":{"type":"string","enum":["active","disabled"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]*$","description":"Contact attribute key (`first_name`, `company`, …). `email` is always present and is not listed here."},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","number","date","boolean","category","email"],"default":"text"},"required":{"type":"boolean"},"placeholder":{"type":["string","null"],"maxLength":200},"options":{"type":["array","null"],"items":{"type":"string","maxLength":120},"maxItems":50,"description":"Choices for `category` fields."}},"required":["key","label"]}},"listIds":{"type":"array","items":{"type":"string"}},"consentText":{"type":["string","null"]},"consentVersion":{"type":"number"},"doubleOptIn":{"type":"boolean"},"successMessage":{"type":["string","null"]},"redirectUrl":{"type":["string","null"]},"fromName":{"type":["string","null"]},"fromEmail":{"type":["string","null"]},"replyTo":{"type":["string","null"]},"confirmation":{"type":["object","null"],"properties":{"subject":{"type":"string","maxLength":200},"heading":{"type":"string","maxLength":200},"body":{"type":"string","maxLength":5000,"description":"Plain text; blank lines separate paragraphs. `{{ form_name }}` and `{{ workspace_name }}` are available."},"buttonLabel":{"type":"string","maxLength":60}}},"welcomeTemplateId":{"type":["string","null"]},"style":{"type":"object","properties":{"primary":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"background":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"text":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"font":{"type":"string","maxLength":200},"logoUrl":{"type":"string","maxLength":500},"title":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":1000},"buttonLabel":{"type":"string","maxLength":60},"useBrand":{"type":"boolean","description":"Use the workspace brand (logo, colors, font) for values not set here. Default true."}}},"allowedOrigins":{"type":"array","items":{"type":"string"}},"stats":{"type":"object","properties":{"submissions":{"type":"number"},"confirmations":{"type":"number"},"pending":{"type":"number"},"confirmationRate":{"type":["number","null"]}},"required":["submissions","confirmations","pending","confirmationRate"]},"urls":{"type":"object","properties":{"hosted":{"type":"string"},"submit":{"type":"string"},"script":{"type":"string"}},"required":["hosted","submit","script"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","fields","listIds","consentText","consentVersion","doubleOptIn","successMessage","redirectUrl","fromName","fromEmail","replyTo","confirmation","welcomeTemplateId","style","allowedOrigins","stats","urls","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteForm","tags":["Forms"],"summary":"Delete a signup form","description":"Contacts who signed up are kept. Pending confirmation links stop working.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/forms/{id}/embed":{"get":{"operationId":"getFormEmbed","tags":["Forms"],"summary":"Embed code for a form","description":"`html` is a plain HTML form that works without JavaScript. Add `script` after it to show the result in place instead of on the hosted page.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"hostedUrl":{"type":"string"},"html":{"type":"string"},"script":{"type":"string"},"htmlWithScript":{"type":"string"}},"required":["hostedUrl","html","script","htmlWithScript"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/forms/{id}/submissions":{"get":{"operationId":"listFormSubmissions","tags":["Forms"],"summary":"List form submissions","description":"Newest first. Filter by `status` (comma-separated): `pending`, `confirmed`, `subscribed`, `already_subscribed`, `rejected`.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["form_submission"]},"formId":{"type":"string"},"contactId":{"type":["string","null"]},"email":{"type":"string"},"status":{"type":"string","enum":["pending","confirmed","subscribed","already_subscribed","rejected"]},"consentVersion":{"type":["number","null"]},"createdAt":{"type":"string"},"confirmedAt":{"type":["string","null"]},"confirmationError":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"at":{"type":"string"}},"required":["code","message","at"],"description":"Double opt-in: why the last confirmation email was not sent (for example `plan_required`, `license_required` or `email_limit`); null once one was sent."}},"required":["id","object","formId","contactId","email","status","consentVersion","createdAt","confirmedAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"submissionsForm","tags":["Forms"],"summary":"Submit a form from your server","description":"Same rules as the hosted form: with double opt-in the contact is `pending` until they confirm by email. Pass the subscriber’s `ip` and `userAgent` to include them in the consent proof (the IP is stored only as a hash).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"firstName":{"type":"string","maxLength":200},"lastName":{"type":"string","maxLength":200},"attributes":{"type":"object","additionalProperties":{},"description":"Values for the form fields, by attribute key."},"consent":{"type":"boolean","description":"Required (true) when the form has consent text."},"ip":{"type":"string","maxLength":64,"description":"The subscriber’s IP address, stored only as a hash in the consent proof."},"userAgent":{"type":"string","maxLength":500}},"required":["email"],"additionalProperties":false}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["pending","subscribed","already_subscribed","ignored"]},"submissionId":{"type":["string","null"]}},"required":["status","submissionId"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/archive/settings":{"get":{"operationId":"listArchiveSettings","tags":["Archive"],"summary":"Public archive settings","description":"The archive is off until `enabled` is true. Campaigns appear in it only when \"Show in archive\" is on for the campaign.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"domain":{"type":["string","null"],"description":"Custom host for archive links (must be under a verified domain and point at this server)."},"formId":{"type":["string","null"],"description":"Signup form shown at the top of archive pages."},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"url":{"type":"string","description":"Public URL of the archive index."},"feedUrl":{"type":"string"}},"required":["enabled","domain","formId","title","description","url","feedUrl"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateArchiveSetting","tags":["Archive"],"summary":"Update public archive settings","description":"`domain` must be under a domain this workspace verified, with a CNAME to this server; archive links and canonical URLs then use it.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"domain":{"type":["string","null"],"maxLength":253},"formId":{"type":["string","null"]},"title":{"type":["string","null"],"maxLength":200},"description":{"type":["string","null"],"maxLength":500}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"domain":{"type":["string","null"],"description":"Custom host for archive links (must be under a verified domain and point at this server)."},"formId":{"type":["string","null"],"description":"Signup form shown at the top of archive pages."},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"url":{"type":"string","description":"Public URL of the archive index."},"feedUrl":{"type":"string"}},"required":["enabled","domain","formId","title","description","url","feedUrl"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/archive":{"get":{"operationId":"getCampaignArchive","tags":["Archive"],"summary":"Archive status of a campaign","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"campaignId":{"type":"string"},"showInArchive":{"type":"boolean"},"slug":{"type":["string","null"]},"url":{"type":["string","null"],"description":"Public page, once the campaign is sent and the archive is enabled."},"published":{"type":"boolean","description":"True when the page is live: shown in the archive, sent, and the archive is enabled."}},"required":["campaignId","showInArchive","slug","url","published"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"put":{"operationId":"archiveCampaign","tags":["Archive"],"summary":"Show or hide a campaign in the public archive","description":"A slug is made from the subject the first time the campaign is shown. The page is public once the campaign has started sending and the archive is enabled.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"showInArchive":{"type":"boolean"},"slug":{"type":"string","pattern":"^[a-z0-9][a-z0-9-]{0,79}$"}},"required":["showInArchive"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"campaignId":{"type":"string"},"showInArchive":{"type":"boolean"},"slug":{"type":["string","null"]},"url":{"type":["string","null"],"description":"Public page, once the campaign is sent and the archive is enabled."},"published":{"type":"boolean","description":"True when the page is live: shown in the archive, sent, and the archive is enabled."}},"required":["campaignId","showInArchive","slug","url","published"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/signup":{"post":{"operationId":"signup","tags":["Auth"],"summary":"Create an account","description":"The first account on a fresh instance becomes the owner. Afterwards signup follows `ONESEND_SIGNUP`. Sets the `onesend_session` HttpOnly cookie for the dashboard and returns the session `token` for scripts.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":320,"format":"email"},"password":{"type":"string","minLength":8,"maxLength":256},"name":{"type":"string","maxLength":120},"workspaceName":{"type":"string","maxLength":80},"setupCode":{"type":"string","maxLength":200,"description":"The setup code printed by the installer (ONESEND_SETUP_CODE). Needed only for the first account, when the server has one."}},"required":["email","password"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","email","name"]},"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"plan":{"type":"string"}},"required":["id","name","slug","plan"]}},"required":["token","user","workspace"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/login":{"post":{"operationId":"login","tags":["Auth"],"summary":"Sign in","description":"Sets the `onesend_session` HttpOnly cookie for the dashboard and returns the session `token` for scripts. Rate limited per client and per account. Accounts with two-factor authentication get 401 `mfa_required` with `error.details.mfaToken`; finish with POST /v1/auth/login/2fa.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":320,"format":"email"},"password":{"type":"string","maxLength":256}},"required":["email","password"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","email","name"]},"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"plan":{"type":"string"}},"required":["id","name","slug","plan"]}},"required":["token","user","workspace"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/logout":{"post":{"operationId":"logout","tags":["Auth"],"summary":"Sign out (revoke the session and clear the cookie)","security":[],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/me":{"get":{"operationId":"getCurrentUser","tags":["Auth"],"summary":"Current user, workspace and credentials","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":["object","null"],"properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","email","name"]},"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"plan":{"type":"string"},"settings":{"type":"object","additionalProperties":{}}},"required":["id","name","slug","plan","settings"]},"workspaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"}},"required":["id","name","role"]}},"auth":{"type":"object","properties":{"kind":{"type":"string","enum":["session","api_key"]},"scope":{"type":"string"},"mode":{"type":"string"}},"required":["kind","scope","mode"]},"role":{"type":["string","null"]},"twoFactor":{"type":["object","null"],"properties":{"enabled":{"type":"boolean"},"required":{"type":"boolean","description":"The current workspace requires two-factor authentication"},"blocked":{"type":"boolean","description":"Required but this session did not sign in with it: only account endpoints work"}},"required":["enabled","required","blocked"]},"capabilities":{"type":"object","properties":{"edition":{"type":"string","enum":["self_hosted","cloud","desktop"],"description":"`cloud`: the hosted service (plans and billing); `self_hosted`: your own server; `desktop`: the server inside the Mac app."},"inbox":{"type":"boolean","description":"Inbox features are available (ONESEND_INBOX; off on the cloud edition and on servers without the inbox module)."},"connectedAccounts":{"type":"boolean","description":"Personal mailboxes (Gmail, Outlook, Zoho, IMAP) can be connected to the unified inbox on this server (ONESEND_CONNECTED_ACCOUNTS; off on the cloud edition, where the free desktop app offers it)."},"encryptMail":{"type":"boolean","description":"Stored mail bodies are encrypted at rest with a per-workspace key (ONESEND_ENCRYPT_MAIL)."},"cloudLink":{"type":"object","properties":{"linked":{"type":"boolean"},"url":{"type":"string"},"workspaceName":{"type":"string"}},"required":["linked"],"description":"Desktop edition: whether this Mac app sends through a linked OneSend Cloud account (an `onesend_cloud` sending connection). Always `{ linked: false }` elsewhere."},"license":{"type":"object","properties":{"required":{"type":"boolean"},"active":{"type":"boolean"}},"required":["required","active"],"description":"Self-hosted edition: live email needs a license key (`required`), and this server has an active one. See GET /v1/license."},"plansEnabled":{"type":"boolean","description":"Workspaces have plans: the cloud edition with its plans switched on (ONESEND_CLOUD_PLANS=on). false everywhere else, and on the cloud while it is free (plans off): show no plan names then."}},"required":["edition","inbox","connectedAccounts","encryptMail","cloudLink","license","plansEnabled"],"description":"What this server offers, for clients that adapt their interface."}},"required":["user","workspace","workspaces","auth","role","twoFactor","capabilities"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/workspace":{"post":{"operationId":"workspaceAuth","tags":["Auth"],"summary":"Switch the current workspace","description":"Sessions only. Later requests with this session act in the chosen workspace (the dashboard workspace switcher). Scripts can also send `X-Workspace-Id` per request. API keys always belong to one workspace.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"workspaceId":{"type":"string","maxLength":64}},"required":["workspaceId"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"plan":{"type":"string"}},"required":["id","name","slug","plan"]},"role":{"type":"string"}},"required":["workspace","role"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/workspace":{"get":{"operationId":"getWorkspace","tags":["Workspace"],"summary":"Workspace settings (tracking, sandbox, brand) and SMTP details","description":"While Sandbox mode is on, `sandboxPending` counts the scheduled campaigns and automation runs in progress that will send for real once it is off.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"plan":{"type":"string"},"settings":{"type":"object","additionalProperties":{}},"smtp":{"type":"object","properties":{"host":{"type":"string"},"port":{"type":["number","null"]},"username":{"type":"string"}},"required":["host","port","username"]},"inbound":{"type":"object","properties":{"smtpPort":{"type":["number","null"]},"cloudflareIngestUrl":{"type":"string"}},"required":["smtpPort","cloudflareIngestUrl"]},"sandboxPending":{"type":"object","properties":{"scheduledCampaigns":{"type":"integer","description":"Campaigns scheduled or sending (not test runs)."},"activeAutomationRuns":{"type":"integer","description":"Automation runs in progress (active or waiting), test runs left out."}},"required":["scheduledCampaigns","activeAutomationRuns"],"description":"What delivers for real once Sandbox mode is off: present while it is on, and in the response of the PATCH that turns it off."}},"required":["id","name","slug","plan","settings","smtp","inbound"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateWorkspace","tags":["Workspace"],"summary":"Update workspace settings","description":"Turning Sandbox mode off (`settings.sandbox: false`) needs a signed-in admin. The response that turns it off has `sandboxPending`: the scheduled campaigns and automation runs in progress, started while it was on, that now send for real.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"settings":{"type":"object","properties":{"trackOpens":{"type":"boolean"},"trackClicks":{"type":"boolean"},"trackingDomain":{"type":["string","null"],"maxLength":253},"defaultPolicyId":{"type":["string","null"],"description":"Routing policy for sends without `policy`. null or \"\" clears it."},"sandbox":{"type":"boolean"},"campaignDailyCap":{"type":["integer","null"],"minimum":1,"maximum":100000000,"description":"Most campaign emails per day for one campaign, on top of provider limits. null: only provider limits."},"timezone":{"type":"string","maxLength":64},"attributionWindowDays":{"type":"integer","minimum":1,"maximum":90},"companyAddress":{"type":["string","null"],"maxLength":500},"brand":{"type":"object","properties":{"logoUrl":{"type":"string"},"primary":{"type":"string"},"accent":{"type":"string"},"font":{"type":"string"}}},"themes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string","minLength":1,"maxLength":80},"theme":{"type":"object","additionalProperties":{}}},"required":["id","name","theme"]},"maxItems":50,"description":"Saved designer themes. Sending the list replaces it."}}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"plan":{"type":"string"},"settings":{"type":"object","additionalProperties":{}},"smtp":{"type":"object","properties":{"host":{"type":"string"},"port":{"type":["number","null"]},"username":{"type":"string"}},"required":["host","port","username"]},"inbound":{"type":"object","properties":{"smtpPort":{"type":["number","null"]},"cloudflareIngestUrl":{"type":"string"}},"required":["smtpPort","cloudflareIngestUrl"]},"sandboxPending":{"type":"object","properties":{"scheduledCampaigns":{"type":"integer","description":"Campaigns scheduled or sending (not test runs)."},"activeAutomationRuns":{"type":"integer","description":"Automation runs in progress (active or waiting), test runs left out."}},"required":["scheduledCampaigns","activeAutomationRuns"],"description":"What delivers for real once Sandbox mode is off: present while it is on, and in the response of the PATCH that turns it off."}},"required":["id","name","slug","plan","settings","smtp","inbound"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteWorkspace","tags":["Workspace"],"summary":"Delete the workspace","description":"Owner only, in a dashboard session. Confirm with your password (and a two-factor code if it is on) and type the workspace name in `confirm`. Starts a 7-day grace period: the workspace becomes read-only, sending stops, and members are notified. The owner can cancel with POST /v1/workspace/deletion/cancel. After the grace period every row of the workspace is deleted permanently. People keep their accounts.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string","maxLength":256,"description":"Your current password"},"code":{"type":"string","maxLength":40,"description":"Two-factor code or recovery code, when two-factor authentication is on for your account"},"confirm":{"type":"string","maxLength":200,"description":"The workspace name, typed exactly"}},"required":["password","confirm"]}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active","pending_deletion"]},"requestedAt":{"type":["string","null"]},"purgeAt":{"type":["string","null"]},"requestedBy":{"type":["object","null"],"properties":{"id":{"type":"string"},"email":{"type":["string","null"]}},"required":["id","email"]}},"required":["status","requestedAt","purgeAt","requestedBy"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/account":{"get":{"operationId":"getAccount","tags":["Account"],"summary":"Your account","description":"Profile, two-factor status and a pending email change. Session only.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]},"createdAt":{"type":"string"},"passwordChangedAt":{"type":["string","null"]},"twoFactor":{"type":"object","properties":{"enabled":{"type":"boolean"},"enabledAt":{"type":["string","null"]},"recoveryCodesRemaining":{"type":"number"}},"required":["enabled","enabledAt","recoveryCodesRemaining"]},"pendingEmail":{"type":["string","null"],"description":"New address waiting for confirmation"}},"required":["id","email","name","createdAt","passwordChangedAt","twoFactor","pendingEmail"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateAccount","tags":["Account"],"summary":"Update your profile","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":["string","null"],"maxLength":120}},"required":["name"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]},"createdAt":{"type":"string"},"passwordChangedAt":{"type":["string","null"]},"twoFactor":{"type":"object","properties":{"enabled":{"type":"boolean"},"enabledAt":{"type":["string","null"]},"recoveryCodesRemaining":{"type":"number"}},"required":["enabled","enabledAt","recoveryCodesRemaining"]},"pendingEmail":{"type":["string","null"],"description":"New address waiting for confirmation"}},"required":["id","email","name","createdAt","passwordChangedAt","twoFactor","pendingEmail"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteAccount","tags":["Account"],"summary":"Delete your account","description":"Session only. Confirm with your password (and a two-factor code if it is on). Not possible while you own a workspace: transfer ownership or delete the workspace first (409 `owns_workspaces`). Removes your account, memberships, sessions and app passwords; workspace data you created stays with the workspace. As when you leave a workspace, the API keys you created are revoked, and the inbox rules, mailbox forwarding and webhooks you set up that send mail out of a workspace are turned off.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string","maxLength":256,"description":"Your current password"},"code":{"type":"string","maxLength":40,"description":"Two-factor code or recovery code, when two-factor authentication is on for your account"}},"required":["password"]}}}},"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/account/password":{"post":{"operationId":"passwordAccount","tags":["Account"],"summary":"Change your password","description":"Needs the current password. Signs out every other session; this one stays signed in.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"currentPassword":{"type":"string","maxLength":256},"newPassword":{"type":"string","minLength":8,"maxLength":256}},"required":["currentPassword","newPassword"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"sessionsRevoked":{"type":"number"}},"required":["ok","sessionsRevoked"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/account/email":{"post":{"operationId":"emailAccount","tags":["Account"],"summary":"Change your email address","description":"Needs the current password. Sends a confirmation link (24 hours) to the new address; the address changes when it is opened.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":320,"format":"email"},"password":{"type":"string","maxLength":256}},"required":["email","password"]}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"message":{"type":"string"},"emailDelivery":{"type":"boolean"}},"required":["ok","message","emailDelivery"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/email/confirm":{"post":{"operationId":"confirmAuthEmail","tags":["Account"],"summary":"Confirm an email change","description":"Opens the link sent to the new address. The token is single use. The previous address gets a notice.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","maxLength":4096}},"required":["token"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"email":{"type":"string"}},"required":["ok","email"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/account/email-verification":{"post":{"operationId":"emailVerificationAccount","tags":["Account"],"summary":"Verify your email address","description":"Sends a link (24 hours) to your account's address; opening it marks the address as verified. Session only. Operator addresses (ONESEND_ADMIN_EMAILS) cannot be verified this way (403 `cli_verification_required`): instance admins need a verified address, and the link would travel through a workspace's own sending providers. Run `onesend-admin verify-email <email>` on the server instead.","security":[{"bearer":[]}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"message":{"type":"string"},"emailDelivery":{"type":"boolean"},"verified":{"type":"boolean"}},"required":["ok","message","emailDelivery","verified"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/account/sessions":{"get":{"operationId":"listAccountSessions","tags":["Account"],"summary":"List your active sessions","description":"Device (from the User-Agent), a keyed hash of the IP address, and when each was last used.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"device":{"type":"string"},"userAgent":{"type":["string","null"]},"ipHash":{"type":["string","null"],"description":"Keyed hash of the client IP address (the address is not stored)"},"createdAt":{"type":"string"},"lastSeenAt":{"type":"string"},"expiresAt":{"type":"string"},"current":{"type":"boolean"},"twoFactor":{"type":"boolean"}},"required":["id","device","userAgent","ipHash","createdAt","lastSeenAt","expiresAt","current","twoFactor"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/account/sessions/{id}":{"delete":{"operationId":"deleteAccountSession","tags":["Account"],"summary":"Revoke a session","description":"Signs that device out at once.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/account/sessions/revoke-others":{"post":{"operationId":"createAccountSessionRevokeOther","tags":["Account"],"summary":"Sign out everywhere else","description":"Revokes every session except this one.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"revoked":{"type":"number"}},"required":["revoked"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/account/2fa/setup":{"post":{"operationId":"setupAccount2fa","tags":["Account"],"summary":"Start two-factor setup","description":"Needs the current password. Returns a new TOTP secret (RFC 6238, 6 digits, 30 seconds) to add to an authenticator app. Two-factor is on after POST /v1/account/2fa/enable with a code.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string","maxLength":256}},"required":["password"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"type":"string"},"otpauthUrl":{"type":"string"},"issuer":{"type":"string"},"account":{"type":"string"}},"required":["secret","otpauthUrl","issuer","account"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/account/2fa/enable":{"post":{"operationId":"enableAccount2fa","tags":["Account"],"summary":"Turn on two-factor authentication","description":"Send a current code from the authenticator app. Returns 10 recovery codes, shown only once; each works one time instead of a code. This session counts as signed in with two-factor.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","maxLength":20}},"required":["code"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"recoveryCodes":{"type":"array","items":{"type":"string"}}},"required":["recoveryCodes"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/account/2fa/disable":{"post":{"operationId":"disableAccount2fa","tags":["Account"],"summary":"Turn off two-factor authentication","description":"Needs the current password and a code (or a recovery code). Workspaces that require two-factor stay locked for you until you turn it on again.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string","maxLength":256},"code":{"type":"string","maxLength":20,"description":"A current code, or a recovery code"}},"required":["password","code"]}}}},"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/account/2fa/recovery-codes":{"post":{"operationId":"createAccount2faRecoveryCode","tags":["Account"],"summary":"New recovery codes","description":"Needs the current password and a code. The previous recovery codes stop working.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string","maxLength":256},"code":{"type":"string","maxLength":20,"description":"A current code, or a recovery code"}},"required":["password","code"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"recoveryCodes":{"type":"array","items":{"type":"string"}}},"required":["recoveryCodes"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/login/2fa":{"post":{"operationId":"2faAuthLogin","tags":["Auth"],"summary":"Sign in: second step","description":"When the account has two-factor authentication, sign-in answers 401 `mfa_required` with `error.details.mfaToken`; send it here with the code from the authenticator app or a recovery code. The challenge is valid for 5 minutes.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mfaToken":{"type":"string","maxLength":4096},"code":{"type":"string","maxLength":20},"recoveryCode":{"type":"string","maxLength":40}},"required":["mfaToken"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","email","name"]},"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"plan":{"type":"string"}},"required":["id","name","slug","plan"]},"recoveryCodesRemaining":{"type":"number"}},"required":["token","user","workspace"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/password/forgot":{"post":{"operationId":"forgotAuthPassword","tags":["Auth"],"summary":"Request a password reset link","description":"Always answers 202 with the same message and timing, whether or not the email has an account. The email is sent through the router of a workspace the account belongs to. If the server cannot deliver email (only the sandbox provider), an administrator can create a link on the server: `npm run admin -- reset-password <email>`.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":320,"format":"email"}},"required":["email"]}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"message":{"type":"string"}},"required":["ok","message"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/password/check":{"post":{"operationId":"checkAuthPassword","tags":["Auth"],"summary":"Check a password reset link","description":"Tells the reset page whether the link can still be used (and whether a two-factor code will be needed). Does not use the link.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","maxLength":4096}},"required":["token"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"valid":{"type":"boolean"},"twoFactor":{"type":"boolean"}},"required":["valid","twoFactor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/password/reset":{"post":{"operationId":"resetAuthPassword","tags":["Auth"],"summary":"Set a new password with a reset link","description":"The link works once, for 30 minutes, and stops working if the password changes in the meantime. Every session of the account is signed out. Accounts with two-factor authentication also need a code (or a recovery code). Does not sign in: sign in with the new password afterwards.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","maxLength":4096},"password":{"type":"string","minLength":8,"maxLength":256},"code":{"type":"string","maxLength":40,"description":"Two-factor code or recovery code, when the account has two-factor authentication"}},"required":["token","password"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/invitation":{"post":{"operationId":"invitationAuth","tags":["Team"],"summary":"Look up an invitation","description":"For the accept page: workspace, role and whether the invited email already has an account.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","maxLength":4096}},"required":["token"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]},"email":{"type":"string"},"role":{"type":"string"},"roleLabel":{"type":"string"},"invitedBy":{"type":["object","null"],"properties":{"email":{"type":"string"},"name":{"type":["string","null"]}},"required":["email","name"]},"expiresAt":{"type":"string"},"accountExists":{"type":"boolean","description":"An account with the invited email exists: sign in to accept. Otherwise create one with POST /v1/auth/invitation/accept."},"signedInAs":{"type":["string","null"]},"alreadyMember":{"type":"boolean"}},"required":["workspace","email","role","roleLabel","invitedBy","expiresAt","accountExists","signedInAs","alreadyMember"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/invitation/accept":{"post":{"operationId":"acceptAuthInvitation","tags":["Team"],"summary":"Accept an invitation","description":"Signed in as the invited email: joins the workspace and switches this session to it. Not signed in and no account for the email: send `password` (and `name`) to create the account and join; this works whatever ONESEND_SIGNUP says, because the invitation is the permission. An account exists but you are not signed in: 401 `login_required`.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","maxLength":4096},"name":{"type":"string","maxLength":120},"password":{"type":"string","minLength":8,"maxLength":256,"description":"Only when creating a new account"}},"required":["token"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","email","name"]},"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"plan":{"type":"string"}},"required":["id","name","slug","plan"]}},"required":["token","user","workspace"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/team/members":{"get":{"operationId":"listTeamMembers","tags":["Team"],"summary":"List workspace members","description":"Every role can list members.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]},"role":{"type":"string","enum":["viewer","member","admin","owner"]},"joinedAt":{"type":"string"},"twoFactorEnabled":{"type":"boolean"},"you":{"type":"boolean"}},"required":["userId","email","name","role","joinedAt","twoFactorEnabled","you"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/team/members/{userId}":{"patch":{"operationId":"updateTeamMember","tags":["Team"],"summary":"Change a member's role","description":"Admins and the owner. Roles: `admin`, `member`, `viewer`. The owner's role cannot be changed (transfer ownership instead), and nobody changes their own role.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["admin","member","viewer"]}},"required":["role"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]},"role":{"type":"string","enum":["viewer","member","admin","owner"]},"joinedAt":{"type":"string"},"twoFactorEnabled":{"type":"boolean"},"you":{"type":"boolean"}},"required":["userId","email","name","role","joinedAt","twoFactorEnabled","you"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteTeamMember","tags":["Team"],"summary":"Remove a member","description":"Admins and the owner. The owner cannot be removed. Their sessions stop working in this workspace at once. To leave a workspace yourself, use POST /v1/team/leave.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/team/leave":{"post":{"operationId":"leaveTeam","tags":["Team"],"summary":"Leave the current workspace","description":"Any role except the owner (transfer ownership first). You cannot leave your only workspace.","security":[{"bearer":[]}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/team/transfer-ownership":{"post":{"operationId":"transferOwnershipTeam","tags":["Team"],"summary":"Transfer ownership to another member","description":"Owner only, in a dashboard session. Confirm with your password (and two-factor code if it is on). You become an admin.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"password":{"type":"string","maxLength":256,"description":"Your current password, to confirm."},"code":{"type":"string","maxLength":20,"description":"Two-factor code, when two-factor authentication is on for your account."}},"required":["userId","password"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]},"role":{"type":"string","enum":["viewer","member","admin","owner"]},"joinedAt":{"type":"string"},"twoFactorEnabled":{"type":"boolean"},"you":{"type":"boolean"}},"required":["userId","email","name","role","joinedAt","twoFactorEnabled","you"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/team/invitations":{"get":{"operationId":"listTeamInvitations","tags":["Team"],"summary":"List invitations","description":"Admins and the owner. Pending invitations by default; `status=all` includes accepted, revoked and expired ones.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","enum":["pending","all"]},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["invitation"]},"email":{"type":"string"},"role":{"type":"string","enum":["admin","member","viewer"]},"status":{"type":"string","enum":["pending","accepted","revoked","expired"]},"invitedBy":{"type":["object","null"],"properties":{"email":{"type":"string"},"name":{"type":["string","null"]}},"required":["email","name"]},"expiresAt":{"type":"string"},"lastSentAt":{"type":["string","null"]},"sendCount":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","object","email","role","status","invitedBy","expiresAt","lastSentAt","sendCount","createdAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createTeamInvitation","tags":["Team"],"summary":"Invite someone by email","description":"Admins and the owner. Sends an invitation email through this workspace's router (a system email). The link works for 7 days. Inviting an address that already has a pending invitation sends a new link and updates the role. When the email cannot be delivered (only the Sandbox), `link` returns the invitation link to a signed-in admin to pass on; never to an API key (an API key cannot invite someone without the email reaching them). An invitation sent with an API key is tied to it: when the key is revoked or reported as leaked (or a key that created it is), the invitation is canceled, and a member who joined through it is removed from the workspace (their API keys, inbox rules, forwarding and connected mailboxes stop too). Sending it again from the dashboard unties it.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":320,"format":"email"},"role":{"type":"string","enum":["admin","member","viewer"],"default":"member"}},"required":["email"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["invitation"]},"email":{"type":"string"},"role":{"type":"string","enum":["admin","member","viewer"]},"status":{"type":"string","enum":["pending","accepted","revoked","expired"]},"invitedBy":{"type":["object","null"],"properties":{"email":{"type":"string"},"name":{"type":["string","null"]}},"required":["email","name"]},"expiresAt":{"type":"string"},"lastSentAt":{"type":["string","null"]},"sendCount":{"type":"number"},"createdAt":{"type":"string"},"emailDelivery":{"type":"boolean","description":"false when the workspace has no sending provider that delivers (only the sandbox): the email was logged, not delivered. `link` is then included so an admin can share it."},"link":{"type":"string"}},"required":["id","object","email","role","status","invitedBy","expiresAt","lastSentAt","sendCount","createdAt","emailDelivery"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/team/invitations/{id}/resend":{"post":{"operationId":"resendTeamInvitation","tags":["Team"],"summary":"Resend an invitation","description":"Sends a new link (the previous link stops working) and restarts the 7 days.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["invitation"]},"email":{"type":"string"},"role":{"type":"string","enum":["admin","member","viewer"]},"status":{"type":"string","enum":["pending","accepted","revoked","expired"]},"invitedBy":{"type":["object","null"],"properties":{"email":{"type":"string"},"name":{"type":["string","null"]}},"required":["email","name"]},"expiresAt":{"type":"string"},"lastSentAt":{"type":["string","null"]},"sendCount":{"type":"number"},"createdAt":{"type":"string"},"emailDelivery":{"type":"boolean","description":"false when the workspace has no sending provider that delivers (only the sandbox): the email was logged, not delivered. `link` is then included so an admin can share it."},"link":{"type":"string"}},"required":["id","object","email","role","status","invitedBy","expiresAt","lastSentAt","sendCount","createdAt","emailDelivery"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/team/invitations/{id}":{"delete":{"operationId":"deleteTeamInvitation","tags":["Team"],"summary":"Revoke an invitation","description":"The link stops working at once.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/team/settings":{"get":{"operationId":"listTeamSettings","tags":["Team"],"summary":"Team security settings","description":"Whether two-factor authentication is required, whether the workspace can deliver system email, and the role permission matrix.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"require2fa":{"type":"boolean"},"emailDelivery":{"type":"boolean","description":"The workspace can deliver system email (invitations, password reset). false: only the sandbox provider is connected."},"membersWithout2fa":{"type":"number"},"roles":{"type":"array","items":{"type":"object","properties":{"area":{"type":"string"},"viewer":{"type":"boolean"},"member":{"type":"boolean"},"admin":{"type":"boolean"},"owner":{"type":"boolean"}},"required":["area","viewer","member","admin","owner"]}}},"required":["require2fa","emailDelivery","membersWithout2fa","roles"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateTeamSetting","tags":["Team"],"summary":"Require two-factor authentication","description":"Admins and the owner. With `require2fa`, members without two-factor authentication can only manage their own account until they turn it on and sign in again. Turn it on for your own account first.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"require2fa":{"type":"boolean"}},"required":["require2fa"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"require2fa":{"type":"boolean"},"emailDelivery":{"type":"boolean","description":"The workspace can deliver system email (invitations, password reset). false: only the sandbox provider is connected."},"membersWithout2fa":{"type":"number"},"roles":{"type":"array","items":{"type":"object","properties":{"area":{"type":"string"},"viewer":{"type":"boolean"},"member":{"type":"boolean"},"admin":{"type":"boolean"},"owner":{"type":"boolean"}},"required":["area","viewer","member","admin","owner"]}}},"required":["require2fa","emailDelivery","membersWithout2fa","roles"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/audit-log":{"get":{"operationId":"getAuditLog","tags":["Audit log"],"summary":"List audit log entries","description":"Admins and the owner (or an admin-scoped key). Newest first. Records member, role and invitation changes, and changes to sending providers, routing, domains, DNS hosts, mailboxes, webhooks, API keys, workspace settings and AI provider connections. Request bodies are not stored, only field names and non-secret values.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":80,"description":"Exact action (member.role_changed) or a prefix ending in a dot (member.)"},"required":false,"description":"Exact action (member.role_changed) or a prefix ending in a dot (member.)","name":"action","in":"query"},{"schema":{"type":"string","maxLength":80,"description":"User id or API key id"},"required":false,"description":"User id or API key id","name":"actor","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"target","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"since","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"until","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"action":{"type":"string"},"target":{"type":["string","null"]},"actor":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["user","api_key","system"]},"label":{"type":"string"}},"required":["id","type","label"]},"data":{"type":["object","null"],"additionalProperties":{}},"createdAt":{"type":"string"}},"required":["id","action","target","actor","data","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/audit-log/export":{"get":{"operationId":"getAuditLogExport","tags":["Audit log"],"summary":"Export the audit log as CSV","description":"Same filters as the list. Up to 50,000 rows, newest first.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":80,"description":"Exact action (member.role_changed) or a prefix ending in a dot (member.)"},"required":false,"description":"Exact action (member.role_changed) or a prefix ending in a dot (member.)","name":"action","in":"query"},{"schema":{"type":"string","maxLength":80,"description":"User id or API key id"},"required":false,"description":"User id or API key id","name":"actor","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"target","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"since","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"until","in":"query"}],"responses":{"200":{"description":"Success","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/setup/status":{"get":{"operationId":"getSetupStatus","tags":["Auth"],"summary":"First-run status","description":"Whether this instance has an account yet, and how sign-up works. No authentication. The database kind is shown only until the first account exists; paths, hosts and secrets are never returned.","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"hasUsers":{"type":"boolean","description":"Whether any account exists. False on a fresh install: the first account to sign up becomes the owner."},"databaseKind":{"type":["string","null"],"enum":["sqlite","postgres","libsql","pglite","d1",null],"description":"Database driver in use. `null` once an account exists."},"dataDirIsDefault":{"type":["boolean","null"],"description":"True when the data folder is the default `./.data` in the folder the server runs from. `null` once an account exists."},"publicUrl":{"type":"string","description":"ONESEND_PUBLIC_URL (or the local default)."},"signupMode":{"type":"string","enum":["open","first-user","invite","closed"],"description":"ONESEND_SIGNUP."},"signupAllowed":{"type":"boolean","description":"Whether this client may create an account now."},"setupCodeRequired":{"type":"boolean","description":"True while the instance has no account and ONESEND_SETUP_CODE is set: the first sign-up needs the code the installer printed."}},"required":["hasUsers","databaseKind","dataDirIsDefault","publicUrl","signupMode","signupAllowed","setupCodeRequired"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/emails":{"post":{"operationId":"sendEmail","tags":["Emails"],"summary":"Send an email","description":"Queues an email and routes it through your providers by policy, failing over on provider errors (never on recipient errors). Pass `Idempotency-Key` to make retries safe. Use `template` + `variables` to render a stored template.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":256},"required":false,"name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string","maxLength":998,"description":"Sender: `a@b.com` or `Name <a@b.com>`. The domain should be added under Domains so providers accept it."},"to":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"One address or a list (at most 50). Each is `a@b.com` or `Name <a@b.com>`."},"cc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Carbon copy: one address or a list."},"bcc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Blind carbon copy: one address or a list."},"replyTo":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Reply-To address or addresses."},"subject":{"type":"string","maxLength":998,"description":"Subject line. Optional with `template` (the template subject is used). `{{variables}}` are filled in like the body."},"html":{"type":"string","maxLength":5000000,"description":"HTML body (at most 5 MB). `{{variables}}` and system variables such as `{{unsubscribe_url}}` are filled in."},"text":{"type":"string","maxLength":2000000,"description":"Plain-text body (at most 2 MB)."},"template":{"type":"string","description":"Template id or slug. Renders the published version (or the latest) with `variables`."},"variables":{"type":"object","additionalProperties":{},"description":"Values for `{{variables}}` in the subject, html and template. Missing ones render empty and are listed in `warnings`."},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Extra headers. Reserved names (To, Cc, Bcc, From, Subject, Reply-To, …) are refused."},"attachments":{"type":"array","items":{"type":"object","properties":{"filename":{"type":"string","description":"File name shown to the recipient."},"content":{"type":"string","description":"Base64 content (at most 10 MB)."},"url":{"type":"string","format":"uri","description":"Public http(s) URL to fetch instead of `content`."},"contentType":{"type":"string","description":"MIME type, for example application/pdf."}},"required":["filename"]},"maxItems":20,"description":"Up to 20 files, each with `content` (base64) or a public `url`."},"tags":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":20,"description":"Labels for filtering logs and statistics, and for routing rules."},"metadata":{"type":"object","additionalProperties":{"type":"string"},"description":"Your own key/value data, returned with the email and in webhooks."},"type":{"type":"string","enum":["transactional","broadcast"],"default":"transactional","description":"`transactional` (default) or `broadcast` (marketing: adds List-Unsubscribe, honours broadcast unsubscribes and only uses providers that allow campaigns)."},"policy":{"type":"string","description":"Routing policy id or name. Defaults to the workspace default policy."},"provider":{"type":"string","description":"Force one sending provider (connection id). Skips routing order and failover."},"scheduledAt":{"type":"string","format":"date-time","description":"Send later: an ISO 8601 time with an offset, for example 2030-01-01T09:00:00+01:00."},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"}},"description":"Open and click tracking for this email. Wins over the sending domain's tracking settings, which win over the workspace defaults."}},"required":["from","to"],"example":{"from":"Acme <hello@acme.com>","to":"ada@example.com","subject":"Welcome, {{name}}","html":"<p>Hi {{name}}, thanks for signing up.</p>","variables":{"name":"Ada"},"tags":["welcome"]}}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued","scheduled","sending","sent","delivered","bounced","complained","failed","suppressed","deferred","canceled","sandboxed"]},"warnings":{"type":"array","items":{"type":"string"},"description":"Problems that did not stop the send, for example \"Missing variable: name\"."}},"required":["id","status"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`. Sending: an API key past its expiry (`key_expired`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"402":{"description":"Payment required (type `payment_required`), for live email only (test keys and Sandbox mode are never refused): `license_required`, a self-hosted server without an active license key (`details.buyUrl`); on the cloud, only when cloud plans are enabled (they are off by default), `plan_required` (the workspace has no plan), `email_limit` (the month's emails are used, counted per recipient; `details.resetsAt`) and `domain_limit` (the plan sends from its own domains only), with `details.upgradeUrl` where to change the plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`. Sending: a recipient outside the key's recipient allowlist (`recipient_not_allowed`), a key used from an address it does not allow (`ip_not_allowed`), a sender domain the key may not use (`domain_not_allowed`), a session that needs two-factor authentication (`two_factor_required`) or a role that cannot send (`insufficient_role`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"422":{"description":"Unprocessable (type `invalid_request`): `no_provider_for_domain`, no sending provider of the routing path may or can send for the From domain; `details.candidates` says why each provider was left out. Live email only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`) Sending: the key's hourly or daily send limit (`key_rate_limited`); retry after `Retry-After` seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"get":{"operationId":"listEmails","tags":["Emails"],"summary":"List emails","description":"Filter by status, provider (provider id or connection id), tag, free-text (`q` on recipients/subject) and time range.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"provider","in":"query"},{"schema":{"type":"string"},"required":false,"name":"tag","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"until","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"rerouted","in":"query"},{"schema":{"type":"string"},"required":false,"name":"source","in":"query"},{"schema":{"type":"string","enum":["transactional","broadcast"]},"required":false,"name":"type","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["email"]},"status":{"type":"string","enum":["queued","scheduled","sending","sent","delivered","bounced","complained","failed","suppressed","deferred","canceled","sandboxed"]},"type":{"type":"string","enum":["transactional","broadcast"]},"from":{"type":"string"},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":["array","null"],"items":{"type":"string"}},"bcc":{"type":["array","null"],"items":{"type":"string"}},"subject":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":["object","null"],"additionalProperties":{"type":"string"}},"templateId":{"type":["string","null"]},"source":{"type":"string","enum":["api","smtp","mcp","dashboard","broadcast"]},"connectionId":{"type":["string","null"]},"provider":{"type":["string","null"]},"providerMessageId":{"type":["string","null"]},"attemptCount":{"type":"number"},"lastError":{"type":["string","null"]},"openCount":{"type":"number"},"clickCount":{"type":"number"},"scheduledAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","status","type","from","to","cc","bcc","subject","tags","metadata","templateId","source","connectionId","provider","providerMessageId","attemptCount","lastError","openCount","clickCount","scheduledAt","sentAt","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/emails/batch":{"post":{"operationId":"sendEmailBatch","tags":["Emails"],"summary":"Send up to 100 emails","description":"Every item is validated (templates, providers, policies, headers, plan and key limits, and whether a provider can send for its From domain) before any is sent: one invalid item rejects the whole batch with its error (400, 402, 403, 404, 422 or 429) and `details.index`, and nothing is queued. The plan's monthly emails and the key's send limits must have room for the whole batch. Each email is then routed independently. With `Idempotency-Key`, item *i* uses `<key>:<i>`.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":256},"required":false,"name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"emails":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","maxLength":998,"description":"Sender: `a@b.com` or `Name <a@b.com>`. The domain should be added under Domains so providers accept it."},"to":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"One address or a list (at most 50). Each is `a@b.com` or `Name <a@b.com>`."},"cc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Carbon copy: one address or a list."},"bcc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Blind carbon copy: one address or a list."},"replyTo":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Reply-To address or addresses."},"subject":{"type":"string","maxLength":998,"description":"Subject line. Optional with `template` (the template subject is used). `{{variables}}` are filled in like the body."},"html":{"type":"string","maxLength":5000000,"description":"HTML body (at most 5 MB). `{{variables}}` and system variables such as `{{unsubscribe_url}}` are filled in."},"text":{"type":"string","maxLength":2000000,"description":"Plain-text body (at most 2 MB)."},"template":{"type":"string","description":"Template id or slug. Renders the published version (or the latest) with `variables`."},"variables":{"type":"object","additionalProperties":{},"description":"Values for `{{variables}}` in the subject, html and template. Missing ones render empty and are listed in `warnings`."},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Extra headers. Reserved names (To, Cc, Bcc, From, Subject, Reply-To, …) are refused."},"attachments":{"type":"array","items":{"type":"object","properties":{"filename":{"type":"string","description":"File name shown to the recipient."},"content":{"type":"string","description":"Base64 content (at most 10 MB)."},"url":{"type":"string","format":"uri","description":"Public http(s) URL to fetch instead of `content`."},"contentType":{"type":"string","description":"MIME type, for example application/pdf."}},"required":["filename"]},"maxItems":20,"description":"Up to 20 files, each with `content` (base64) or a public `url`."},"tags":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":20,"description":"Labels for filtering logs and statistics, and for routing rules."},"metadata":{"type":"object","additionalProperties":{"type":"string"},"description":"Your own key/value data, returned with the email and in webhooks."},"type":{"type":"string","enum":["transactional","broadcast"],"default":"transactional","description":"`transactional` (default) or `broadcast` (marketing: adds List-Unsubscribe, honours broadcast unsubscribes and only uses providers that allow campaigns)."},"policy":{"type":"string","description":"Routing policy id or name. Defaults to the workspace default policy."},"provider":{"type":"string","description":"Force one sending provider (connection id). Skips routing order and failover."},"scheduledAt":{"type":"string","format":"date-time","description":"Send later: an ISO 8601 time with an offset, for example 2030-01-01T09:00:00+01:00."},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"}},"description":"Open and click tracking for this email. Wins over the sending domain's tracking settings, which win over the workspace defaults."}},"required":["from","to"],"example":{"from":"Acme <hello@acme.com>","to":"ada@example.com","subject":"Welcome, {{name}}","html":"<p>Hi {{name}}, thanks for signing up.</p>","variables":{"name":"Ada"},"tags":["welcome"]}},"minItems":1,"maxItems":100}},"required":["emails"]}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued","scheduled","sending","sent","delivered","bounced","complained","failed","suppressed","deferred","canceled","sandboxed"]},"warnings":{"type":"array","items":{"type":"string"},"description":"Problems that did not stop the send, for example \"Missing variable: name\"."}},"required":["id","status"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`. Sending: an API key past its expiry (`key_expired`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"402":{"description":"Payment required (type `payment_required`), for live email only (test keys and Sandbox mode are never refused): `license_required`, a self-hosted server without an active license key (`details.buyUrl`); on the cloud, only when cloud plans are enabled (they are off by default), `plan_required` (the workspace has no plan), `email_limit` (the month's emails are used, counted per recipient; `details.resetsAt`) and `domain_limit` (the plan sends from its own domains only), with `details.upgradeUrl` where to change the plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`. Sending: a recipient outside the key's recipient allowlist (`recipient_not_allowed`), a key used from an address it does not allow (`ip_not_allowed`), a sender domain the key may not use (`domain_not_allowed`), a session that needs two-factor authentication (`two_factor_required`) or a role that cannot send (`insufficient_role`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"422":{"description":"Unprocessable (type `invalid_request`): `no_provider_for_domain`, no sending provider of the routing path may or can send for the From domain; `details.candidates` says why each provider was left out. Live email only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`) Sending: the key's hourly or daily send limit (`key_rate_limited`); retry after `Retry-After` seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/emails/{id}":{"get":{"operationId":"getEmail","tags":["Emails"],"summary":"Get an email with its routing attempts and events","description":"Test-mode keys only see sandboxed emails (404 otherwise): every sandboxed email of the workspace, whichever test key sent it. Reading needs a `read` or `full` key; a `send` key, the default, gets 403 `insufficient_scope`.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["email"]},"status":{"type":"string","enum":["queued","scheduled","sending","sent","delivered","bounced","complained","failed","suppressed","deferred","canceled","sandboxed"]},"type":{"type":"string","enum":["transactional","broadcast"]},"from":{"type":"string"},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":["array","null"],"items":{"type":"string"}},"bcc":{"type":["array","null"],"items":{"type":"string"}},"subject":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":["object","null"],"additionalProperties":{"type":"string"}},"templateId":{"type":["string","null"]},"source":{"type":"string","enum":["api","smtp","mcp","dashboard","broadcast"]},"connectionId":{"type":["string","null"]},"provider":{"type":["string","null"]},"providerMessageId":{"type":["string","null"]},"attemptCount":{"type":"number"},"lastError":{"type":["string","null"]},"openCount":{"type":"number"},"clickCount":{"type":"number"},"scheduledAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"createdAt":{"type":"string"},"html":{"type":["string","null"]},"text":{"type":["string","null"]},"attempts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"seq":{"type":"number"},"connectionId":{"type":"string"},"provider":{"type":"string"},"outcome":{"type":"string","enum":["success","retry_next","retry_same","recipient_fatal","config_fatal","skipped"]},"errorCode":{"type":["string","null"]},"errorMessage":{"type":["string","null"]},"httpStatus":{"type":["number","null"]},"latencyMs":{"type":["number","null"]},"createdAt":{"type":"string"}},"required":["id","seq","connectionId","provider","outcome","errorCode","errorMessage","httpStatus","latencyMs","createdAt"]}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"messageId":{"type":["string","null"]},"provider":{"type":["string","null"]},"connectionId":{"type":["string","null"]},"recipient":{"type":["string","null"]},"data":{"type":["object","null"],"additionalProperties":{}},"occurredAt":{"type":"string"}},"required":["id","type","messageId","provider","connectionId","recipient","data","occurredAt"]}}},"required":["id","object","status","type","from","to","cc","bcc","subject","tags","metadata","templateId","source","connectionId","provider","providerMessageId","attemptCount","lastError","openCount","clickCount","scheduledAt","sentAt","createdAt","html","text","attempts","events"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/emails/{id}/cancel":{"post":{"operationId":"cancelEmail","tags":["Emails"],"summary":"Cancel a scheduled or deferred email","description":"System email (security alerts, sign-in and invitation links) cannot be canceled with an API key: 403 `system_email`.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued","scheduled","sending","sent","delivered","bounced","complained","failed","suppressed","deferred","canceled","sandboxed"]},"warnings":{"type":"array","items":{"type":"string"},"description":"Problems that did not stop the send, for example \"Missing variable: name\"."}},"required":["id","status"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/emails/{id}/resend":{"post":{"operationId":"resendEmail","tags":["Emails"],"summary":"Send a copy of an email again (new id, same content)","description":"A fresh send: new Message-ID, tracking and unsubscribe links; not attributed to a campaign; sandboxed for test keys and sandbox workspaces. 409 `body_unavailable` when the content is no longer stored (older than `ONESEND_RETENTION_DAYS`).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued","scheduled","sending","sent","delivered","bounced","complained","failed","suppressed","deferred","canceled","sandboxed"]},"warnings":{"type":"array","items":{"type":"string"},"description":"Problems that did not stop the send, for example \"Missing variable: name\"."}},"required":["id","status"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`. Sending: an API key past its expiry (`key_expired`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"402":{"description":"Payment required (type `payment_required`), for live email only (test keys and Sandbox mode are never refused): `license_required`, a self-hosted server without an active license key (`details.buyUrl`); on the cloud, only when cloud plans are enabled (they are off by default), `plan_required` (the workspace has no plan), `email_limit` (the month's emails are used, counted per recipient; `details.resetsAt`) and `domain_limit` (the plan sends from its own domains only), with `details.upgradeUrl` where to change the plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`. Sending: a recipient outside the key's recipient allowlist (`recipient_not_allowed`), a key used from an address it does not allow (`ip_not_allowed`), a sender domain the key may not use (`domain_not_allowed`), a session that needs two-factor authentication (`two_factor_required`) or a role that cannot send (`insufficient_role`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"422":{"description":"Unprocessable (type `invalid_request`): `no_provider_for_domain`, no sending provider of the routing path may or can send for the From domain; `details.candidates` says why each provider was left out. Live email only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`) Sending: the key's hourly or daily send limit (`key_rate_limited`); retry after `Retry-After` seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/providers":{"get":{"operationId":"listProviders","tags":["Provider catalog"],"summary":"Provider catalog","description":"Every provider OneSend can route through, with the credential fields to connect it and its known free tier.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"website":{"type":"string"},"docsUrl":{"type":"string"},"description":{"type":"string"},"color":{"type":"string"},"category":{"type":"string"},"credentials":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string"},"required":{"type":"boolean"},"placeholder":{"type":"string"},"help":{"type":"string"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"secret":{"type":"boolean"}},"required":["key","label","type"]}},"freeTier":{"type":"object","properties":{"daily":{"type":"number"},"monthly":{"type":"number"},"note":{"type":"string"}}},"capabilities":{"type":"object","additionalProperties":{"type":"boolean"}},"broadcastFriendly":{"type":"boolean"},"keyScopeHelp":{"type":"string"}},"required":["id","name","website","docsUrl","description","color","category","credentials","capabilities"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/connections":{"get":{"operationId":"listConnections","tags":["Sending providers"],"summary":"List connected provider accounts with today's usage","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["connection"]},"provider":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["active","paused","error"]},"statusReason":{"type":["string","null"]},"config":{"type":"object","additionalProperties":{}},"allowBroadcast":{"type":"boolean"},"dailyLimit":{"type":["number","null"]},"monthlyLimit":{"type":["number","null"]},"perSecondLimit":{"type":["number","null"]},"quotaSource":{"type":"string","enum":["detected","default","manual","learned"]},"health":{"type":"number"},"circuitOpenUntil":{"type":["string","null"]},"usage":{"type":"object","properties":{"today":{"type":"number"},"thisMonth":{"type":"number"},"remainingToday":{"type":["number","null"]}},"required":["today","thisMonth","remainingToday"]},"webhookUrl":{"type":["string","null"]},"credentialHints":{"type":"object","additionalProperties":{"type":"string"}},"webhookSeenAt":{"type":["string","null"]},"reputation":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","marketing_paused","paused"],"description":"`marketing_paused`: out of rotation for campaigns. `paused`: also for transactional email (still used when no other provider can send)."},"since":{"type":["string","null"]},"code":{"type":["string","null"],"enum":["bounce_rate","complaint_rate",null]},"reason":{"type":["string","null"]},"value":{"type":["number","null"]},"threshold":{"type":["number","null"]},"window":{"type":["string","null"],"enum":["24h","7d",null]},"sample":{"type":["number","null"]},"baselineAt":{"type":["string","null"]},"evaluatedAt":{"type":["string","null"]},"rates":{"type":["object","null"],"properties":{"h24":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]},"d7":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]}},"required":["h24","d7"]},"manual":{"type":"boolean"}},"required":["status","since"]},"createdAt":{"type":"string"}},"required":["id","object","provider","name","status","statusReason","config","allowBroadcast","dailyLimit","monthlyLimit","perSecondLimit","quotaSource","health","circuitOpenUntil","usage","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createConnection","tags":["Sending providers"],"summary":"Connect a provider account","description":"Validates the credentials against the provider, detects quota where the provider exposes it (else uses the known free tier), adds it to the default routing policy and registers delivery webhooks when the instance has a public URL.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":80},"credentials":{"type":"object","additionalProperties":{"type":"string"}},"config":{"type":"object","additionalProperties":{}},"allowBroadcast":{"type":"boolean"},"dailyLimit":{"type":["integer","null"],"exclusiveMinimum":0},"monthlyLimit":{"type":["integer","null"],"exclusiveMinimum":0},"priority":{"type":"integer","minimum":0,"maximum":100000,"description":"Placement in the default routing policy: 1000 or more puts the new connection first; otherwise it goes after your other providers (before the Sandbox). `onesend_cloud` connections always go first."}},"required":["provider","name","credentials"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["connection"]},"provider":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["active","paused","error"]},"statusReason":{"type":["string","null"]},"config":{"type":"object","additionalProperties":{}},"allowBroadcast":{"type":"boolean"},"dailyLimit":{"type":["number","null"]},"monthlyLimit":{"type":["number","null"]},"perSecondLimit":{"type":["number","null"]},"quotaSource":{"type":"string","enum":["detected","default","manual","learned"]},"health":{"type":"number"},"circuitOpenUntil":{"type":["string","null"]},"usage":{"type":"object","properties":{"today":{"type":"number"},"thisMonth":{"type":"number"},"remainingToday":{"type":["number","null"]}},"required":["today","thisMonth","remainingToday"]},"webhookUrl":{"type":["string","null"]},"credentialHints":{"type":"object","additionalProperties":{"type":"string"}},"webhookSeenAt":{"type":["string","null"]},"reputation":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","marketing_paused","paused"],"description":"`marketing_paused`: out of rotation for campaigns. `paused`: also for transactional email (still used when no other provider can send)."},"since":{"type":["string","null"]},"code":{"type":["string","null"],"enum":["bounce_rate","complaint_rate",null]},"reason":{"type":["string","null"]},"value":{"type":["number","null"]},"threshold":{"type":["number","null"]},"window":{"type":["string","null"],"enum":["24h","7d",null]},"sample":{"type":["number","null"]},"baselineAt":{"type":["string","null"]},"evaluatedAt":{"type":["string","null"]},"rates":{"type":["object","null"],"properties":{"h24":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]},"d7":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]}},"required":["h24","d7"]},"manual":{"type":"boolean"}},"required":["status","since"]},"createdAt":{"type":"string"}},"required":["id","object","provider","name","status","statusReason","config","allowBroadcast","dailyLimit","monthlyLimit","perSecondLimit","quotaSource","health","circuitOpenUntil","usage","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"402":{"description":"Payment required (type `payment_required`), only on the cloud edition when cloud plans are enabled (they are off by default): the plan's limit is reached, `plan_limit` (sending providers in use) or `domain_limit` (sending domains); `details.limit`, `details.used` and `details.upgradeUrl` say what and where to upgrade.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/connections/{id}":{"get":{"operationId":"getConnection","tags":["Sending providers"],"summary":"Get a connection","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["connection"]},"provider":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["active","paused","error"]},"statusReason":{"type":["string","null"]},"config":{"type":"object","additionalProperties":{}},"allowBroadcast":{"type":"boolean"},"dailyLimit":{"type":["number","null"]},"monthlyLimit":{"type":["number","null"]},"perSecondLimit":{"type":["number","null"]},"quotaSource":{"type":"string","enum":["detected","default","manual","learned"]},"health":{"type":"number"},"circuitOpenUntil":{"type":["string","null"]},"usage":{"type":"object","properties":{"today":{"type":"number"},"thisMonth":{"type":"number"},"remainingToday":{"type":["number","null"]}},"required":["today","thisMonth","remainingToday"]},"webhookUrl":{"type":["string","null"]},"credentialHints":{"type":"object","additionalProperties":{"type":"string"}},"webhookSeenAt":{"type":["string","null"]},"reputation":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","marketing_paused","paused"],"description":"`marketing_paused`: out of rotation for campaigns. `paused`: also for transactional email (still used when no other provider can send)."},"since":{"type":["string","null"]},"code":{"type":["string","null"],"enum":["bounce_rate","complaint_rate",null]},"reason":{"type":["string","null"]},"value":{"type":["number","null"]},"threshold":{"type":["number","null"]},"window":{"type":["string","null"],"enum":["24h","7d",null]},"sample":{"type":["number","null"]},"baselineAt":{"type":["string","null"]},"evaluatedAt":{"type":["string","null"]},"rates":{"type":["object","null"],"properties":{"h24":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]},"d7":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]}},"required":["h24","d7"]},"manual":{"type":"boolean"}},"required":["status","since"]},"createdAt":{"type":"string"}},"required":["id","object","provider","name","status","statusReason","config","allowBroadcast","dailyLimit","monthlyLimit","perSecondLimit","quotaSource","health","circuitOpenUntil","usage","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateConnection","tags":["Sending providers"],"summary":"Update a connection (rename, pause, limits, credentials)","description":"Pausing (`status: \"paused\"`) needs a signed-in admin: API keys get 403 `session_required` (pausing can stop all delivery, the owners' security alerts included). Changing where the credentials are sent (URL, host, port, TLS) needs every credential again in the same request (400 `credentials_required`).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":80},"credentials":{"type":"object","additionalProperties":{"type":"string"}},"config":{"type":"object","additionalProperties":{}},"allowBroadcast":{"type":"boolean"},"dailyLimit":{"type":["integer","null"],"exclusiveMinimum":0},"monthlyLimit":{"type":["integer","null"],"exclusiveMinimum":0},"status":{"type":"string","enum":["active","paused"]}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["connection"]},"provider":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["active","paused","error"]},"statusReason":{"type":["string","null"]},"config":{"type":"object","additionalProperties":{}},"allowBroadcast":{"type":"boolean"},"dailyLimit":{"type":["number","null"]},"monthlyLimit":{"type":["number","null"]},"perSecondLimit":{"type":["number","null"]},"quotaSource":{"type":"string","enum":["detected","default","manual","learned"]},"health":{"type":"number"},"circuitOpenUntil":{"type":["string","null"]},"usage":{"type":"object","properties":{"today":{"type":"number"},"thisMonth":{"type":"number"},"remainingToday":{"type":["number","null"]}},"required":["today","thisMonth","remainingToday"]},"webhookUrl":{"type":["string","null"]},"credentialHints":{"type":"object","additionalProperties":{"type":"string"}},"webhookSeenAt":{"type":["string","null"]},"reputation":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","marketing_paused","paused"],"description":"`marketing_paused`: out of rotation for campaigns. `paused`: also for transactional email (still used when no other provider can send)."},"since":{"type":["string","null"]},"code":{"type":["string","null"],"enum":["bounce_rate","complaint_rate",null]},"reason":{"type":["string","null"]},"value":{"type":["number","null"]},"threshold":{"type":["number","null"]},"window":{"type":["string","null"],"enum":["24h","7d",null]},"sample":{"type":["number","null"]},"baselineAt":{"type":["string","null"]},"evaluatedAt":{"type":["string","null"]},"rates":{"type":["object","null"],"properties":{"h24":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]},"d7":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]}},"required":["h24","d7"]},"manual":{"type":"boolean"}},"required":["status","since"]},"createdAt":{"type":"string"}},"required":["id","object","provider","name","status","statusReason","config","allowBroadcast","dailyLimit","monthlyLimit","perSecondLimit","quotaSource","health","circuitOpenUntil","usage","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"402":{"description":"Payment required (type `payment_required`), only on the cloud edition when cloud plans are enabled (they are off by default): the plan's limit is reached, `plan_limit` (sending providers in use) or `domain_limit` (sending domains); `details.limit`, `details.used` and `details.upgradeUrl` say what and where to upgrade.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteConnection","tags":["Sending providers"],"summary":"Disconnect a provider","description":"Deletes the stored credentials and takes the provider out of every routing policy and rule. Email still waiting to send goes through the next provider of its policy when it is sent (or follows the policy's fallback when none is left); sent email and logs are kept. For a personal mailbox used as a sending provider, \"Use as a sending provider\" is turned off on that account; the account stays connected.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/connections/{id}/test":{"post":{"operationId":"testConnection","tags":["Sending providers"],"summary":"Check the credentials still work","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"account":{"type":["object","null"],"additionalProperties":{}},"error":{"type":["string","null"]},"latencyMs":{"type":"number"}},"required":["ok","account","error","latencyMs"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/connections/{id}/insights":{"get":{"operationId":"listConnectionInsights","tags":["Sending providers"],"summary":"Health, affinity, webhooks and sync of a connection","description":"Hard bounce and complaint rates over 24 hours and 7 days against the thresholds and whether the provider is in rotation; the share of recipients whose preferred provider it is; when a provider webhook last arrived and whether delivery status is polled instead; and its suppression sync state.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"type":"string"},"health":{"type":"object","properties":{"status":{"type":"string","enum":["ok","marketing_paused","paused"],"description":"`marketing_paused`: out of rotation for campaigns. `paused`: also for transactional email (still used when no other provider can send)."},"since":{"type":["string","null"]},"code":{"type":["string","null"],"enum":["bounce_rate","complaint_rate",null]},"reason":{"type":["string","null"]},"value":{"type":["number","null"]},"threshold":{"type":["number","null"]},"window":{"type":["string","null"],"enum":["24h","7d",null]},"sample":{"type":["number","null"]},"baselineAt":{"type":["string","null"]},"evaluatedAt":{"type":["string","null"]},"rates":{"type":["object","null"],"properties":{"h24":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]},"d7":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]}},"required":["h24","d7"]},"manual":{"type":"boolean"},"thresholds":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"},"minSample24h":{"type":"number"},"minSample7d":{"type":"number"},"severeFactor":{"type":"number"},"cooldownHours":{"type":"number"}},"required":["enabled","bounceRate","complaintRate","minSample24h","minSample7d","severeFactor","cooldownHours"]}},"required":["status","since","thresholds"]},"affinity":{"type":"object","properties":{"recipients":{"type":"number","description":"Recipients (or mailbox providers) whose preferred provider is this one."},"share":{"type":"number","description":"Share of all affinity entries of the workspace (0 to 1)."}},"required":["recipients","share"]},"webhooks":{"type":"object","properties":{"supported":{"type":"boolean"},"lastSeenAt":{"type":["string","null"]},"recent":{"type":"boolean","description":"A webhook arrived within the last 7 days."},"polling":{"type":"boolean","description":"Delivery status is polled from the provider API for this connection."},"pollingSupported":{"type":"boolean"}},"required":["supported","lastSeenAt","recent","polling","pollingSupported"]},"sync":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["suppressions","suppressions_push","status"]},"supported":{"type":"boolean","description":"The provider API offers this (and it was not refused for this key)."},"status":{"type":"string","enum":["idle","running","error","unsupported"]},"inProgress":{"type":"boolean","description":"A pass started and continues in the next run."},"lastRunAt":{"type":["string","null"]},"lastSuccessAt":{"type":["string","null"]},"nextRunAt":{"type":["string","null"]},"lastResult":{"type":["object","null"],"properties":{"ok":{"type":"boolean"},"at":{"type":"string"},"imported":{"type":"number"},"updated":{"type":"number"},"seen":{"type":"number"},"pushed":{"type":"number"},"polled":{"type":"number"},"events":{"type":"number"},"pages":{"type":"number"},"done":{"type":"boolean"},"error":{"type":["string","null"]},"unsupported":{"type":"boolean"}},"required":["ok","at"]},"total":{"type":"number","description":"Entries imported (or pushed, or emails polled) over time."}},"required":["connectionId","provider","name","kind","supported","status","inProgress","lastRunAt","lastSuccessAt","nextRunAt","lastResult","total"]}},"suppressions":{"type":"number","description":"Active suppressions that came from this connection."}},"required":["connectionId","health","affinity","webhooks","sync","suppressions"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/connections/{id}/health/reset":{"post":{"operationId":"resetConnectionsHealth","tags":["Sending providers"],"summary":"Put a provider back in rotation","description":"Ends an automatic removal for high bounce or complaint rates now; the provider is judged on email sent from now on.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok","marketing_paused","paused"],"description":"`marketing_paused`: out of rotation for campaigns. `paused`: also for transactional email (still used when no other provider can send)."},"since":{"type":["string","null"]},"code":{"type":["string","null"],"enum":["bounce_rate","complaint_rate",null]},"reason":{"type":["string","null"]},"value":{"type":["number","null"]},"threshold":{"type":["number","null"]},"window":{"type":["string","null"],"enum":["24h","7d",null]},"sample":{"type":["number","null"]},"baselineAt":{"type":["string","null"]},"evaluatedAt":{"type":["string","null"]},"rates":{"type":["object","null"],"properties":{"h24":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]},"d7":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]}},"required":["h24","d7"]},"manual":{"type":"boolean"}},"required":["status","since"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/connections/{id}/suppressions/sync":{"post":{"operationId":"syncConnectionsSuppressions","tags":["Sending providers"],"summary":"Import this provider's suppression list now","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["suppressions","suppressions_push","status"]},"supported":{"type":"boolean","description":"The provider API offers this (and it was not refused for this key)."},"status":{"type":"string","enum":["idle","running","error","unsupported"]},"inProgress":{"type":"boolean","description":"A pass started and continues in the next run."},"lastRunAt":{"type":["string","null"]},"lastSuccessAt":{"type":["string","null"]},"nextRunAt":{"type":["string","null"]},"lastResult":{"type":["object","null"],"properties":{"ok":{"type":"boolean"},"at":{"type":"string"},"imported":{"type":"number"},"updated":{"type":"number"},"seen":{"type":"number"},"pushed":{"type":"number"},"polled":{"type":"number"},"events":{"type":"number"},"pages":{"type":"number"},"done":{"type":"boolean"},"error":{"type":["string","null"]},"unsupported":{"type":"boolean"}},"required":["ok","at"]},"total":{"type":"number","description":"Entries imported (or pushed, or emails polled) over time."}},"required":["connectionId","provider","name","kind","supported","status","inProgress","lastRunAt","lastSuccessAt","nextRunAt","lastResult","total"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/connections/{id}/rotate-webhook-url":{"post":{"operationId":"rotateConnectionWebhookUrl","tags":["Sending providers"],"summary":"Rotate the provider webhook URL","description":"Issues a new secret token for this connection's `webhookUrl`; the old URL stops working at once. OneSend re-registers the new URL with providers that support it; for others, update the URL in the provider dashboard.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["connection"]},"provider":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["active","paused","error"]},"statusReason":{"type":["string","null"]},"config":{"type":"object","additionalProperties":{}},"allowBroadcast":{"type":"boolean"},"dailyLimit":{"type":["number","null"]},"monthlyLimit":{"type":["number","null"]},"perSecondLimit":{"type":["number","null"]},"quotaSource":{"type":"string","enum":["detected","default","manual","learned"]},"health":{"type":"number"},"circuitOpenUntil":{"type":["string","null"]},"usage":{"type":"object","properties":{"today":{"type":"number"},"thisMonth":{"type":"number"},"remainingToday":{"type":["number","null"]}},"required":["today","thisMonth","remainingToday"]},"webhookUrl":{"type":["string","null"]},"credentialHints":{"type":"object","additionalProperties":{"type":"string"}},"webhookSeenAt":{"type":["string","null"]},"reputation":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","marketing_paused","paused"],"description":"`marketing_paused`: out of rotation for campaigns. `paused`: also for transactional email (still used when no other provider can send)."},"since":{"type":["string","null"]},"code":{"type":["string","null"],"enum":["bounce_rate","complaint_rate",null]},"reason":{"type":["string","null"]},"value":{"type":["number","null"]},"threshold":{"type":["number","null"]},"window":{"type":["string","null"],"enum":["24h","7d",null]},"sample":{"type":["number","null"]},"baselineAt":{"type":["string","null"]},"evaluatedAt":{"type":["string","null"]},"rates":{"type":["object","null"],"properties":{"h24":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]},"d7":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]}},"required":["h24","d7"]},"manual":{"type":"boolean"}},"required":["status","since"]},"createdAt":{"type":"string"}},"required":["id","object","provider","name","status","statusReason","config","allowBroadcast","dailyLimit","monthlyLimit","perSecondLimit","quotaSource","health","circuitOpenUntil","usage","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/connections/{id}/refresh-quota":{"post":{"operationId":"refreshConnectionQuota","tags":["Sending providers"],"summary":"Re-detect quota from the provider","description":"Manual limits are kept unless the provider reports a lower one.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["connection"]},"provider":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["active","paused","error"]},"statusReason":{"type":["string","null"]},"config":{"type":"object","additionalProperties":{}},"allowBroadcast":{"type":"boolean"},"dailyLimit":{"type":["number","null"]},"monthlyLimit":{"type":["number","null"]},"perSecondLimit":{"type":["number","null"]},"quotaSource":{"type":"string","enum":["detected","default","manual","learned"]},"health":{"type":"number"},"circuitOpenUntil":{"type":["string","null"]},"usage":{"type":"object","properties":{"today":{"type":"number"},"thisMonth":{"type":"number"},"remainingToday":{"type":["number","null"]}},"required":["today","thisMonth","remainingToday"]},"webhookUrl":{"type":["string","null"]},"credentialHints":{"type":"object","additionalProperties":{"type":"string"}},"webhookSeenAt":{"type":["string","null"]},"reputation":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","marketing_paused","paused"],"description":"`marketing_paused`: out of rotation for campaigns. `paused`: also for transactional email (still used when no other provider can send)."},"since":{"type":["string","null"]},"code":{"type":["string","null"],"enum":["bounce_rate","complaint_rate",null]},"reason":{"type":["string","null"]},"value":{"type":["number","null"]},"threshold":{"type":["number","null"]},"window":{"type":["string","null"],"enum":["24h","7d",null]},"sample":{"type":["number","null"]},"baselineAt":{"type":["string","null"]},"evaluatedAt":{"type":["string","null"]},"rates":{"type":["object","null"],"properties":{"h24":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]},"d7":{"type":"object","properties":{"sent":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["sent","bounced","complained","bounceRate","complaintRate"]}},"required":["h24","d7"]},"manual":{"type":"boolean"}},"required":["status","since"]},"createdAt":{"type":"string"}},"required":["id","object","provider","name","status","statusReason","config","allowBroadcast","dailyLimit","monthlyLimit","perSecondLimit","quotaSource","health","circuitOpenUntil","usage","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/policies":{"get":{"operationId":"listPolicies","tags":["Routing"],"summary":"List routing policies","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["policy"]},"name":{"type":"string"},"description":{"type":["string","null"]},"strategy":{"type":"string","enum":["priority","weighted","round_robin"]},"steps":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"weight":{"type":"number"},"dailyCap":{"type":"integer","exclusiveMinimum":0},"enabled":{"type":"boolean"},"stream":{"type":"string","enum":["transactional","broadcast"],"description":"Stream separation: only `transactional` or only `broadcast` (campaign) email uses this provider. Unset: both."}},"required":["connectionId"]}},"rules":{"type":"array","items":{"type":"object","properties":{"when":{"type":"object","properties":{"recipientDomain":{"type":"array","items":{"type":"string"}},"tag":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["transactional","broadcast"]},"fromDomain":{"type":"array","items":{"type":"string"}}}},"steps":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"weight":{"type":"number"},"dailyCap":{"type":"integer","exclusiveMinimum":0},"enabled":{"type":"boolean"},"stream":{"type":"string","enum":["transactional","broadcast"],"description":"Stream separation: only `transactional` or only `broadcast` (campaign) email uses this provider. Unset: both."}},"required":["connectionId"]}}},"required":["when","steps"]}},"fallback":{"type":"string","enum":["queue_until_reset","fail"]},"messageTypes":{"type":"array","items":{"type":"string","enum":["transactional","broadcast"]}},"isDefault":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","object","name","description","strategy","steps","rules","fallback","messageTypes","isDefault","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createPolicy","tags":["Routing"],"summary":"Create a routing policy","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":["string","null"]},"strategy":{"type":"string","enum":["priority","weighted","round_robin"]},"steps":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"weight":{"type":"number"},"dailyCap":{"type":"integer","exclusiveMinimum":0},"enabled":{"type":"boolean"},"stream":{"type":"string","enum":["transactional","broadcast"],"description":"Stream separation: only `transactional` or only `broadcast` (campaign) email uses this provider. Unset: both."}},"required":["connectionId"]}},"rules":{"type":"array","items":{"type":"object","properties":{"when":{"type":"object","properties":{"recipientDomain":{"type":"array","items":{"type":"string"}},"tag":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["transactional","broadcast"]},"fromDomain":{"type":"array","items":{"type":"string"}}}},"steps":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"weight":{"type":"number"},"dailyCap":{"type":"integer","exclusiveMinimum":0},"enabled":{"type":"boolean"},"stream":{"type":"string","enum":["transactional","broadcast"],"description":"Stream separation: only `transactional` or only `broadcast` (campaign) email uses this provider. Unset: both."}},"required":["connectionId"]}}},"required":["when","steps"]}},"fallback":{"type":"string","enum":["queue_until_reset","fail"]},"messageTypes":{"type":"array","items":{"type":"string","enum":["transactional","broadcast"]}},"isDefault":{"type":"boolean"}},"required":["name","steps"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["policy"]},"name":{"type":"string"},"description":{"type":["string","null"]},"strategy":{"type":"string","enum":["priority","weighted","round_robin"]},"steps":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"weight":{"type":"number"},"dailyCap":{"type":"integer","exclusiveMinimum":0},"enabled":{"type":"boolean"},"stream":{"type":"string","enum":["transactional","broadcast"],"description":"Stream separation: only `transactional` or only `broadcast` (campaign) email uses this provider. Unset: both."}},"required":["connectionId"]}},"rules":{"type":"array","items":{"type":"object","properties":{"when":{"type":"object","properties":{"recipientDomain":{"type":"array","items":{"type":"string"}},"tag":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["transactional","broadcast"]},"fromDomain":{"type":"array","items":{"type":"string"}}}},"steps":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"weight":{"type":"number"},"dailyCap":{"type":"integer","exclusiveMinimum":0},"enabled":{"type":"boolean"},"stream":{"type":"string","enum":["transactional","broadcast"],"description":"Stream separation: only `transactional` or only `broadcast` (campaign) email uses this provider. Unset: both."}},"required":["connectionId"]}}},"required":["when","steps"]}},"fallback":{"type":"string","enum":["queue_until_reset","fail"]},"messageTypes":{"type":"array","items":{"type":"string","enum":["transactional","broadcast"]}},"isDefault":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","object","name","description","strategy","steps","rules","fallback","messageTypes","isDefault","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/policies/{id}":{"get":{"operationId":"getPolicy","tags":["Routing"],"summary":"Get a policy","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["policy"]},"name":{"type":"string"},"description":{"type":["string","null"]},"strategy":{"type":"string","enum":["priority","weighted","round_robin"]},"steps":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"weight":{"type":"number"},"dailyCap":{"type":"integer","exclusiveMinimum":0},"enabled":{"type":"boolean"},"stream":{"type":"string","enum":["transactional","broadcast"],"description":"Stream separation: only `transactional` or only `broadcast` (campaign) email uses this provider. Unset: both."}},"required":["connectionId"]}},"rules":{"type":"array","items":{"type":"object","properties":{"when":{"type":"object","properties":{"recipientDomain":{"type":"array","items":{"type":"string"}},"tag":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["transactional","broadcast"]},"fromDomain":{"type":"array","items":{"type":"string"}}}},"steps":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"weight":{"type":"number"},"dailyCap":{"type":"integer","exclusiveMinimum":0},"enabled":{"type":"boolean"},"stream":{"type":"string","enum":["transactional","broadcast"],"description":"Stream separation: only `transactional` or only `broadcast` (campaign) email uses this provider. Unset: both."}},"required":["connectionId"]}}},"required":["when","steps"]}},"fallback":{"type":"string","enum":["queue_until_reset","fail"]},"messageTypes":{"type":"array","items":{"type":"string","enum":["transactional","broadcast"]}},"isDefault":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","object","name","description","strategy","steps","rules","fallback","messageTypes","isDefault","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updatePolicy","tags":["Routing"],"summary":"Update a policy (reorder steps, caps, rules, fallback)","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":["string","null"]},"strategy":{"type":"string","enum":["priority","weighted","round_robin"]},"steps":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"weight":{"type":"number"},"dailyCap":{"type":"integer","exclusiveMinimum":0},"enabled":{"type":"boolean"},"stream":{"type":"string","enum":["transactional","broadcast"],"description":"Stream separation: only `transactional` or only `broadcast` (campaign) email uses this provider. Unset: both."}},"required":["connectionId"]}},"rules":{"type":"array","items":{"type":"object","properties":{"when":{"type":"object","properties":{"recipientDomain":{"type":"array","items":{"type":"string"}},"tag":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["transactional","broadcast"]},"fromDomain":{"type":"array","items":{"type":"string"}}}},"steps":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"weight":{"type":"number"},"dailyCap":{"type":"integer","exclusiveMinimum":0},"enabled":{"type":"boolean"},"stream":{"type":"string","enum":["transactional","broadcast"],"description":"Stream separation: only `transactional` or only `broadcast` (campaign) email uses this provider. Unset: both."}},"required":["connectionId"]}}},"required":["when","steps"]}},"fallback":{"type":"string","enum":["queue_until_reset","fail"]},"messageTypes":{"type":"array","items":{"type":"string","enum":["transactional","broadcast"]}},"isDefault":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["policy"]},"name":{"type":"string"},"description":{"type":["string","null"]},"strategy":{"type":"string","enum":["priority","weighted","round_robin"]},"steps":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"weight":{"type":"number"},"dailyCap":{"type":"integer","exclusiveMinimum":0},"enabled":{"type":"boolean"},"stream":{"type":"string","enum":["transactional","broadcast"],"description":"Stream separation: only `transactional` or only `broadcast` (campaign) email uses this provider. Unset: both."}},"required":["connectionId"]}},"rules":{"type":"array","items":{"type":"object","properties":{"when":{"type":"object","properties":{"recipientDomain":{"type":"array","items":{"type":"string"}},"tag":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["transactional","broadcast"]},"fromDomain":{"type":"array","items":{"type":"string"}}}},"steps":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"weight":{"type":"number"},"dailyCap":{"type":"integer","exclusiveMinimum":0},"enabled":{"type":"boolean"},"stream":{"type":"string","enum":["transactional","broadcast"],"description":"Stream separation: only `transactional` or only `broadcast` (campaign) email uses this provider. Unset: both."}},"required":["connectionId"]}}},"required":["when","steps"]}},"fallback":{"type":"string","enum":["queue_until_reset","fail"]},"messageTypes":{"type":"array","items":{"type":"string","enum":["transactional","broadcast"]}},"isDefault":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","object","name","description","strategy","steps","rules","fallback","messageTypes","isDefault","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deletePolicy","tags":["Routing"],"summary":"Delete a policy","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/route/preview":{"post":{"operationId":"previewRoute","tags":["Routing"],"summary":"Dry-run: which provider would send this right now, and why the others would not","description":"Applies the same rules as sending: the From domain must be verified on a provider (unless the provider needs no per-domain verification) and the provider must be among the domain's allowed providers. `error` is set when no provider can send for the From domain (`no_provider_for_domain`).","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["transactional","broadcast"],"default":"transactional"},"tags":{"type":"array","items":{"type":"string"}},"policy":{"type":"string"}},"required":["from","to"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":["object","null"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"allowedConnections":{"type":["array","null"],"items":{"type":"string"},"description":"Connections allowed to send for the domain. null: every connection where it is verified."}},"required":["id","name","allowedConnections"]},"error":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["no_provider_for_domain"]},"message":{"type":"string"}},"required":["code","message"]},"candidates":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"eligible":{"type":"boolean"},"reason":{"type":["string","null"]},"remainingToday":{"type":["number","null"]},"code":{"type":["string","null"],"enum":["not_found","inactive","circuit_open","stream","broadcast_not_allowed","reputation","domain_not_allowed","domain_not_verified","quota_daily","quota_monthly",null],"description":"Why the candidate is not eligible, for programs. `domain_not_allowed` and `domain_not_verified` come from the From domain."},"preferred":{"type":["string","null"],"enum":["campaign","recipient",null],"description":"Moved first: the campaign's provider, or the one that last accepted email for this recipient."},"lastResort":{"type":"boolean","description":"Out of rotation for its bounce or complaint rate; used only when no other provider can send."}},"required":["connectionId","provider","eligible","reason","remainingToday"]}}},"required":["candidates"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains":{"get":{"operationId":"listDomains","tags":["Senders & domains"],"summary":"List domains with per-provider verification","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["domain"]},"name":{"type":"string"},"status":{"type":"string","enum":["pending","partial","verified","failed"]},"dnsProvider":{"type":["string","null"]},"inbound":{"type":"object","properties":{"mode":{"type":"string","enum":["none","builtin","cloudflare","provider"]},"connectionId":{"type":"string"}},"required":["mode"]},"registrations":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed","unsupported"]},"error":{"type":["string","null"]},"errorCode":{"type":["string","null"]}},"required":["connectionId","provider","status","error"]}},"dnsPlan":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["TXT","CNAME","MX","A"]},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":"number"},"ttl":{"type":"number"},"purpose":{"type":"string"},"providers":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["pending","ok","mismatch","missing"]},"note":{"type":"string"}},"required":["type","name","value","purpose","providers"]}},"ownership":{"type":"object","properties":{"status":{"type":"string","enum":["pending","verified"]},"record":{"type":"object","properties":{"type":{"type":"string","enum":["TXT"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]}},"required":["status","record"]},"dnsHost":{"type":["object","null"],"properties":{"host":{"type":"string"},"detected":{"type":"string"},"name":{"type":"string"},"confidence":{"type":"string","enum":["high","medium","low","none"]},"nameservers":{"type":"array","items":{"type":"string"}},"automatic":{"type":"boolean"},"zone":{"type":["string","null"]},"override":{"type":["string","null"]},"detectedAt":{"type":"string"},"connectionId":{"type":["string","null"]}},"required":["host","detected","name","confidence","nameservers","automatic","zone","override","detectedAt","connectionId"]},"receiving":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","no_mx","spf_missing","mixed","unknown_host","lookup_failed"]},"hosts":{"type":"array","items":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"}},"required":["id","name"]}},"choice":{"type":["string","null"],"enum":["forward","mailbox","existing","skip",null]},"hostId":{"type":["string","null"]},"checkedAt":{"type":["string","null"]}},"required":["status","hosts","choice","hostId","checkedAt"]},"tracking":{"type":"object","properties":{"opens":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"clicks":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"customDomain":{"type":["string","null"],"description":"Tracking subdomain, for example links.acme.com. Add its CNAME record (in `record`)."},"customDomainStatus":{"type":["string","null"],"enum":["pending","verified","missing","mismatch",null],"description":"The last DNS check of the CNAME record. Links use the custom domain only when `verified`."},"record":{"type":["object","null"],"properties":{"type":{"type":"string","enum":["CNAME"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]},"effective":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"host":{"type":"string"}},"required":["opens","clicks","host"],"description":"What email from this domain gets now, after the workspace defaults are applied."}},"required":["opens","clicks","customDomain","customDomainStatus","record","effective"]},"routing":{"type":"object","properties":{"allowedConnections":{"type":["array","null"],"items":{"type":"string"},"description":"null: every provider where the domain is verified (automatic). A list: only these."},"connections":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","description":"Connection status (active, paused, error)."},"allowed":{"type":"boolean"},"registration":{"type":["string","null"],"enum":["pending","verified","failed","unsupported",null],"description":"The domain at this provider. null: not set up there."},"needsVerification":{"type":"boolean","description":"The provider verifies each sending domain. SMTP servers, for example, do not."},"canSend":{"type":"boolean","description":"Allowed, and verified (or no verification needed)."},"reason":{"type":["string","null"],"enum":["not_allowed","not_registered","pending","failed",null]}},"required":["connectionId","name","provider","status","allowed","registration","needsVerification","canSend","reason"]}}},"required":["allowedConnections","connections"]},"warnings":{"type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","status","dnsProvider","inbound","registrations","dnsPlan","warnings","lastCheckedAt","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createDomain","tags":["Senders & domains"],"summary":"Add a domain once — registered on every provider","description":"Creates the domain on each connected provider through its API (a provider account that already has the domain is used as it is: no new provider domain or DKIM keys), merges every DNS requirement into one plan (single SPF with lookup check, one DKIM per provider, DMARC, inbound MX), detects the DNS host from the nameservers, optionally writes the records through a DNS host connection (`autoApplyDns`) and starts verification polling.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":253,"pattern":"^(?!-)[a-z0-9-]+(\\.[a-z0-9-]+)+$","description":"The domain you send from, for example acme.com or mail.acme.com."},"connections":{"type":"array","items":{"type":"string"},"description":"Sending providers to register the domain on. Default: every active one."},"dnsConnectionId":{"type":"string","description":"DNS host connection (Settings > DNS hosts) that writes the DNS records for you. A Cloudflare sending provider with DNS permission also works."},"autoApplyDns":{"type":"boolean","default":false,"description":"Write the DNS records right away through `dnsConnectionId`, or through a connection for the detected DNS host."},"inbound":{"type":"string","enum":["none","builtin","cloudflare"],"default":"none","description":"Receive mail for this domain: `builtin` (this server on port 25) or `cloudflare` (Email Routing worker)."}},"required":["name"],"example":{"name":"acme.com","inbound":"none"}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["domain"]},"name":{"type":"string"},"status":{"type":"string","enum":["pending","partial","verified","failed"]},"dnsProvider":{"type":["string","null"]},"inbound":{"type":"object","properties":{"mode":{"type":"string","enum":["none","builtin","cloudflare","provider"]},"connectionId":{"type":"string"}},"required":["mode"]},"registrations":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed","unsupported"]},"error":{"type":["string","null"]},"errorCode":{"type":["string","null"]}},"required":["connectionId","provider","status","error"]}},"dnsPlan":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["TXT","CNAME","MX","A"]},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":"number"},"ttl":{"type":"number"},"purpose":{"type":"string"},"providers":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["pending","ok","mismatch","missing"]},"note":{"type":"string"}},"required":["type","name","value","purpose","providers"]}},"ownership":{"type":"object","properties":{"status":{"type":"string","enum":["pending","verified"]},"record":{"type":"object","properties":{"type":{"type":"string","enum":["TXT"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]}},"required":["status","record"]},"dnsHost":{"type":["object","null"],"properties":{"host":{"type":"string"},"detected":{"type":"string"},"name":{"type":"string"},"confidence":{"type":"string","enum":["high","medium","low","none"]},"nameservers":{"type":"array","items":{"type":"string"}},"automatic":{"type":"boolean"},"zone":{"type":["string","null"]},"override":{"type":["string","null"]},"detectedAt":{"type":"string"},"connectionId":{"type":["string","null"]}},"required":["host","detected","name","confidence","nameservers","automatic","zone","override","detectedAt","connectionId"]},"receiving":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","no_mx","spf_missing","mixed","unknown_host","lookup_failed"]},"hosts":{"type":"array","items":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"}},"required":["id","name"]}},"choice":{"type":["string","null"],"enum":["forward","mailbox","existing","skip",null]},"hostId":{"type":["string","null"]},"checkedAt":{"type":["string","null"]}},"required":["status","hosts","choice","hostId","checkedAt"]},"tracking":{"type":"object","properties":{"opens":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"clicks":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"customDomain":{"type":["string","null"],"description":"Tracking subdomain, for example links.acme.com. Add its CNAME record (in `record`)."},"customDomainStatus":{"type":["string","null"],"enum":["pending","verified","missing","mismatch",null],"description":"The last DNS check of the CNAME record. Links use the custom domain only when `verified`."},"record":{"type":["object","null"],"properties":{"type":{"type":"string","enum":["CNAME"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]},"effective":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"host":{"type":"string"}},"required":["opens","clicks","host"],"description":"What email from this domain gets now, after the workspace defaults are applied."}},"required":["opens","clicks","customDomain","customDomainStatus","record","effective"]},"routing":{"type":"object","properties":{"allowedConnections":{"type":["array","null"],"items":{"type":"string"},"description":"null: every provider where the domain is verified (automatic). A list: only these."},"connections":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","description":"Connection status (active, paused, error)."},"allowed":{"type":"boolean"},"registration":{"type":["string","null"],"enum":["pending","verified","failed","unsupported",null],"description":"The domain at this provider. null: not set up there."},"needsVerification":{"type":"boolean","description":"The provider verifies each sending domain. SMTP servers, for example, do not."},"canSend":{"type":"boolean","description":"Allowed, and verified (or no verification needed)."},"reason":{"type":["string","null"],"enum":["not_allowed","not_registered","pending","failed",null]}},"required":["connectionId","name","provider","status","allowed","registration","needsVerification","canSend","reason"]}}},"required":["allowedConnections","connections"]},"warnings":{"type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","status","dnsProvider","inbound","registrations","dnsPlan","warnings","lastCheckedAt","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"402":{"description":"Payment required (type `payment_required`), only on the cloud edition when cloud plans are enabled (they are off by default): the plan's limit is reached, `plan_limit` (sending providers in use) or `domain_limit` (sending domains); `details.limit`, `details.used` and `details.upgradeUrl` say what and where to upgrade.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains/provider-domains":{"get":{"operationId":"listDomainProviderDomains","tags":["Senders & domains"],"summary":"Domains already set up in your providers","description":"For each connected provider whose API can list domains: the domains that already exist in that account, and whether each is in this workspace yet. Adding one of them (POST /v1/domains) uses the provider's existing entry as it is: no new provider domain, no new DKIM keys. Changes nothing.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"name":{"type":"string","description":"Connection name"},"provider":{"type":"string"},"providerName":{"type":"string"},"status":{"type":"string","description":"Connection status"},"supported":{"type":"boolean","description":"The provider API can list its domains. When false, nothing can be checked there."},"error":{"type":["string","null"],"description":"The provider refused the list (for example a key without domain access)."},"domains":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"providerDomainId":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed"]},"inWorkspace":{"type":"boolean"}},"required":["name","providerDomainId","status","inWorkspace"]}}},"required":["connectionId","name","provider","providerName","status","supported","error","domains"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains/{id}":{"get":{"operationId":"getDomain","tags":["Senders & domains"],"summary":"Get a domain and its merged DNS plan","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["domain"]},"name":{"type":"string"},"status":{"type":"string","enum":["pending","partial","verified","failed"]},"dnsProvider":{"type":["string","null"]},"inbound":{"type":"object","properties":{"mode":{"type":"string","enum":["none","builtin","cloudflare","provider"]},"connectionId":{"type":"string"}},"required":["mode"]},"registrations":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed","unsupported"]},"error":{"type":["string","null"]},"errorCode":{"type":["string","null"]}},"required":["connectionId","provider","status","error"]}},"dnsPlan":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["TXT","CNAME","MX","A"]},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":"number"},"ttl":{"type":"number"},"purpose":{"type":"string"},"providers":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["pending","ok","mismatch","missing"]},"note":{"type":"string"}},"required":["type","name","value","purpose","providers"]}},"ownership":{"type":"object","properties":{"status":{"type":"string","enum":["pending","verified"]},"record":{"type":"object","properties":{"type":{"type":"string","enum":["TXT"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]}},"required":["status","record"]},"dnsHost":{"type":["object","null"],"properties":{"host":{"type":"string"},"detected":{"type":"string"},"name":{"type":"string"},"confidence":{"type":"string","enum":["high","medium","low","none"]},"nameservers":{"type":"array","items":{"type":"string"}},"automatic":{"type":"boolean"},"zone":{"type":["string","null"]},"override":{"type":["string","null"]},"detectedAt":{"type":"string"},"connectionId":{"type":["string","null"]}},"required":["host","detected","name","confidence","nameservers","automatic","zone","override","detectedAt","connectionId"]},"receiving":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","no_mx","spf_missing","mixed","unknown_host","lookup_failed"]},"hosts":{"type":"array","items":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"}},"required":["id","name"]}},"choice":{"type":["string","null"],"enum":["forward","mailbox","existing","skip",null]},"hostId":{"type":["string","null"]},"checkedAt":{"type":["string","null"]}},"required":["status","hosts","choice","hostId","checkedAt"]},"tracking":{"type":"object","properties":{"opens":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"clicks":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"customDomain":{"type":["string","null"],"description":"Tracking subdomain, for example links.acme.com. Add its CNAME record (in `record`)."},"customDomainStatus":{"type":["string","null"],"enum":["pending","verified","missing","mismatch",null],"description":"The last DNS check of the CNAME record. Links use the custom domain only when `verified`."},"record":{"type":["object","null"],"properties":{"type":{"type":"string","enum":["CNAME"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]},"effective":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"host":{"type":"string"}},"required":["opens","clicks","host"],"description":"What email from this domain gets now, after the workspace defaults are applied."}},"required":["opens","clicks","customDomain","customDomainStatus","record","effective"]},"routing":{"type":"object","properties":{"allowedConnections":{"type":["array","null"],"items":{"type":"string"},"description":"null: every provider where the domain is verified (automatic). A list: only these."},"connections":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","description":"Connection status (active, paused, error)."},"allowed":{"type":"boolean"},"registration":{"type":["string","null"],"enum":["pending","verified","failed","unsupported",null],"description":"The domain at this provider. null: not set up there."},"needsVerification":{"type":"boolean","description":"The provider verifies each sending domain. SMTP servers, for example, do not."},"canSend":{"type":"boolean","description":"Allowed, and verified (or no verification needed)."},"reason":{"type":["string","null"],"enum":["not_allowed","not_registered","pending","failed",null]}},"required":["connectionId","name","provider","status","allowed","registration","needsVerification","canSend","reason"]}}},"required":["allowedConnections","connections"]},"warnings":{"type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","status","dnsProvider","inbound","registrations","dnsPlan","warnings","lastCheckedAt","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateDomain","tags":["Senders & domains"],"summary":"Update a domain: tracking and allowed sending providers","description":"`tracking`: open and click tracking for email sent from this domain (`true`, `false`, or `null` for the workspace default) and an optional custom tracking subdomain such as `links.acme.com`. Precedence: the email's own `tracking` wins, then the domain, then the workspace defaults (PATCH /v1/workspace). The custom subdomain must be under this domain; its CNAME record joins the DNS plan and tracked links use it once the record is found (until then the default tracking host is used). `allowedConnections`: the sending providers that may send for this domain (`null`: every provider where the domain is verified). The router never picks a provider where the domain is not verified, and never one outside this list. Listed providers that do not have the domain yet get it set up.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tracking":{"type":"object","properties":{"opens":{"type":["boolean","null"],"description":"Open tracking for email from this domain. null: use the workspace default."},"clicks":{"type":["boolean","null"],"description":"Click tracking for email from this domain. null: use the workspace default."},"customDomain":{"type":["string","null"],"maxLength":253,"description":"Tracking subdomain of this domain, for example links.acme.com. null or \"\" removes it."}}},"allowedConnections":{"type":["array","null"],"items":{"type":"string"},"maxItems":100,"description":"Connections allowed to send for this domain. null: automatic (every provider where the domain is verified). The domain is set up on listed providers that do not have it yet."}},"example":{"tracking":{"opens":true,"clicks":true,"customDomain":"links.acme.com"},"allowedConnections":["con_resend","con_ses"]}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["domain"]},"name":{"type":"string"},"status":{"type":"string","enum":["pending","partial","verified","failed"]},"dnsProvider":{"type":["string","null"]},"inbound":{"type":"object","properties":{"mode":{"type":"string","enum":["none","builtin","cloudflare","provider"]},"connectionId":{"type":"string"}},"required":["mode"]},"registrations":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed","unsupported"]},"error":{"type":["string","null"]},"errorCode":{"type":["string","null"]}},"required":["connectionId","provider","status","error"]}},"dnsPlan":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["TXT","CNAME","MX","A"]},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":"number"},"ttl":{"type":"number"},"purpose":{"type":"string"},"providers":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["pending","ok","mismatch","missing"]},"note":{"type":"string"}},"required":["type","name","value","purpose","providers"]}},"ownership":{"type":"object","properties":{"status":{"type":"string","enum":["pending","verified"]},"record":{"type":"object","properties":{"type":{"type":"string","enum":["TXT"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]}},"required":["status","record"]},"dnsHost":{"type":["object","null"],"properties":{"host":{"type":"string"},"detected":{"type":"string"},"name":{"type":"string"},"confidence":{"type":"string","enum":["high","medium","low","none"]},"nameservers":{"type":"array","items":{"type":"string"}},"automatic":{"type":"boolean"},"zone":{"type":["string","null"]},"override":{"type":["string","null"]},"detectedAt":{"type":"string"},"connectionId":{"type":["string","null"]}},"required":["host","detected","name","confidence","nameservers","automatic","zone","override","detectedAt","connectionId"]},"receiving":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","no_mx","spf_missing","mixed","unknown_host","lookup_failed"]},"hosts":{"type":"array","items":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"}},"required":["id","name"]}},"choice":{"type":["string","null"],"enum":["forward","mailbox","existing","skip",null]},"hostId":{"type":["string","null"]},"checkedAt":{"type":["string","null"]}},"required":["status","hosts","choice","hostId","checkedAt"]},"tracking":{"type":"object","properties":{"opens":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"clicks":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"customDomain":{"type":["string","null"],"description":"Tracking subdomain, for example links.acme.com. Add its CNAME record (in `record`)."},"customDomainStatus":{"type":["string","null"],"enum":["pending","verified","missing","mismatch",null],"description":"The last DNS check of the CNAME record. Links use the custom domain only when `verified`."},"record":{"type":["object","null"],"properties":{"type":{"type":"string","enum":["CNAME"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]},"effective":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"host":{"type":"string"}},"required":["opens","clicks","host"],"description":"What email from this domain gets now, after the workspace defaults are applied."}},"required":["opens","clicks","customDomain","customDomainStatus","record","effective"]},"routing":{"type":"object","properties":{"allowedConnections":{"type":["array","null"],"items":{"type":"string"},"description":"null: every provider where the domain is verified (automatic). A list: only these."},"connections":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","description":"Connection status (active, paused, error)."},"allowed":{"type":"boolean"},"registration":{"type":["string","null"],"enum":["pending","verified","failed","unsupported",null],"description":"The domain at this provider. null: not set up there."},"needsVerification":{"type":"boolean","description":"The provider verifies each sending domain. SMTP servers, for example, do not."},"canSend":{"type":"boolean","description":"Allowed, and verified (or no verification needed)."},"reason":{"type":["string","null"],"enum":["not_allowed","not_registered","pending","failed",null]}},"required":["connectionId","name","provider","status","allowed","registration","needsVerification","canSend","reason"]}}},"required":["allowedConnections","connections"]},"warnings":{"type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","status","dnsProvider","inbound","registrations","dnsPlan","warnings","lastCheckedAt","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteDomain","tags":["Senders & domains"],"summary":"Remove a domain from OneSend","description":"Provider-side domains are left in place.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains/{id}/verify":{"post":{"operationId":"verifyDomain","tags":["Senders & domains"],"summary":"Re-check verification on every provider and DNS","description":"Also registers the domain on providers connected after it was added.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["domain"]},"name":{"type":"string"},"status":{"type":"string","enum":["pending","partial","verified","failed"]},"dnsProvider":{"type":["string","null"]},"inbound":{"type":"object","properties":{"mode":{"type":"string","enum":["none","builtin","cloudflare","provider"]},"connectionId":{"type":"string"}},"required":["mode"]},"registrations":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed","unsupported"]},"error":{"type":["string","null"]},"errorCode":{"type":["string","null"]}},"required":["connectionId","provider","status","error"]}},"dnsPlan":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["TXT","CNAME","MX","A"]},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":"number"},"ttl":{"type":"number"},"purpose":{"type":"string"},"providers":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["pending","ok","mismatch","missing"]},"note":{"type":"string"}},"required":["type","name","value","purpose","providers"]}},"ownership":{"type":"object","properties":{"status":{"type":"string","enum":["pending","verified"]},"record":{"type":"object","properties":{"type":{"type":"string","enum":["TXT"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]}},"required":["status","record"]},"dnsHost":{"type":["object","null"],"properties":{"host":{"type":"string"},"detected":{"type":"string"},"name":{"type":"string"},"confidence":{"type":"string","enum":["high","medium","low","none"]},"nameservers":{"type":"array","items":{"type":"string"}},"automatic":{"type":"boolean"},"zone":{"type":["string","null"]},"override":{"type":["string","null"]},"detectedAt":{"type":"string"},"connectionId":{"type":["string","null"]}},"required":["host","detected","name","confidence","nameservers","automatic","zone","override","detectedAt","connectionId"]},"receiving":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","no_mx","spf_missing","mixed","unknown_host","lookup_failed"]},"hosts":{"type":"array","items":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"}},"required":["id","name"]}},"choice":{"type":["string","null"],"enum":["forward","mailbox","existing","skip",null]},"hostId":{"type":["string","null"]},"checkedAt":{"type":["string","null"]}},"required":["status","hosts","choice","hostId","checkedAt"]},"tracking":{"type":"object","properties":{"opens":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"clicks":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"customDomain":{"type":["string","null"],"description":"Tracking subdomain, for example links.acme.com. Add its CNAME record (in `record`)."},"customDomainStatus":{"type":["string","null"],"enum":["pending","verified","missing","mismatch",null],"description":"The last DNS check of the CNAME record. Links use the custom domain only when `verified`."},"record":{"type":["object","null"],"properties":{"type":{"type":"string","enum":["CNAME"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]},"effective":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"host":{"type":"string"}},"required":["opens","clicks","host"],"description":"What email from this domain gets now, after the workspace defaults are applied."}},"required":["opens","clicks","customDomain","customDomainStatus","record","effective"]},"routing":{"type":"object","properties":{"allowedConnections":{"type":["array","null"],"items":{"type":"string"},"description":"null: every provider where the domain is verified (automatic). A list: only these."},"connections":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","description":"Connection status (active, paused, error)."},"allowed":{"type":"boolean"},"registration":{"type":["string","null"],"enum":["pending","verified","failed","unsupported",null],"description":"The domain at this provider. null: not set up there."},"needsVerification":{"type":"boolean","description":"The provider verifies each sending domain. SMTP servers, for example, do not."},"canSend":{"type":"boolean","description":"Allowed, and verified (or no verification needed)."},"reason":{"type":["string","null"],"enum":["not_allowed","not_registered","pending","failed",null]}},"required":["connectionId","name","provider","status","allowed","registration","needsVerification","canSend","reason"]}}},"required":["allowedConnections","connections"]},"warnings":{"type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","status","dnsProvider","inbound","registrations","dnsPlan","warnings","lastCheckedAt","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains/{id}/apply-dns":{"post":{"operationId":"applyDomainDns","tags":["Senders & domains"],"summary":"Write the DNS plan through the DNS host connection","description":"Earlier form of POST /v1/domains/{id}/dns-apply (no plan check). Works with any DNS host connection and with a Cloudflare sending provider.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dnsConnectionId":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"action":{"type":"string"},"error":{"type":["string","null"]}},"required":["name","type","action","error"]}},"domain":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["domain"]},"name":{"type":"string"},"status":{"type":"string","enum":["pending","partial","verified","failed"]},"dnsProvider":{"type":["string","null"]},"inbound":{"type":"object","properties":{"mode":{"type":"string","enum":["none","builtin","cloudflare","provider"]},"connectionId":{"type":"string"}},"required":["mode"]},"registrations":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed","unsupported"]},"error":{"type":["string","null"]},"errorCode":{"type":["string","null"]}},"required":["connectionId","provider","status","error"]}},"dnsPlan":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["TXT","CNAME","MX","A"]},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":"number"},"ttl":{"type":"number"},"purpose":{"type":"string"},"providers":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["pending","ok","mismatch","missing"]},"note":{"type":"string"}},"required":["type","name","value","purpose","providers"]}},"ownership":{"type":"object","properties":{"status":{"type":"string","enum":["pending","verified"]},"record":{"type":"object","properties":{"type":{"type":"string","enum":["TXT"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]}},"required":["status","record"]},"dnsHost":{"type":["object","null"],"properties":{"host":{"type":"string"},"detected":{"type":"string"},"name":{"type":"string"},"confidence":{"type":"string","enum":["high","medium","low","none"]},"nameservers":{"type":"array","items":{"type":"string"}},"automatic":{"type":"boolean"},"zone":{"type":["string","null"]},"override":{"type":["string","null"]},"detectedAt":{"type":"string"},"connectionId":{"type":["string","null"]}},"required":["host","detected","name","confidence","nameservers","automatic","zone","override","detectedAt","connectionId"]},"receiving":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","no_mx","spf_missing","mixed","unknown_host","lookup_failed"]},"hosts":{"type":"array","items":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"}},"required":["id","name"]}},"choice":{"type":["string","null"],"enum":["forward","mailbox","existing","skip",null]},"hostId":{"type":["string","null"]},"checkedAt":{"type":["string","null"]}},"required":["status","hosts","choice","hostId","checkedAt"]},"tracking":{"type":"object","properties":{"opens":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"clicks":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"customDomain":{"type":["string","null"],"description":"Tracking subdomain, for example links.acme.com. Add its CNAME record (in `record`)."},"customDomainStatus":{"type":["string","null"],"enum":["pending","verified","missing","mismatch",null],"description":"The last DNS check of the CNAME record. Links use the custom domain only when `verified`."},"record":{"type":["object","null"],"properties":{"type":{"type":"string","enum":["CNAME"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]},"effective":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"host":{"type":"string"}},"required":["opens","clicks","host"],"description":"What email from this domain gets now, after the workspace defaults are applied."}},"required":["opens","clicks","customDomain","customDomainStatus","record","effective"]},"routing":{"type":"object","properties":{"allowedConnections":{"type":["array","null"],"items":{"type":"string"},"description":"null: every provider where the domain is verified (automatic). A list: only these."},"connections":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","description":"Connection status (active, paused, error)."},"allowed":{"type":"boolean"},"registration":{"type":["string","null"],"enum":["pending","verified","failed","unsupported",null],"description":"The domain at this provider. null: not set up there."},"needsVerification":{"type":"boolean","description":"The provider verifies each sending domain. SMTP servers, for example, do not."},"canSend":{"type":"boolean","description":"Allowed, and verified (or no verification needed)."},"reason":{"type":["string","null"],"enum":["not_allowed","not_registered","pending","failed",null]}},"required":["connectionId","name","provider","status","allowed","registration","needsVerification","canSend","reason"]}}},"required":["allowedConnections","connections"]},"warnings":{"type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","status","dnsProvider","inbound","registrations","dnsPlan","warnings","lastCheckedAt","createdAt"]}},"required":["results","domain"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains/{id}/zone":{"get":{"operationId":"getDomainZone","tags":["Senders & domains"],"summary":"Export the DNS plan as a BIND zone file (text/plain)","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/dns-hosts":{"get":{"operationId":"listDnsHosts","tags":["DNS hosts"],"summary":"DNS host catalog","description":"Every DNS host OneSend knows: `automatic` hosts have a connector that writes records with your API token; the others get step-by-step instructions. `guide` says how that host wants names and values typed.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"automatic":{"type":"boolean"},"stability":{"type":["string","null"],"enum":["stable","beta",null]},"betaReason":{"type":["string","null"]},"website":{"type":["string","null"]},"docsUrl":{"type":["string","null"]},"tokenUrl":{"type":["string","null"]},"credentials":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string"},"required":{"type":"boolean"},"placeholder":{"type":"string"},"help":{"type":"string"},"secret":{"type":"boolean"}},"required":["key","label","type"]}},"help":{"type":["object","null"],"properties":{"where":{"type":"string"},"permission":{"type":"string"},"notes":{"type":"array","items":{"type":"string"}}},"required":["where","permission","notes"]},"guide":{"type":"object","properties":{"nameField":{"type":"string","enum":["relative","fqdn","fqdn-dot"]},"apex":{"type":"string"},"txtQuotes":{"type":"string","enum":["none","required"]},"longTxt":{"type":"string","enum":["whole","split"]},"mxPriority":{"type":"string","enum":["field","in-value"]},"ttl":{"type":"string"},"dnsPage":{"type":"string"},"steps":{"type":"array","items":{"type":"string"}},"docsUrl":{"type":["string","null"]}},"required":["nameField","apex","txtQuotes","longTxt","mxPriority","ttl","dnsPage","steps","docsUrl"]}},"required":["id","name","automatic","stability","betaReason","website","docsUrl","tokenUrl","credentials","help","guide"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/dns-hosts/detect":{"get":{"operationId":"getDnsHostDetect","tags":["DNS hosts"],"summary":"Detect the DNS host of a domain","description":"Looks up the NS records (DNS-over-HTTPS; a subdomain uses its parent zone) and matches them against known DNS hosts. Works for any domain.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","minLength":3,"maxLength":253},"required":true,"name":"domain","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string"},"host":{"type":"string"},"name":{"type":"string"},"confidence":{"type":"string","enum":["high","medium","low","none"]},"nameservers":{"type":"array","items":{"type":"string"}},"automatic":{"type":"boolean"},"zone":{"type":["string","null"]},"note":{"type":["string","null"]},"connectionId":{"type":["string","null"]},"detectedAt":{"type":"string"}},"required":["domain","host","name","confidence","nameservers","automatic","zone","note","connectionId","detectedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/dns-hosts/connections":{"get":{"operationId":"listDnsHostConnections","tags":["DNS hosts"],"summary":"List DNS host connections","description":"Tokens are never returned; `keyHint` shows the last characters.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["dns_host_connection"]},"host":{"type":"string"},"name":{"type":"string"},"keyHint":{"type":["string","null"]},"config":{"type":"object","additionalProperties":{"type":"string"}},"status":{"type":"string","enum":["untested","ok","error"]},"lastError":{"type":["string","null"]},"lastTestedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","host","name","keyHint","config","status","lastError","lastTestedAt","createdAt","updatedAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createDnsHostConnection","tags":["DNS hosts"],"summary":"Connect a DNS host","description":"Stores the API token (encrypted at rest) so OneSend can write DNS records. The `credentials` keys are the host's fields from GET /v1/dns-hosts.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"host":{"type":"string","minLength":1,"maxLength":40},"name":{"type":"string","minLength":1,"maxLength":80},"credentials":{"type":"object","additionalProperties":{"type":"string","maxLength":4096}}},"required":["host","credentials"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["dns_host_connection"]},"host":{"type":"string"},"name":{"type":"string"},"keyHint":{"type":["string","null"]},"config":{"type":"object","additionalProperties":{"type":"string"}},"status":{"type":"string","enum":["untested","ok","error"]},"lastError":{"type":["string","null"]},"lastTestedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","host","name","keyHint","config","status","lastError","lastTestedAt","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/dns-hosts/connections/{id}":{"get":{"operationId":"getDnsHostConnection","tags":["DNS hosts"],"summary":"Get a DNS host connection","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["dns_host_connection"]},"host":{"type":"string"},"name":{"type":"string"},"keyHint":{"type":["string","null"]},"config":{"type":"object","additionalProperties":{"type":"string"}},"status":{"type":"string","enum":["untested","ok","error"]},"lastError":{"type":["string","null"]},"lastTestedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","host","name","keyHint","config","status","lastError","lastTestedAt","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateDnsHostConnection","tags":["DNS hosts"],"summary":"Update a DNS host connection","description":"Rename it or replace credential fields (omitted fields are kept).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"credentials":{"type":"object","additionalProperties":{"type":"string","maxLength":4096}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["dns_host_connection"]},"host":{"type":"string"},"name":{"type":"string"},"keyHint":{"type":["string","null"]},"config":{"type":"object","additionalProperties":{"type":"string"}},"status":{"type":"string","enum":["untested","ok","error"]},"lastError":{"type":["string","null"]},"lastTestedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","host","name","keyHint","config","status","lastError","lastTestedAt","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteDnsHostConnection","tags":["DNS hosts"],"summary":"Delete a DNS host connection","description":"The stored token is deleted. DNS records at the host are not changed.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/dns-hosts/connections/{id}/test":{"post":{"operationId":"testDnsHostConnection","tags":["DNS hosts"],"summary":"Test a DNS host connection","description":"Calls the host API with the stored token. Changes nothing.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"account":{"type":["string","null"]},"zones":{"type":["number","null"]},"note":{"type":["string","null"]},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["ok","account","zones","note","error"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains/{id}/dns-setup":{"get":{"operationId":"getDomainDnsSetup","tags":["Senders & domains"],"summary":"DNS setup instructions for the domain's DNS host","description":"The detected DNS host, its steps, and every record formatted exactly as that host's form wants it (name as `@`, relative or full; quotes; MX priority field). `host` shows the instructions for another host; `refresh=true` looks up the nameservers again.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":40},"required":false,"name":"host","in":"query"},{"schema":{"type":"string","enum":["0","1","true","false"]},"required":false,"name":"refresh","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"domainId":{"type":"string"},"domain":{"type":"string"},"detection":{"type":"object","properties":{"domain":{"type":"string"},"host":{"type":"string"},"name":{"type":"string"},"confidence":{"type":"string","enum":["high","medium","low","none"]},"nameservers":{"type":"array","items":{"type":"string"}},"automatic":{"type":"boolean"},"zone":{"type":["string","null"]},"note":{"type":["string","null"]},"connectionId":{"type":["string","null"]},"detectedAt":{"type":"string"}},"required":["domain","host","name","confidence","nameservers","automatic","zone","note","connectionId","detectedAt"]},"host":{"type":"string"},"hostName":{"type":"string"},"automatic":{"type":"boolean"},"guide":{"type":"object","properties":{"nameField":{"type":"string","enum":["relative","fqdn","fqdn-dot"]},"apex":{"type":"string"},"txtQuotes":{"type":"string","enum":["none","required"]},"longTxt":{"type":"string","enum":["whole","split"]},"mxPriority":{"type":"string","enum":["field","in-value"]},"ttl":{"type":"string"},"dnsPage":{"type":"string"},"steps":{"type":"array","items":{"type":"string"}},"docsUrl":{"type":["string","null"]}},"required":["nameField","apex","txtQuotes","longTxt","mxPriority","ttl","dnsPage","steps","docsUrl"]},"connection":{"type":["object","null"],"properties":{"id":{"type":"string"},"object":{"type":"string","enum":["dns_host_connection"]},"host":{"type":"string"},"name":{"type":"string"},"keyHint":{"type":["string","null"]},"config":{"type":"object","additionalProperties":{"type":"string"}},"status":{"type":"string","enum":["untested","ok","error"]},"lastError":{"type":["string","null"]},"lastTestedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","host","name","keyHint","config","status","lastError","lastTestedAt","createdAt","updatedAt"]},"records":{"type":"array","items":{"type":"object","properties":{"purpose":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":["number","null"]},"status":{"type":["string","null"]},"note":{"type":["string","null"]},"formatted":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"nameHint":{"type":"string"},"fqdn":{"type":"string"},"value":{"type":"string"},"priority":{"type":["number","null"]},"ttl":{"type":"string"},"notes":{"type":"array","items":{"type":"string"}}},"required":["type","name","nameHint","fqdn","value","priority","ttl","notes"]}},"required":["purpose","type","name","value","priority","status","note","formatted"]}},"copyText":{"type":"string"}},"required":["domainId","domain","detection","host","hostName","automatic","guide","connection","records","copyText"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains/{id}/dns-host":{"patch":{"operationId":"dnsDomainHost","tags":["Senders & domains"],"summary":"Choose the DNS host or connection for a domain","description":"`host` overrides detection for the instructions (null = detected host). `dnsHostConnectionId` chooses the connection that writes records (null = none).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"host":{"type":["string","null"],"maxLength":40},"dnsHostConnectionId":{"type":["string","null"]}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["domain"]},"name":{"type":"string"},"status":{"type":"string","enum":["pending","partial","verified","failed"]},"dnsProvider":{"type":["string","null"]},"inbound":{"type":"object","properties":{"mode":{"type":"string","enum":["none","builtin","cloudflare","provider"]},"connectionId":{"type":"string"}},"required":["mode"]},"registrations":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed","unsupported"]},"error":{"type":["string","null"]},"errorCode":{"type":["string","null"]}},"required":["connectionId","provider","status","error"]}},"dnsPlan":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["TXT","CNAME","MX","A"]},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":"number"},"ttl":{"type":"number"},"purpose":{"type":"string"},"providers":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["pending","ok","mismatch","missing"]},"note":{"type":"string"}},"required":["type","name","value","purpose","providers"]}},"ownership":{"type":"object","properties":{"status":{"type":"string","enum":["pending","verified"]},"record":{"type":"object","properties":{"type":{"type":"string","enum":["TXT"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]}},"required":["status","record"]},"dnsHost":{"type":["object","null"],"properties":{"host":{"type":"string"},"detected":{"type":"string"},"name":{"type":"string"},"confidence":{"type":"string","enum":["high","medium","low","none"]},"nameservers":{"type":"array","items":{"type":"string"}},"automatic":{"type":"boolean"},"zone":{"type":["string","null"]},"override":{"type":["string","null"]},"detectedAt":{"type":"string"},"connectionId":{"type":["string","null"]}},"required":["host","detected","name","confidence","nameservers","automatic","zone","override","detectedAt","connectionId"]},"receiving":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","no_mx","spf_missing","mixed","unknown_host","lookup_failed"]},"hosts":{"type":"array","items":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"}},"required":["id","name"]}},"choice":{"type":["string","null"],"enum":["forward","mailbox","existing","skip",null]},"hostId":{"type":["string","null"]},"checkedAt":{"type":["string","null"]}},"required":["status","hosts","choice","hostId","checkedAt"]},"tracking":{"type":"object","properties":{"opens":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"clicks":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"customDomain":{"type":["string","null"],"description":"Tracking subdomain, for example links.acme.com. Add its CNAME record (in `record`)."},"customDomainStatus":{"type":["string","null"],"enum":["pending","verified","missing","mismatch",null],"description":"The last DNS check of the CNAME record. Links use the custom domain only when `verified`."},"record":{"type":["object","null"],"properties":{"type":{"type":"string","enum":["CNAME"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]},"effective":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"host":{"type":"string"}},"required":["opens","clicks","host"],"description":"What email from this domain gets now, after the workspace defaults are applied."}},"required":["opens","clicks","customDomain","customDomainStatus","record","effective"]},"routing":{"type":"object","properties":{"allowedConnections":{"type":["array","null"],"items":{"type":"string"},"description":"null: every provider where the domain is verified (automatic). A list: only these."},"connections":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","description":"Connection status (active, paused, error)."},"allowed":{"type":"boolean"},"registration":{"type":["string","null"],"enum":["pending","verified","failed","unsupported",null],"description":"The domain at this provider. null: not set up there."},"needsVerification":{"type":"boolean","description":"The provider verifies each sending domain. SMTP servers, for example, do not."},"canSend":{"type":"boolean","description":"Allowed, and verified (or no verification needed)."},"reason":{"type":["string","null"],"enum":["not_allowed","not_registered","pending","failed",null]}},"required":["connectionId","name","provider","status","allowed","registration","needsVerification","canSend","reason"]}}},"required":["allowedConnections","connections"]},"warnings":{"type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","status","dnsProvider","inbound","registrations","dnsPlan","warnings","lastCheckedAt","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains/{id}/dns-plan":{"post":{"operationId":"dnsDomainPlan","tags":["Senders & domains"],"summary":"Preview DNS changes (dry run)","description":"Reads the zone at the DNS host and shows, per record, whether it would be created, updated (SPF is merged into the existing record, never duplicated), left unchanged, replaced (`replace`: a DKIM key or return-path record of the provider holds another value, most likely from another account at that provider; only written when chosen on apply) or is a conflict that is not written. Changes nothing.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dnsHostConnectionId":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"domainId":{"type":"string"},"connectionId":{"type":"string"},"host":{"type":"string"},"zone":{"type":"string"},"items":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string","enum":["create","update","unchanged","replace","conflict"]},"purpose":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":["number","null"]},"current":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":["number","null"]}},"required":["type","name","value","priority"]}},"reason":{"type":"string"},"warning":{"type":["string","null"]}},"required":["action","purpose","type","name","value","priority","current","reason","warning"]}},"counts":{"type":"object","properties":{"create":{"type":"number"},"update":{"type":"number"},"unchanged":{"type":"number"},"replace":{"type":"number"},"conflict":{"type":"number"}},"required":["create","update","unchanged","replace","conflict"]},"planId":{"type":"string"}},"required":["domainId","connectionId","host","zone","items","counts","planId"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains/{id}/dns-apply":{"post":{"operationId":"dnsDomainApply","tags":["Senders & domains"],"summary":"Apply DNS changes","description":"Writes the create and update items of the plan through the DNS host connection. Pass the `planId` from POST /dns-plan: if the zone changed in between, nothing is written (409 `plan_changed`). Conflicts are never written. `replace` items are written only when listed in `replace` (otherwise the existing record, and the setup that uses it, is kept). The response lists the previous values (and the host snapshot, where the host keeps one) so a change can be undone.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dnsHostConnectionId":{"type":"string"},"planId":{"type":"string"},"replace":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","maxLength":10},"name":{"type":"string","maxLength":253}},"required":["type","name"]},"maxItems":50}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"action":{"type":"string"},"status":{"type":"string","enum":["applied","skipped","failed"]},"error":{"type":["string","null"]}},"required":["type","name","action","status","error"]}},"backup":{"type":"object","properties":{"note":{"type":["string","null"]},"snapshotId":{"type":["string","null"]},"records":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":["number","null"]}},"required":["type","name","value","priority"]}}},"required":["note","snapshotId","records"]},"domain":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["domain"]},"name":{"type":"string"},"status":{"type":"string","enum":["pending","partial","verified","failed"]},"dnsProvider":{"type":["string","null"]},"inbound":{"type":"object","properties":{"mode":{"type":"string","enum":["none","builtin","cloudflare","provider"]},"connectionId":{"type":"string"}},"required":["mode"]},"registrations":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed","unsupported"]},"error":{"type":["string","null"]},"errorCode":{"type":["string","null"]}},"required":["connectionId","provider","status","error"]}},"dnsPlan":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["TXT","CNAME","MX","A"]},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":"number"},"ttl":{"type":"number"},"purpose":{"type":"string"},"providers":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["pending","ok","mismatch","missing"]},"note":{"type":"string"}},"required":["type","name","value","purpose","providers"]}},"ownership":{"type":"object","properties":{"status":{"type":"string","enum":["pending","verified"]},"record":{"type":"object","properties":{"type":{"type":"string","enum":["TXT"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]}},"required":["status","record"]},"dnsHost":{"type":["object","null"],"properties":{"host":{"type":"string"},"detected":{"type":"string"},"name":{"type":"string"},"confidence":{"type":"string","enum":["high","medium","low","none"]},"nameservers":{"type":"array","items":{"type":"string"}},"automatic":{"type":"boolean"},"zone":{"type":["string","null"]},"override":{"type":["string","null"]},"detectedAt":{"type":"string"},"connectionId":{"type":["string","null"]}},"required":["host","detected","name","confidence","nameservers","automatic","zone","override","detectedAt","connectionId"]},"receiving":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","no_mx","spf_missing","mixed","unknown_host","lookup_failed"]},"hosts":{"type":"array","items":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"}},"required":["id","name"]}},"choice":{"type":["string","null"],"enum":["forward","mailbox","existing","skip",null]},"hostId":{"type":["string","null"]},"checkedAt":{"type":["string","null"]}},"required":["status","hosts","choice","hostId","checkedAt"]},"tracking":{"type":"object","properties":{"opens":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"clicks":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"customDomain":{"type":["string","null"],"description":"Tracking subdomain, for example links.acme.com. Add its CNAME record (in `record`)."},"customDomainStatus":{"type":["string","null"],"enum":["pending","verified","missing","mismatch",null],"description":"The last DNS check of the CNAME record. Links use the custom domain only when `verified`."},"record":{"type":["object","null"],"properties":{"type":{"type":"string","enum":["CNAME"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]},"effective":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"host":{"type":"string"}},"required":["opens","clicks","host"],"description":"What email from this domain gets now, after the workspace defaults are applied."}},"required":["opens","clicks","customDomain","customDomainStatus","record","effective"]},"routing":{"type":"object","properties":{"allowedConnections":{"type":["array","null"],"items":{"type":"string"},"description":"null: every provider where the domain is verified (automatic). A list: only these."},"connections":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","description":"Connection status (active, paused, error)."},"allowed":{"type":"boolean"},"registration":{"type":["string","null"],"enum":["pending","verified","failed","unsupported",null],"description":"The domain at this provider. null: not set up there."},"needsVerification":{"type":"boolean","description":"The provider verifies each sending domain. SMTP servers, for example, do not."},"canSend":{"type":"boolean","description":"Allowed, and verified (or no verification needed)."},"reason":{"type":["string","null"],"enum":["not_allowed","not_registered","pending","failed",null]}},"required":["connectionId","name","provider","status","allowed","registration","needsVerification","canSend","reason"]}}},"required":["allowedConnections","connections"]},"warnings":{"type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","status","dnsProvider","inbound","registrations","dnsPlan","warnings","lastCheckedAt","createdAt"]}},"required":["results","backup","domain"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains/{id}/diagnostics":{"get":{"operationId":"listDomainDiagnostics","tags":["Senders & domains"],"summary":"Diagnose the DNS records","description":"Per record: found, missing, wrong value or propagating, with the likely mistake and how to fix it (domain typed twice, extra quotes, two SPF records, SPF missing an include, DKIM cut short, CNAME conflicts, MX priority, duplicate DMARC, record on the wrong name). Results are cached for a minute; `fresh=true` checks again.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["0","1","true","false"]},"required":false,"name":"fresh","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"domainId":{"type":"string"},"domain":{"type":"string"},"checkedAt":{"type":"string"},"cached":{"type":"boolean"},"summary":{"type":"object","properties":{"found":{"type":"number"},"missing":{"type":"number"},"wrong_value":{"type":"number"},"propagating":{"type":"number"},"unknown":{"type":"number"}},"required":["found","missing","wrong_value","propagating","unknown"]},"records":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":["number","null"]},"purpose":{"type":"string"},"status":{"type":"string","enum":["found","missing","wrong_value","propagating","unknown"]},"found":{"type":"array","items":{"type":"string"}},"problems":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string","enum":["error","warning","info"]},"message":{"type":"string"},"fix":{"type":"string"}},"required":["code","severity","message","fix"]}}},"required":["type","name","value","priority","purpose","status","found","problems"]}}},"required":["domainId","domain","checkedAt","cached","summary","records"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/receiving-hosts":{"get":{"operationId":"listReceivingHosts","tags":["Senders & domains"],"summary":"Receiving host catalog","description":"Where mail to your domain can arrive. OneSend does not receive mail for you: the host your MX records point to does. `forwarding` services forward to an inbox you already have (for example Cloudflare Email Routing to Gmail); `mailbox` hosts keep the mailboxes. Each entry has the MX records, the SPF include, other records the host asks for, its setup page and whether it has a free tier. `unverified` hosts have no records here: follow `setupUrl`.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"category":{"type":"string","enum":["forwarding","mailbox"]},"verification":{"type":"string","enum":["verified","unverified"]},"mx":{"type":["array","null"],"items":{"type":"object","properties":{"host":{"type":"string"},"priority":{"type":"number"}},"required":["host","priority"]}},"mxSource":{"type":"string","enum":["fixed","host_console"]},"spfInclude":{"type":["string","null"]},"extraRecords":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["TXT","CNAME"]},"name":{"type":"string"},"value":{"type":["string","null"]},"note":{"type":"string"}},"required":["type","name","value","note"]}},"notes":{"type":"array","items":{"type":"string"}},"setupUrl":{"type":"string"},"sources":{"type":"array","items":{"type":"string"}},"freeTier":{"type":"boolean"},"freeTierNote":{"type":["string","null"]},"requiresDnsHost":{"type":["string","null"]},"applyable":{"type":"boolean"}},"required":["id","name","category","verification","mx","mxSource","spfInclude","extraRecords","notes","setupUrl","sources","freeTier","freeTierNote","requiresDnsHost","applyable"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains/{id}/receiving":{"get":{"operationId":"getDomainReceiving","tags":["Senders & domains"],"summary":"Receiving status and records for a domain","description":"Reads the domain's MX and SPF from public DNS and says where mail arrives: `ok` (one known host, SPF includes it), `no_mx` (mail bounces), `spf_missing` (MX points to a host the SPF record does not include), `mixed` (several hosts), `unknown_host` or `lookup_failed`. `recommendation` has the records for `hostId` (default: the chosen host, else the detected one), typed for the domain's DNS host (`dnsHost` for another), with one SPF record merged from what is published, the sending providers' root SPF and the host's include (nested lookups counted, limit 10). `warnings` say when an MX change would move existing mail. Results are cached for a minute; `fresh=true` checks again.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":60},"required":false,"name":"hostId","in":"query"},{"schema":{"type":"string","maxLength":40},"required":false,"name":"dnsHost","in":"query"},{"schema":{"type":"string","enum":["0","1","true","false"]},"required":false,"name":"fresh","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"domainId":{"type":"string"},"domain":{"type":"string"},"checkedAt":{"type":"string"},"status":{"type":"string","enum":["ok","no_mx","spf_missing","mixed","unknown_host","lookup_failed"]},"nullMx":{"type":"boolean"},"mx":{"type":"array","items":{"type":"object","properties":{"host":{"type":"string"},"priority":{"type":"number"},"hostId":{"type":["string","null"]}},"required":["host","priority","hostId"]}},"hosts":{"type":"array","items":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"},"category":{"type":["string","null"],"enum":["forwarding","mailbox",null]}},"required":["id","name","category"]}},"spf":{"type":"object","properties":{"records":{"type":"number"},"record":{"type":["string","null"]},"includesHost":{"type":["boolean","null"]}},"required":["records","record","includesHost"]},"choice":{"type":"object","properties":{"choice":{"type":["string","null"],"enum":["forward","mailbox","existing","skip",null]},"hostId":{"type":["string","null"]},"updatedAt":{"type":["string","null"]}},"required":["choice","hostId","updatedAt"]},"matchesChoice":{"type":["boolean","null"]},"subdomain":{"type":"boolean"},"recommendation":{"type":["object","null"],"properties":{"hostId":{"type":"string"},"hostName":{"type":"string"},"records":{"type":"array","items":{"type":"object","properties":{"purpose":{"type":"string","enum":["mx","spf","other"]},"type":{"type":"string"},"name":{"type":"string"},"value":{"type":["string","null"]},"priority":{"type":["number","null"]},"note":{"type":["string","null"]},"formatted":{"type":["object","null"],"properties":{"type":{"type":"string"},"name":{"type":"string"},"nameHint":{"type":"string"},"fqdn":{"type":"string"},"value":{"type":"string"},"priority":{"type":["number","null"]},"ttl":{"type":"string"},"notes":{"type":"array","items":{"type":"string"}}},"required":["type","name","nameHint","fqdn","value","priority","ttl","notes"]}},"required":["purpose","type","name","value","priority","note","formatted"]}},"spf":{"type":["object","null"],"properties":{"value":{"type":"string"},"lookups":{"type":"number"},"overLimit":{"type":"boolean"},"changed":{"type":"boolean"}},"required":["value","lookups","overLimit","changed"]},"copyText":{"type":"string"}},"required":["hostId","hostName","records","spf","copyText"]},"dnsHost":{"type":"object","properties":{"host":{"type":"string"},"name":{"type":"string"},"automatic":{"type":"boolean"},"connectionId":{"type":["string","null"]},"guide":{"type":"object","properties":{"nameField":{"type":"string","enum":["relative","fqdn","fqdn-dot"]},"apex":{"type":"string"},"txtQuotes":{"type":"string","enum":["none","required"]},"longTxt":{"type":"string","enum":["whole","split"]},"mxPriority":{"type":"string","enum":["field","in-value"]},"ttl":{"type":"string"},"dnsPage":{"type":"string"},"steps":{"type":"array","items":{"type":"string"}},"docsUrl":{"type":["string","null"]}},"required":["nameField","apex","txtQuotes","longTxt","mxPriority","ttl","dnsPage","steps","docsUrl"]}},"required":["host","name","automatic","connectionId","guide"]},"canApply":{"type":"boolean"},"applyBlockedReason":{"type":["string","null"]},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{"type":"string"}}},"required":["code","message","params"]}}},"required":["domainId","domain","checkedAt","status","nullMx","mx","hosts","spf","choice","matchesChoice","subdomain","recommendation","dnsHost","canApply","applyBlockedReason","warnings"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"receivingDomain","tags":["Senders & domains"],"summary":"Choose where mail to the domain should arrive","description":"`forward` or `mailbox` with a `hostId` of that category, `existing` (already set up: OneSend only checks it), `skip`, or null to clear. Saves the choice only: DNS records are not changed (use POST /v1/domains/{id}/receiving/apply).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"choice":{"type":["string","null"],"enum":["forward","mailbox","existing","skip",null]},"hostId":{"type":["string","null"],"maxLength":60}},"required":["choice"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["domain"]},"name":{"type":"string"},"status":{"type":"string","enum":["pending","partial","verified","failed"]},"dnsProvider":{"type":["string","null"]},"inbound":{"type":"object","properties":{"mode":{"type":"string","enum":["none","builtin","cloudflare","provider"]},"connectionId":{"type":"string"}},"required":["mode"]},"registrations":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed","unsupported"]},"error":{"type":["string","null"]},"errorCode":{"type":["string","null"]}},"required":["connectionId","provider","status","error"]}},"dnsPlan":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["TXT","CNAME","MX","A"]},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":"number"},"ttl":{"type":"number"},"purpose":{"type":"string"},"providers":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["pending","ok","mismatch","missing"]},"note":{"type":"string"}},"required":["type","name","value","purpose","providers"]}},"ownership":{"type":"object","properties":{"status":{"type":"string","enum":["pending","verified"]},"record":{"type":"object","properties":{"type":{"type":"string","enum":["TXT"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]}},"required":["status","record"]},"dnsHost":{"type":["object","null"],"properties":{"host":{"type":"string"},"detected":{"type":"string"},"name":{"type":"string"},"confidence":{"type":"string","enum":["high","medium","low","none"]},"nameservers":{"type":"array","items":{"type":"string"}},"automatic":{"type":"boolean"},"zone":{"type":["string","null"]},"override":{"type":["string","null"]},"detectedAt":{"type":"string"},"connectionId":{"type":["string","null"]}},"required":["host","detected","name","confidence","nameservers","automatic","zone","override","detectedAt","connectionId"]},"receiving":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["ok","no_mx","spf_missing","mixed","unknown_host","lookup_failed"]},"hosts":{"type":"array","items":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"}},"required":["id","name"]}},"choice":{"type":["string","null"],"enum":["forward","mailbox","existing","skip",null]},"hostId":{"type":["string","null"]},"checkedAt":{"type":["string","null"]}},"required":["status","hosts","choice","hostId","checkedAt"]},"tracking":{"type":"object","properties":{"opens":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"clicks":{"type":["boolean","null"],"description":"true or false; null uses the workspace default."},"customDomain":{"type":["string","null"],"description":"Tracking subdomain, for example links.acme.com. Add its CNAME record (in `record`)."},"customDomainStatus":{"type":["string","null"],"enum":["pending","verified","missing","mismatch",null],"description":"The last DNS check of the CNAME record. Links use the custom domain only when `verified`."},"record":{"type":["object","null"],"properties":{"type":{"type":"string","enum":["CNAME"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]},"effective":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"host":{"type":"string"}},"required":["opens","clicks","host"],"description":"What email from this domain gets now, after the workspace defaults are applied."}},"required":["opens","clicks","customDomain","customDomainStatus","record","effective"]},"routing":{"type":"object","properties":{"allowedConnections":{"type":["array","null"],"items":{"type":"string"},"description":"null: every provider where the domain is verified (automatic). A list: only these."},"connections":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","description":"Connection status (active, paused, error)."},"allowed":{"type":"boolean"},"registration":{"type":["string","null"],"enum":["pending","verified","failed","unsupported",null],"description":"The domain at this provider. null: not set up there."},"needsVerification":{"type":"boolean","description":"The provider verifies each sending domain. SMTP servers, for example, do not."},"canSend":{"type":"boolean","description":"Allowed, and verified (or no verification needed)."},"reason":{"type":["string","null"],"enum":["not_allowed","not_registered","pending","failed",null]}},"required":["connectionId","name","provider","status","allowed","registration","needsVerification","canSend","reason"]}}},"required":["allowedConnections","connections"]},"warnings":{"type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","status","dnsProvider","inbound","registrations","dnsPlan","warnings","lastCheckedAt","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/domains/{id}/receiving/apply":{"post":{"operationId":"applyDomainsReceiving","tags":["Senders & domains"],"summary":"Write the receiving host's MX and SPF records (preview, then confirm)","description":"Through the domain's DNS host connection. `mode: preview` (the default) reads the zone and lists what would be created, updated, removed or is a conflict; nothing is written. `mode: confirm` with the preview's `planId` writes it (409 `plan_changed` when the zone changed in between). When mail arrives at another host now, its MX records are only removed with `replaceExisting: true` (otherwise 409 `mx_in_use`); old and new MX records are never left side by side. SPF is merged into the one existing record. Needs the admin role; test-mode keys are refused.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"hostId":{"type":"string","minLength":1,"maxLength":60},"mode":{"type":"string","enum":["preview","confirm"],"default":"preview"},"planId":{"type":"string"},"replaceExisting":{"type":"boolean","default":false},"dnsHostConnectionId":{"type":"string"}},"required":["hostId"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["preview","confirm"]},"domainId":{"type":"string"},"hostId":{"type":"string"},"connectionId":{"type":"string"},"dnsHost":{"type":"string"},"zone":{"type":"string"},"planId":{"type":"string"},"items":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string","enum":["create","update","unchanged","conflict","remove"]},"purpose":{"type":"string","enum":["mx","spf"]},"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":["number","null"]},"current":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":["number","null"]}},"required":["type","name","value","priority"]}},"reason":{"type":"string"},"warning":{"type":["string","null"]}},"required":["action","purpose","type","name","value","priority","current","reason","warning"]}},"counts":{"type":"object","properties":{"create":{"type":"number"},"update":{"type":"number"},"unchanged":{"type":"number"},"conflict":{"type":"number"},"remove":{"type":"number"}},"required":["create","update","unchanged","conflict","remove"]},"existingMx":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":["number","null"]}},"required":["type","name","value","priority"]}},"needsReplaceConfirmation":{"type":"boolean"},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{"type":"string"}}},"required":["code","message","params"]}},"results":{"type":["array","null"],"items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string"},"action":{"type":"string"},"status":{"type":"string","enum":["applied","skipped","failed"]},"error":{"type":["string","null"]}},"required":["type","name","value","action","status","error"]}},"backup":{"type":["object","null"],"properties":{"note":{"type":["string","null"]},"snapshotId":{"type":["string","null"]},"records":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string"},"priority":{"type":["number","null"]}},"required":["type","name","value","priority"]}}},"required":["note","snapshotId","records"]}},"required":["mode","domainId","hostId","connectionId","dnsHost","zone","planId","items","counts","existingMx","needsReplaceConfirmation","warnings","results","backup"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/license":{"get":{"operationId":"getLicense","tags":["License"],"summary":"License status of this server","description":"`email` (who bought the key) is shown only to whoever may change the license (`canManage`): the instance admins (ONESEND_ADMIN_EMAILS), or, when none are configured, the owner of the server's first workspace.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"required":{"type":"boolean","description":"Live email needs an active license key on this server."},"status":{"type":"string","enum":["none","active","expired","revoked","invalid"]},"email":{"type":["string","null"],"description":"Who bought the key."},"last4":{"type":["string","null"]},"validUntil":{"type":["string","null"],"description":"The certificate works offline until then; it is renewed automatically before."},"checkedAt":{"type":["string","null"]},"message":{"type":["string","null"]},"buyUrl":{"type":"string"},"canManage":{"type":"boolean","description":"The caller may change the license (POST, DELETE, refresh, free-other)."}},"required":["required","status","email","last4","validUntil","checkedAt","message","buyUrl"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"license","tags":["License"],"summary":"Activate a license key on this server","description":"Activates the key with the license server for this installation (one key, one installation). Errors from the license server: `invalid_license`, `wrong_product` (a Mac app key), `seat_limit` (the key is active on another installation: remove it there, or free that seat with POST /v1/license/free-other; `details.activations` lists the installations with their ids), `revoked`.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":10,"maxLength":64}},"required":["key"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"required":{"type":"boolean","description":"Live email needs an active license key on this server."},"status":{"type":"string","enum":["none","active","expired","revoked","invalid"]},"email":{"type":["string","null"],"description":"Who bought the key."},"last4":{"type":["string","null"]},"validUntil":{"type":["string","null"],"description":"The certificate works offline until then; it is renewed automatically before."},"checkedAt":{"type":["string","null"]},"message":{"type":["string","null"]},"buyUrl":{"type":"string"},"canManage":{"type":"boolean","description":"The caller may change the license (POST, DELETE, refresh, free-other)."}},"required":["required","status","email","last4","validUntil","checkedAt","message","buyUrl"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteLicense","tags":["License"],"summary":"Free the license key for another installation","description":"Frees the key at the license server and forgets it here (ONESEND_LICENSE_KEY is not activated again on its own). 409 `license_server_unreachable` while the license server cannot be reached: the key is kept, because its seat would stay taken. With `force=true` the key is removed anyway; its seat stays taken until it is freed with POST /v1/license/free-other from the next installation.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"force","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"required":{"type":"boolean","description":"Live email needs an active license key on this server."},"status":{"type":"string","enum":["none","active","expired","revoked","invalid"]},"email":{"type":["string","null"],"description":"Who bought the key."},"last4":{"type":["string","null"]},"validUntil":{"type":["string","null"],"description":"The certificate works offline until then; it is renewed automatically before."},"checkedAt":{"type":["string","null"]},"message":{"type":["string","null"]},"buyUrl":{"type":"string"},"canManage":{"type":"boolean","description":"The caller may change the license (POST, DELETE, refresh, free-other)."}},"required":["required","status","email","last4","validUntil","checkedAt","message","buyUrl"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/license/refresh":{"post":{"operationId":"refreshLicense","tags":["License"],"summary":"Check the license with the license server now","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"required":{"type":"boolean","description":"Live email needs an active license key on this server."},"status":{"type":"string","enum":["none","active","expired","revoked","invalid"]},"email":{"type":["string","null"],"description":"Who bought the key."},"last4":{"type":["string","null"]},"validUntil":{"type":["string","null"],"description":"The certificate works offline until then; it is renewed automatically before."},"checkedAt":{"type":["string","null"]},"message":{"type":["string","null"]},"buyUrl":{"type":"string"},"canManage":{"type":"boolean","description":"The caller may change the license (POST, DELETE, refresh, free-other)."}},"required":["required","status","email","last4","validUntil","checkedAt","message","buyUrl"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/license/free-other":{"post":{"operationId":"freeOtherLicense","tags":["License"],"summary":"Free a seat taken by another installation","description":"For an installation that was lost (or whose key was removed while offline): deactivates that activation of the key at the license server, so this server can activate the key. The activation ids are in the `seat_limit` error of POST /v1/license (`details.activations`). Whoever may change the license, signed in.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":10,"maxLength":64},"activationId":{"type":"string","minLength":1,"maxLength":100}},"required":["key","activationId"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/templates":{"get":{"operationId":"listTemplates","tags":["Templates"],"summary":"List templates","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["template"]},"slug":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["transactional","broadcast"]},"category":{"type":["string","null"]},"currentVersion":{"type":"number"},"publishedVersion":{"type":["number","null"]},"subject":{"type":"string"},"preheader":{"type":["string","null"]},"sourceKind":{"type":"string","enum":["blocks","html"]},"source":{"type":"object","additionalProperties":{}},"variablesSchema":{"type":["object","null"],"additionalProperties":{}},"sampleData":{"type":["object","null"],"additionalProperties":{}},"updatedAt":{"type":"string"}},"required":["id","object","slug","name","type","category","currentVersion","publishedVersion","subject","preheader","sourceKind","source","variablesSchema","sampleData","updatedAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createTemplate","tags":["Templates"],"summary":"Create a template","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","pattern":"^[a-z0-9-]+$","description":"Stable name used in sends (`template: \"welcome\"`). Generated from the name when omitted."},"name":{"type":"string","description":"Display name."},"type":{"type":"string","enum":["transactional","broadcast"],"default":"transactional","description":"`transactional` (data from your app) or `broadcast` (campaigns: filled from contact fields)."},"category":{"type":"string"},"subject":{"type":"string","description":"Subject line with `{{variables}}`."},"preheader":{"type":"string","description":"Preview text."},"sourceKind":{"type":"string","enum":["blocks","html"],"default":"blocks","description":"`blocks` (a template document from the designer) or `html`."},"source":{"type":"object","additionalProperties":{},"description":"A template document (`{ version, theme, blocks }`) or `{ html }`."},"variablesSchema":{"type":"object","additionalProperties":{}},"sampleData":{"type":"object","additionalProperties":{},"description":"Example values for previews and test sends. Never used for real recipients."},"publish":{"type":"boolean","description":"Make this version the one sends use."}},"required":["name","subject","source"],"example":{"name":"Welcome","slug":"welcome","subject":"Welcome, {{name}}","sourceKind":"html","source":{"html":"<p>Hi {{name}}</p>"},"sampleData":{"name":"Ada"},"publish":true}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["template"]},"slug":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["transactional","broadcast"]},"category":{"type":["string","null"]},"currentVersion":{"type":"number"},"publishedVersion":{"type":["number","null"]},"subject":{"type":"string"},"preheader":{"type":["string","null"]},"sourceKind":{"type":"string","enum":["blocks","html"]},"source":{"type":"object","additionalProperties":{}},"variablesSchema":{"type":["object","null"],"additionalProperties":{}},"sampleData":{"type":["object","null"],"additionalProperties":{}},"updatedAt":{"type":"string"}},"required":["id","object","slug","name","type","category","currentVersion","publishedVersion","subject","preheader","sourceKind","source","variablesSchema","sampleData","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/templates/{id}":{"get":{"operationId":"getTemplate","tags":["Templates"],"summary":"Get a template (by id or slug)","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["template"]},"slug":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["transactional","broadcast"]},"category":{"type":["string","null"]},"currentVersion":{"type":"number"},"publishedVersion":{"type":["number","null"]},"subject":{"type":"string"},"preheader":{"type":["string","null"]},"sourceKind":{"type":"string","enum":["blocks","html"]},"source":{"type":"object","additionalProperties":{}},"variablesSchema":{"type":["object","null"],"additionalProperties":{}},"sampleData":{"type":["object","null"],"additionalProperties":{}},"updatedAt":{"type":"string"}},"required":["id","object","slug","name","type","category","currentVersion","publishedVersion","subject","preheader","sourceKind","source","variablesSchema","sampleData","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateTemplate","tags":["Templates"],"summary":"Update a template","description":"Content changes create a new version. Pass `publish: true` to make it the version used for sending.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","pattern":"^[a-z0-9-]+$","description":"Stable name used in sends (`template: \"welcome\"`). Generated from the name when omitted."},"name":{"type":"string","description":"Display name."},"type":{"type":"string","enum":["transactional","broadcast"],"description":"`transactional` or `broadcast`."},"category":{"type":"string"},"subject":{"type":"string","description":"Subject line with `{{variables}}`."},"preheader":{"type":"string","description":"Preview text."},"sourceKind":{"type":"string","enum":["blocks","html"],"description":"`blocks` (a template document from the designer) or `html`."},"source":{"type":"object","additionalProperties":{},"description":"A template document (`{ version, theme, blocks }`) or `{ html }`."},"variablesSchema":{"type":"object","additionalProperties":{}},"sampleData":{"type":"object","additionalProperties":{},"description":"Example values for previews and test sends. Never used for real recipients."},"publish":{"type":"boolean","description":"Make this version the one sends use."},"draft":{"type":"boolean","description":"Autosave: update the current unpublished version in place instead of creating a new version."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["template"]},"slug":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["transactional","broadcast"]},"category":{"type":["string","null"]},"currentVersion":{"type":"number"},"publishedVersion":{"type":["number","null"]},"subject":{"type":"string"},"preheader":{"type":["string","null"]},"sourceKind":{"type":"string","enum":["blocks","html"]},"source":{"type":"object","additionalProperties":{}},"variablesSchema":{"type":["object","null"],"additionalProperties":{}},"sampleData":{"type":["object","null"],"additionalProperties":{}},"updatedAt":{"type":"string"}},"required":["id","object","slug","name","type","category","currentVersion","publishedVersion","subject","preheader","sourceKind","source","variablesSchema","sampleData","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteTemplate","tags":["Templates"],"summary":"Delete a template","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/templates/{id}/render":{"post":{"operationId":"renderTemplate","tags":["Templates"],"summary":"Render a stored template with variables","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"variables":{"type":"object","additionalProperties":{}},"version":{"type":"number"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string"},"html":{"type":"string"},"text":{"type":"string"},"warnings":{"type":"array","items":{"type":"string"}}},"required":["subject","html","text","warnings"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/templates/render":{"post":{"operationId":"renderTemplateDocument","tags":["Templates"],"summary":"Render an ad-hoc template document (no save)","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string","default":""},"preheader":{"type":"string"},"sourceKind":{"type":"string","enum":["blocks","html"],"default":"blocks"},"source":{"type":"object","additionalProperties":{}},"variables":{"type":"object","additionalProperties":{}}},"required":["source"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string"},"html":{"type":"string"},"text":{"type":"string"},"warnings":{"type":"array","items":{"type":"string"}}},"required":["subject","html","text","warnings"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/templates/{id}/versions":{"get":{"operationId":"listTemplateVersions","tags":["Templates"],"summary":"List versions of a template","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"version":{"type":"number"},"subject":{"type":"string"},"published":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["version","subject","published","createdAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/gallery/status":{"get":{"operationId":"getGalleryStatus","tags":["Gallery"],"summary":"Where this server reads the gallery from, and whether this workspace can share templates","description":"`mode`: `hosted` (this server hosts the gallery), `remote` (it reads ONESEND_GALLERY_URL), `bundled` (only the bundled starter templates: no hosted gallery is configured) or `off` (ONESEND_GALLERY=off). `submit.via`: `hosted` (share from this server), `cloud_link` (through the cloud account this app is linked to), `api_key` (through ONESEND_GALLERY_API_KEY), or null with the `reason`.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["hosted","remote","bundled","off"]},"url":{"type":["string","null"],"description":"The hosted gallery this server reads."},"submit":{"type":"object","properties":{"available":{"type":"boolean"},"via":{"type":["string","null"],"enum":["hosted","cloud_link","api_key",null]},"reason":{"type":["string","null"],"enum":["off","not_configured","not_linked","viewer",null]},"cloudUrl":{"type":["string","null"],"description":"Where to sign in and share instead."}},"required":["available","via","reason","cloudUrl"]}},"required":["mode","url","submit"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/gallery/submissions":{"get":{"operationId":"listGallerySubmissions","tags":["Gallery"],"summary":"This workspace's gallery submissions","description":"Every template this workspace shared to the gallery, with its review status. On servers that are not linked to a cloud account the list is empty.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["pending","published","rejected","unlisted"],"description":"`pending`: under review. `published`: in the gallery. `rejected`: see `reason`. `unlisted`: removed from the gallery by a moderator."},"reason":{"type":["string","null"]},"version":{"type":"number"},"sourceTemplateId":{"type":["string","null"]},"updateOf":{"type":["string","null"],"description":"The published entry this submission updates."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"reviewedAt":{"type":["string","null"]},"sampleChanged":{"type":"array","items":{"type":"string"},"description":"Right after submitting: sample data fields whose personal data was replaced with placeholders."}},"required":["id","slug","name","description","category","tags","status","reason","version","sourceTemplateId","updateOf","createdAt","updatedAt","reviewedAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"submitGalleryTemplate","tags":["Gallery"],"summary":"Share a template to the gallery","description":"Submits a template for review. Pass `templateId`, or the template itself (`document`, `subject`, `sample`). A moderator approves or rejects it, and the submitter is emailed the decision. Personal data in the sample data is replaced with placeholders; documents with scripts, tracking pixels or remote code are refused (`gallery_content_refused`), and so are documents over the size limits (`gallery_too_large`). A template has at most one pending submission (409 `submission_pending`); submitting a published template again proposes an update. On the hosting server a signed-in member or a full-access API key of the workspace can submit; other servers forward the submission with the cloud account they are linked to, or ONESEND_GALLERY_API_KEY (403 `gallery_submit_unavailable` without either). Rate limited (429).","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"type":"string","maxLength":80,"description":"A template of this workspace (id or slug). The document, subject and sample data are taken from its current version."},"name":{"type":"string","minLength":3,"maxLength":80},"description":{"type":"string","minLength":10,"maxLength":300},"category":{"type":"string","enum":["welcome","auth","receipt","notification","newsletter","announcement","onboarding","billing","event","feedback","other"]},"style":{"type":["string","null"],"enum":["editorial","luxe","brutalist","playful","corporate","minimal","retro",null]},"tags":{"type":"array","items":{"type":"string","minLength":2,"maxLength":24},"maxItems":8,"default":[]},"authorName":{"type":["string","null"],"maxLength":60,"description":"Shown as the author. Default: your name."},"consent":{"type":"boolean","enum":[true],"description":"The submitter confirms the design is their own work and agrees that it is published under the MIT license."},"type":{"type":"string","enum":["transactional","broadcast"]},"subject":{"type":"string","maxLength":300},"preheader":{"type":["string","null"],"maxLength":300},"document":{"type":"object","additionalProperties":{}},"sample":{"type":"object","additionalProperties":{}},"sourceTemplateId":{"type":["string","null"],"maxLength":80,"description":"The template the submission was made from, on the server that forwards it."}},"required":["name","description","category","consent"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["pending","published","rejected","unlisted"],"description":"`pending`: under review. `published`: in the gallery. `rejected`: see `reason`. `unlisted`: removed from the gallery by a moderator."},"reason":{"type":["string","null"]},"version":{"type":"number"},"sourceTemplateId":{"type":["string","null"]},"updateOf":{"type":["string","null"],"description":"The published entry this submission updates."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"reviewedAt":{"type":["string","null"]},"sampleChanged":{"type":"array","items":{"type":"string"},"description":"Right after submitting: sample data fields whose personal data was replaced with placeholders."}},"required":["id","slug","name","description","category","tags","status","reason","version","sourceTemplateId","updateOf","createdAt","updatedAt","reviewedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/gallery":{"get":{"operationId":"listGalleryTemplates","tags":["Gallery"],"summary":"Browse the template gallery","description":"Published templates you can copy into your workspace. On the server that hosts the gallery this endpoint is public (no credentials, any origin). On other servers it needs an API key or session with read access, and reads the hosted gallery (ONESEND_GALLERY_URL) or, when that cannot be reached, the bundled starter templates. Responses carry an ETag (send If-None-Match for a 304) and Cache-Control.","security":[],"parameters":[{"schema":{"type":"string","maxLength":100,"description":"Free text: name, description, category, style and tags."},"required":false,"description":"Free text: name, description, category, style and tags.","name":"q","in":"query"},{"schema":{"type":"string","maxLength":40},"required":false,"name":"category","in":"query"},{"schema":{"type":"string","maxLength":40},"required":false,"name":"style","in":"query"},{"schema":{"type":"string","enum":["popular","new"],"description":"`popular` (featured first, then most used) or `new` (most recently published). Default: `popular`."},"required":false,"description":"`popular` (featured first, then most used) or `new` (most recently published). Default: `popular`.","name":"sort","in":"query"},{"schema":{"type":"string","maxLength":12,"pattern":"^\\d*$","description":"`nextCursor` of the previous page."},"required":false,"description":"`nextCursor` of the previous page.","name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (default 50, at most 100)."},"required":false,"description":"Page size (default 50, at most 100).","name":"limit","in":"query"},{"schema":{"type":["boolean","null"],"description":"Include rendered HTML (`previewHtml`)."},"required":false,"description":"Include rendered HTML (`previewHtml`).","name":"preview","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Same as `slug` (kept for older clients)."},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"style":{"type":"string"},"author":{"type":"string","description":"Display name of the author."},"tags":{"type":"array","items":{"type":"string"}},"license":{"type":"string"},"type":{"type":"string","enum":["transactional","broadcast"]},"subject":{"type":"string"},"preheader":{"type":["string","null"]},"featured":{"type":"boolean"},"version":{"type":"number"},"views":{"type":"number"},"uses":{"type":"number","description":"Copies into a workspace."},"publishedAt":{"type":["string","null"]},"updatedAt":{"type":["string","null"]},"previewUrl":{"type":["string","null"],"description":"A page that renders the preview with the sample data."},"previewHtml":{"type":"string","description":"Rendered HTML, with `preview=true`."}},"required":["id","slug","name","description","category","style","author","tags","license","type","subject","preheader","featured","version","views","uses","publishedAt","updatedAt","previewUrl"]}},"nextCursor":{"type":["string","null"]},"total":{"type":"number"},"source":{"type":"string","enum":["hosted","remote","bundled"],"description":"`hosted`: this server hosts the gallery. `remote`: read from the hosted gallery (ONESEND_GALLERY_URL). `bundled`: the starter templates bundled with this server, served while the hosted gallery cannot be reached or is turned off."}},"required":["data","nextCursor","total","source"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/gallery/{slug}":{"get":{"operationId":"getGalleryTemplate","tags":["Gallery"],"summary":"Get a gallery template with its document, sample data and preview","description":"On the server that hosts the gallery this endpoint is public (no credentials, any origin). On other servers it needs an API key or session with read access, and reads the hosted gallery (ONESEND_GALLERY_URL) or, when that cannot be reached, the bundled starter templates. Responses carry an ETag and Cache-Control.","security":[],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Same as `slug` (kept for older clients)."},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"style":{"type":"string"},"author":{"type":"string","description":"Display name of the author."},"tags":{"type":"array","items":{"type":"string"}},"license":{"type":"string"},"type":{"type":"string","enum":["transactional","broadcast"]},"subject":{"type":"string"},"preheader":{"type":["string","null"]},"featured":{"type":"boolean"},"version":{"type":"number"},"views":{"type":"number"},"uses":{"type":"number","description":"Copies into a workspace."},"publishedAt":{"type":["string","null"]},"updatedAt":{"type":["string","null"]},"previewUrl":{"type":["string","null"],"description":"A page that renders the preview with the sample data."},"previewHtml":{"type":"string"},"document":{"type":"object","additionalProperties":{}},"sample":{"type":"object","additionalProperties":{}},"source":{"type":"string","enum":["hosted","remote","bundled"],"description":"`hosted`: this server hosts the gallery. `remote`: read from the hosted gallery (ONESEND_GALLERY_URL). `bundled`: the starter templates bundled with this server, served while the hosted gallery cannot be reached or is turned off."}},"required":["id","slug","name","description","category","style","author","tags","license","type","subject","preheader","featured","version","views","uses","publishedAt","updatedAt","previewUrl","previewHtml","document","sample","source"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/gallery/{slug}/preview.html":{"get":{"operationId":"previewGalleryTemplate","tags":["Gallery"],"summary":"Preview a gallery template","description":"The template rendered with its sample data, as an HTML page (sandboxed: no scripts, no forms). On the server that hosts the gallery this endpoint is public (no credentials, any origin). On other servers it needs an API key or session with read access, and reads the hosted gallery (ONESEND_GALLERY_URL) or, when that cannot be reached, the bundled starter templates.","security":[],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"Success","content":{"text/html":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/gallery/{slug}/use":{"post":{"operationId":"countGalleryTemplateUse","tags":["Gallery"],"summary":"Count a use of a gallery template","description":"Called by servers that copied the template into a workspace (POST /v1/gallery/{slug}/clone does it for you). Public on the server that hosts the gallery; send no body. Rate limited per client (429 `rate_limited`). 404 `gallery_not_hosted` on other servers.","security":[],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"uses":{"type":"number"}},"required":["ok"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/gallery/{slug}/clone":{"post":{"operationId":"cloneGalleryTemplate","tags":["Gallery"],"summary":"Copy a gallery template into your workspace","description":"Creates a published template from the gallery entry (its document, subject and sample data) and counts a use.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"slug":{"type":"string","pattern":"^[a-z0-9-]+$"}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["template"]},"slug":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["transactional","broadcast"]},"category":{"type":["string","null"]},"currentVersion":{"type":"number"},"publishedVersion":{"type":["number","null"]},"subject":{"type":"string"},"preheader":{"type":["string","null"]},"sourceKind":{"type":"string","enum":["blocks","html"]},"source":{"type":"object","additionalProperties":{}},"variablesSchema":{"type":["object","null"],"additionalProperties":{}},"sampleData":{"type":["object","null"],"additionalProperties":{}},"updatedAt":{"type":"string"}},"required":["id","object","slug","name","type","category","currentVersion","publishedVersion","subject","preheader","sourceKind","source","variablesSchema","sampleData","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/oauth/requests/{id}":{"get":{"operationId":"getOauthRequest","tags":["Connected apps"],"summary":"An app asking to connect (consent screen)","description":"Session only. The app, what it asks for, your workspaces and the mailboxes of the chosen workspace.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"workspaceId","in":"query"}],"responses":{"200":{"description":"Success"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/oauth/requests/{id}/decision":{"post":{"operationId":"decisionOauthRequest","tags":["Connected apps"],"summary":"Approve or deny an app","description":"Session only. Returns `redirectTo`, the app address to send the browser to. Viewers can only give read access.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"approve":{"type":"boolean"},"workspaceId":{"type":"string"},"access":{"type":"string","enum":["read","write"]},"mailboxIds":{"type":["array","null"],"items":{"type":"string"},"maxItems":50}},"required":["approve"]}}}},"responses":{"200":{"description":"Success"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/oauth/grants":{"get":{"operationId":"listOauthGrants","tags":["Connected apps"],"summary":"Connected apps","description":"Session only. Your connected apps; owners and admins see everyone's in the workspace.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/oauth/grants/{id}":{"delete":{"operationId":"deleteOauthGrant","tags":["Connected apps"],"summary":"Disconnect an app","description":"Revokes every token the app holds at once.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/suppressions":{"get":{"operationId":"listSuppressions","tags":["Suppressions"],"summary":"List suppressed addresses (shared across every provider)","description":"One list for every provider: an address that bounced or complained anywhere (provider webhooks, status polls, imported provider lists, send-time rejections) is never sent to again through any provider. Each entry says where it came from and, for temporary entries, when it ends.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"string"},"required":false,"name":"reason","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","enum":["webhook","webhook_unmatched","poll","sync","send","manual","import","escalation","unsubscribe","api","erasure","legacy"],"description":"Where entries came from (`legacy`: added before origins were recorded)."},"required":false,"description":"Where entries came from (`legacy`: added before origins were recorded).","name":"origin","in":"query"},{"schema":{"type":"string","description":"Entries that came from this sending provider connection."},"required":false,"description":"Entries that came from this sending provider connection.","name":"connectionId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"provider","in":"query"},{"schema":{"type":"string","enum":["all","broadcast"]},"required":false,"name":"scope","in":"query"},{"schema":{"type":"string","enum":["true","false"],"description":"`true`: only entries that end (repeated soft bounces, provider blocks); `false`: only permanent ones."},"required":false,"description":"`true`: only entries that end (repeated soft bounces, provider blocks); `false`: only permanent ones.","name":"temporary","in":"query"},{"schema":{"type":"string","enum":["true","false"],"description":"Include temporary entries that already ended (removed by housekeeping within the hour). Default false."},"required":false,"description":"Include temporary entries that already ended (removed by housekeeping within the hour). Default false.","name":"expired","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"reason":{"type":"string","enum":["hard_bounce","complaint","unsubscribe","manual","blocked","soft_bounce_repeated"]},"scope":{"type":"string","enum":["all","broadcast"]},"source":{"type":["string","null"]},"createdAt":{"type":"string"},"origin":{"type":"string","enum":["webhook","webhook_unmatched","poll","sync","send","manual","import","escalation","unsubscribe","api","erasure","legacy"]},"provider":{"type":["string","null"],"description":"Provider it came from (webhook, poll, sync or send-time rejection)."},"connectionId":{"type":["string","null"]},"detail":{"type":["string","null"],"description":"Provider reason text, when known."},"expiresAt":{"type":["string","null"],"description":"Temporary suppressions (repeated soft bounces, provider blocks) end here."},"updatedAt":{"type":["string","null"]},"allProviders":{"type":"boolean","enum":[true],"description":"Every suppression applies to every provider."}},"required":["email","reason","scope","source","createdAt","origin","provider","connectionId","detail","expiresAt","updatedAt","allProviders"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createSuppression","tags":["Suppressions"],"summary":"Suppress an address","description":"An existing hard bounce or complaint is never downgraded; the wider scope wins; a permanent entry replaces a temporary one.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"reason":{"type":"string","enum":["hard_bounce","complaint","unsubscribe","manual"],"default":"manual"},"scope":{"type":"string","enum":["all","broadcast"],"default":"all"}},"required":["email"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"reason":{"type":"string","enum":["hard_bounce","complaint","unsubscribe","manual","blocked","soft_bounce_repeated"]},"scope":{"type":"string","enum":["all","broadcast"]},"source":{"type":["string","null"]},"createdAt":{"type":"string"},"origin":{"type":"string","enum":["webhook","webhook_unmatched","poll","sync","send","manual","import","escalation","unsubscribe","api","erasure","legacy"]},"provider":{"type":["string","null"],"description":"Provider it came from (webhook, poll, sync or send-time rejection)."},"connectionId":{"type":["string","null"]},"detail":{"type":["string","null"],"description":"Provider reason text, when known."},"expiresAt":{"type":["string","null"],"description":"Temporary suppressions (repeated soft bounces, provider blocks) end here."},"updatedAt":{"type":["string","null"]},"allProviders":{"type":"boolean","enum":[true],"description":"Every suppression applies to every provider."}},"required":["email","reason","scope","source","createdAt","origin","provider","connectionId","detail","expiresAt","updatedAt","allProviders"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/suppressions/stats":{"get":{"operationId":"listSuppressionStats","tags":["Suppressions"],"summary":"Suppression counts by reason, origin and provider connection","description":"Entries in force (temporary entries that ended are not counted).","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"number"},"byReason":{"type":"object","additionalProperties":{"type":"number"}},"byOrigin":{"type":"object","additionalProperties":{"type":"number"}},"byConnection":{"type":"object","additionalProperties":{"type":"number"}}},"required":["total","byReason","byOrigin","byConnection"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/suppressions/sync":{"get":{"operationId":"getSuppressionSync","tags":["Suppressions"],"summary":"Provider suppression sync status per connection","description":"For each connected provider: whether its own suppression list can be imported, the last run and its result, and the next run. Lists are imported when a provider is connected and then every few hours (`providerSync.intervalHours`, default 6).","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["suppressions","suppressions_push","status"]},"supported":{"type":"boolean","description":"The provider API offers this (and it was not refused for this key)."},"status":{"type":"string","enum":["idle","running","error","unsupported"]},"inProgress":{"type":"boolean","description":"A pass started and continues in the next run."},"lastRunAt":{"type":["string","null"]},"lastSuccessAt":{"type":["string","null"]},"nextRunAt":{"type":["string","null"]},"lastResult":{"type":["object","null"],"properties":{"ok":{"type":"boolean"},"at":{"type":"string"},"imported":{"type":"number"},"updated":{"type":"number"},"seen":{"type":"number"},"pushed":{"type":"number"},"polled":{"type":"number"},"events":{"type":"number"},"pages":{"type":"number"},"done":{"type":"boolean"},"error":{"type":["string","null"]},"unsupported":{"type":"boolean"}},"required":["ok","at"]},"total":{"type":"number","description":"Entries imported (or pushed, or emails polled) over time."}},"required":["connectionId","provider","name","kind","supported","status","inProgress","lastRunAt","lastSuccessAt","nextRunAt","lastResult","total"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"syncSuppressions","tags":["Suppressions"],"summary":"Import provider suppression lists now","description":"Starts an import of the providers' own suppression lists in the background (`GET /v1/suppressions/sync` shows progress).","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"type":"string","description":"One connection; default: every connection that supports it."}}}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["suppressions","suppressions_push","status"]},"supported":{"type":"boolean","description":"The provider API offers this (and it was not refused for this key)."},"status":{"type":"string","enum":["idle","running","error","unsupported"]},"inProgress":{"type":"boolean","description":"A pass started and continues in the next run."},"lastRunAt":{"type":["string","null"]},"lastSuccessAt":{"type":["string","null"]},"nextRunAt":{"type":["string","null"]},"lastResult":{"type":["object","null"],"properties":{"ok":{"type":"boolean"},"at":{"type":"string"},"imported":{"type":"number"},"updated":{"type":"number"},"seen":{"type":"number"},"pushed":{"type":"number"},"polled":{"type":"number"},"events":{"type":"number"},"pages":{"type":"number"},"done":{"type":"boolean"},"error":{"type":["string","null"]},"unsupported":{"type":"boolean"}},"required":["ok","at"]},"total":{"type":"number","description":"Entries imported (or pushed, or emails polled) over time."}},"required":["connectionId","provider","name","kind","supported","status","inProgress","lastRunAt","lastSuccessAt","nextRunAt","lastResult","total"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/suppressions/{email}":{"delete":{"operationId":"deleteSuppression","tags":["Suppressions"],"summary":"Remove an address from the suppression list","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"email","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/api-keys":{"get":{"operationId":"listApiKeys","tags":["API keys"],"summary":"List API keys","description":"Needs a dashboard session or an `admin`-scoped API key. Expired keys are listed (with `expiresAt` in the past) until they are revoked.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"scope":{"type":"string","enum":["full","send","read","publishable","admin"]},"mode":{"type":"string","enum":["live","test"]},"lastUsedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"domainIds":{"type":["array","null"],"items":{"type":"string"},"description":"The key may only send from these sender domains (null: every domain)."},"mailboxIds":{"type":["array","null"],"items":{"type":"string"},"description":"The key only reads, streams and sends mail for these mailboxes."},"limits":{"type":["object","null"],"properties":{"perHour":{"type":["number","null"]},"perDay":{"type":["number","null"]},"maxStreams":{"type":["number","null"]}}},"recipientAllowlist":{"type":["array","null"],"items":{"type":"string"}},"expiresAt":{"type":["string","null"],"description":"When the key stops working (null: never)."},"expired":{"type":"boolean","description":"True once expiresAt has passed: the key answers 401 `key_expired`."},"allowedIps":{"type":["array","null"],"items":{"type":"string"},"description":"Addresses and CIDR ranges the key may be used from (null: any)."},"lastUsedIp":{"type":["string","null"],"description":"The client address of the last use."},"lastUsedUserAgent":{"type":["string","null"]},"grants":{"type":["array","null"],"items":{"type":"string"},"description":"Extra permissions on top of the scope (`templates:read`, `gallery:submit`)."},"previousSecretExpiresAt":{"type":["string","null"],"description":"After a rotation: until when the old secret still works (null: it does not)."},"createdByUserId":{"type":["string","null"],"description":"The member who created the key (directly, or through a key they created). The key is revoked when they leave the workspace. Null: unknown (keys created before this was recorded)."},"createdByKeyId":{"type":["string","null"],"description":"The API key that created this key (null: a person). Revoking that key, or a leak report about it, revokes this key too."}},"required":["id","name","prefix","scope","mode","lastUsedAt","createdAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createApiKey","tags":["API keys"],"summary":"Create an API key","description":"Needs a dashboard session (or an `admin`-scoped live key). The full key is returned once. `scope` defaults to `send`. `test` keys never reach a provider (messages are stored as `sandboxed`). `publishable` keys (`os_pub_…`) can only call `POST /t/conversion` and are safe to put in a web page. `full` keys send, read and manage content; `admin` keys (created from a session only) can also change configuration (providers, routing, domains, webhooks, settings) and manage API keys. `domainIds` limits which sender domains the key may send from. `expiresAt` and `allowedIps` contain a leaked key. A key can only create keys no looser than itself (scope, `domainIds`, `mailboxIds`, `limits`, `recipientAllowlist`, `expiresAt`, `allowedIps`, `grants`): 403 `key_wider_than_creator`. A key can have at most 100 unrevoked keys it created, expired ones included (`ONESEND_MAX_KEYS_PER_KEY`; keys created in the dashboard are not limited): 400 `too_many_keys`. New keys end in a 6-character checksum, so scanners can recognize them offline. The workspace owners get an email.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"scope":{"type":"string","enum":["full","send","read","publishable","admin"],"default":"send","description":"Default `send` (least privilege). `full` adds reading and content management; `admin` adds configuration and API keys."},"mode":{"type":"string","enum":["live","test"],"default":"live"},"domainIds":{"type":"array","items":{"type":"string"},"maxItems":50},"mailboxIds":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":50,"description":"Limit the key to these mailboxes: it can only read, search, stream and send mail for them (403 `mailbox_scope` elsewhere)."},"limits":{"type":"object","properties":{"perHour":{"type":["integer","null"],"minimum":1,"maximum":100000},"perDay":{"type":["integer","null"],"minimum":1,"maximum":1000000},"maxStreams":{"type":["integer","null"],"minimum":1,"maximum":50}},"description":"Messages per hour and per day (clock hours and UTC days; over the limit: 429 `key_rate_limited` with `retry-after`), and open streams (default 5)."},"recipientAllowlist":{"type":"array","items":{"type":"string","minLength":2,"maxLength":254},"maxItems":200,"description":"Domains (example.com, with subdomains; *.example.com for subdomains only) and addresses the key may send to. Other recipients: 403 `recipient_not_allowed`."},"expiresAt":{"type":["string","null"],"format":"date-time","description":"When the key stops working (ISO 8601). After it: 401 `key_expired`. Null or absent: never."},"allowedIps":{"type":["array","null"],"items":{"type":"string","minLength":2,"maxLength":64},"maxItems":100,"description":"IPv4 and IPv6 addresses and CIDR ranges the key may be used from (203.0.113.7, 10.0.0.0/8, 2001:db8::/32). Elsewhere: 403 `ip_not_allowed`. The address is the client address the server sees (ONESEND_TRUST_PROXY decides whether X-Forwarded-For counts). Null or absent: any address."},"grants":{"type":"array","items":{"type":"string","enum":["templates:read","gallery:submit","inbox:agent-changes"]},"maxItems":10,"description":"Extra permissions on top of the scope: `templates:read` (list and read templates) and `gallery:submit` (share templates to the gallery). For example a `send` key for an app that also lists templates."}},"required":["name"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"scope":{"type":"string","enum":["full","send","read","publishable","admin"]},"mode":{"type":"string","enum":["live","test"]},"lastUsedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"domainIds":{"type":["array","null"],"items":{"type":"string"},"description":"The key may only send from these sender domains (null: every domain)."},"mailboxIds":{"type":["array","null"],"items":{"type":"string"},"description":"The key only reads, streams and sends mail for these mailboxes."},"limits":{"type":["object","null"],"properties":{"perHour":{"type":["number","null"]},"perDay":{"type":["number","null"]},"maxStreams":{"type":["number","null"]}}},"recipientAllowlist":{"type":["array","null"],"items":{"type":"string"}},"expiresAt":{"type":["string","null"],"description":"When the key stops working (null: never)."},"expired":{"type":"boolean","description":"True once expiresAt has passed: the key answers 401 `key_expired`."},"allowedIps":{"type":["array","null"],"items":{"type":"string"},"description":"Addresses and CIDR ranges the key may be used from (null: any)."},"lastUsedIp":{"type":["string","null"],"description":"The client address of the last use."},"lastUsedUserAgent":{"type":["string","null"]},"grants":{"type":["array","null"],"items":{"type":"string"},"description":"Extra permissions on top of the scope (`templates:read`, `gallery:submit`)."},"previousSecretExpiresAt":{"type":["string","null"],"description":"After a rotation: until when the old secret still works (null: it does not)."},"createdByUserId":{"type":["string","null"],"description":"The member who created the key (directly, or through a key they created). The key is revoked when they leave the workspace. Null: unknown (keys created before this was recorded)."},"createdByKeyId":{"type":["string","null"],"description":"The API key that created this key (null: a person). Revoking that key, or a leak report about it, revokes this key too."},"key":{"type":"string"}},"required":["id","name","prefix","scope","mode","lastUsedAt","createdAt","key"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/api-keys/{id}":{"patch":{"operationId":"updateApiKey","tags":["API keys"],"summary":"Update an API key","description":"Change the name, the expiry (`expiresAt`; null: never) or the allowed addresses (`allowedIps`; null: any). Needs a dashboard session or an `admin`-scoped API key; a key cannot loosen a key beyond its own settings (403 `key_wider_than_creator`), and making an expired key live again with a key counts toward the limit of live keys its creator made (400 `too_many_keys`).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"expiresAt":{"type":["string","null"],"format":"date-time","description":"When the key stops working (ISO 8601). After it: 401 `key_expired`. Null or absent: never."},"allowedIps":{"type":["array","null"],"items":{"type":"string","minLength":2,"maxLength":64},"maxItems":100,"description":"IPv4 and IPv6 addresses and CIDR ranges the key may be used from (203.0.113.7, 10.0.0.0/8, 2001:db8::/32). Elsewhere: 403 `ip_not_allowed`. The address is the client address the server sees (ONESEND_TRUST_PROXY decides whether X-Forwarded-For counts). Null or absent: any address."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"scope":{"type":"string","enum":["full","send","read","publishable","admin"]},"mode":{"type":"string","enum":["live","test"]},"lastUsedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"domainIds":{"type":["array","null"],"items":{"type":"string"},"description":"The key may only send from these sender domains (null: every domain)."},"mailboxIds":{"type":["array","null"],"items":{"type":"string"},"description":"The key only reads, streams and sends mail for these mailboxes."},"limits":{"type":["object","null"],"properties":{"perHour":{"type":["number","null"]},"perDay":{"type":["number","null"]},"maxStreams":{"type":["number","null"]}}},"recipientAllowlist":{"type":["array","null"],"items":{"type":"string"}},"expiresAt":{"type":["string","null"],"description":"When the key stops working (null: never)."},"expired":{"type":"boolean","description":"True once expiresAt has passed: the key answers 401 `key_expired`."},"allowedIps":{"type":["array","null"],"items":{"type":"string"},"description":"Addresses and CIDR ranges the key may be used from (null: any)."},"lastUsedIp":{"type":["string","null"],"description":"The client address of the last use."},"lastUsedUserAgent":{"type":["string","null"]},"grants":{"type":["array","null"],"items":{"type":"string"},"description":"Extra permissions on top of the scope (`templates:read`, `gallery:submit`)."},"previousSecretExpiresAt":{"type":["string","null"],"description":"After a rotation: until when the old secret still works (null: it does not)."},"createdByUserId":{"type":["string","null"],"description":"The member who created the key (directly, or through a key they created). The key is revoked when they leave the workspace. Null: unknown (keys created before this was recorded)."},"createdByKeyId":{"type":["string","null"],"description":"The API key that created this key (null: a person). Revoking that key, or a leak report about it, revokes this key too."}},"required":["id","name","prefix","scope","mode","lastUsedAt","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteApiKey","tags":["API keys"],"summary":"Revoke an API key","description":"Needs a dashboard session or an `admin`-scoped API key. Both the current secret and a previous one still in its rotation grace period stop working. The keys it created or rotated are revoked too, and the keys those created or rotated, until none is left; the invitations it sent are canceled and the members who joined through them are removed (and, in turn, the invitations those members sent and the members who joined through them). The workspace owners get an email.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/api-keys/{id}/rotate":{"post":{"operationId":"rotateApiKey","tags":["API keys"],"summary":"Rotate an API key","description":"Returns a new secret for the same key: same id, name, permissions and restrictions. The old secret keeps working for `gracePeriodSeconds` (default 24 hours, at most 7 days), so you can deploy the new one, then stops. Rotating again during the grace period ends the earlier secret at once. The new secret is returned once. Needs a dashboard session or an `admin`-scoped API key. An API key can rotate only itself and the keys in its own creator chain (that it created, or that those created; 403 `not_in_key_chain` otherwise), and the key that made the rotation is recorded: revoking it, or a leak report about it, revokes the rotated key too, and a leak report of the previous secret of a key last rotated with an API key revokes the whole key. A rotation in the dashboard clears that. The workspace owners get an email.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"gracePeriodSeconds":{"type":"integer","minimum":0,"maximum":604800,"default":86400,"description":"How long the old secret keeps working, in seconds (default 86,400: 24 hours; at most 604,800: 7 days; 0: it stops at once)."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"scope":{"type":"string","enum":["full","send","read","publishable","admin"]},"mode":{"type":"string","enum":["live","test"]},"lastUsedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"domainIds":{"type":["array","null"],"items":{"type":"string"},"description":"The key may only send from these sender domains (null: every domain)."},"mailboxIds":{"type":["array","null"],"items":{"type":"string"},"description":"The key only reads, streams and sends mail for these mailboxes."},"limits":{"type":["object","null"],"properties":{"perHour":{"type":["number","null"]},"perDay":{"type":["number","null"]},"maxStreams":{"type":["number","null"]}}},"recipientAllowlist":{"type":["array","null"],"items":{"type":"string"}},"expiresAt":{"type":["string","null"],"description":"When the key stops working (null: never)."},"expired":{"type":"boolean","description":"True once expiresAt has passed: the key answers 401 `key_expired`."},"allowedIps":{"type":["array","null"],"items":{"type":"string"},"description":"Addresses and CIDR ranges the key may be used from (null: any)."},"lastUsedIp":{"type":["string","null"],"description":"The client address of the last use."},"lastUsedUserAgent":{"type":["string","null"]},"grants":{"type":["array","null"],"items":{"type":"string"},"description":"Extra permissions on top of the scope (`templates:read`, `gallery:submit`)."},"previousSecretExpiresAt":{"type":["string","null"]},"createdByUserId":{"type":["string","null"],"description":"The member who created the key (directly, or through a key they created). The key is revoked when they leave the workspace. Null: unknown (keys created before this was recorded)."},"createdByKeyId":{"type":["string","null"],"description":"The API key that created this key (null: a person). Revoking that key, or a leak report about it, revokes this key too."},"key":{"type":"string"}},"required":["id","name","prefix","scope","mode","lastUsedAt","createdAt","previousSecretExpiresAt","key"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/webhooks":{"get":{"operationId":"listWebhooks","tags":["Webhooks"],"summary":"List webhook endpoints","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"kind":{"type":"string","enum":["http","slack","discord"]},"enabled":{"type":"boolean"},"status":{"type":"string","enum":["active","secret_unreadable"],"default":"active"},"statusReason":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","url","events","kind","enabled","createdAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createWebhook","tags":["Webhooks"],"summary":"Register a webhook endpoint","description":"Events: `email.queued`, `email.sent`, `email.delivered`, `email.deferred`, `email.bounced`, `email.complained`, `email.opened`, `email.clicked`, `email.unsubscribed`, `email.failed`, `email.suppressed`, `email.failover`, `email.received`, `connection.unhealthy`, `connection.health`, `quota.low` (or `*`). HTTP endpoints are signed: `X-OneSend-Signature: v1=hex(hmac_sha256(secret, timestamp + \".\" + body))` with `X-OneSend-Timestamp`. Slack/Discord incoming-webhook URLs get readable alerts.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2048,"format":"uri"},"events":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":50,"default":["*"]},"kind":{"type":"string","enum":["http","slack","discord"]}},"required":["url"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"kind":{"type":"string","enum":["http","slack","discord"]},"enabled":{"type":"boolean"},"status":{"type":"string","enum":["active","secret_unreadable"],"default":"active"},"statusReason":{"type":["string","null"]},"createdAt":{"type":"string"},"secret":{"type":"string"}},"required":["id","url","events","kind","enabled","createdAt","secret"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/webhooks/{id}":{"delete":{"operationId":"deleteWebhook","tags":["Webhooks"],"summary":"Delete a webhook endpoint","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/webhooks/{id}/rotate-secret":{"post":{"operationId":"rotateWebhookSecret","tags":["Webhooks"],"summary":"Rotate the signing secret","description":"Returns the new secret once. Deliveries are signed with it immediately.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"type":"string"}},"required":["secret"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/webhooks/{id}/test":{"post":{"operationId":"testWebhook","tags":["Webhooks"],"summary":"Send a test event now","description":"Sends a realistic `email.sent` event with `data.test: true` (so failure alerts on your side do not fire). The result says only whether the endpoint answered 2xx (and its status), never network details.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":["string","null"]}},"required":["ok","error"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/analytics/summary":{"get":{"operationId":"getAnalyticsSummary","tags":["Analytics"],"summary":"Delivery, engagement and failover analytics","description":"Totals, rates, a time series and a per-provider breakdown (latency, top error codes). Filter by `provider` (provider id or connection id, comma separated), sending `domain`, `tag`, `template` and time range (default last 30 days).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"until","in":"query"},{"schema":{"type":"string"},"required":false,"name":"provider","in":"query"},{"schema":{"type":"string"},"required":false,"name":"domain","in":"query"},{"schema":{"type":"string"},"required":false,"name":"tag","in":"query"},{"schema":{"type":"string"},"required":false,"name":"template","in":"query"},{"schema":{"type":"string","enum":["hour","day"],"default":"day"},"required":false,"name":"interval","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"totals":{"type":"object","properties":{"sent":{"type":"number"},"delivered":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"opened":{"type":"number"},"clicked":{"type":"number"},"failed":{"type":"number"},"failovers":{"type":"number"}},"required":["sent","delivered","bounced","complained","opened","clicked","failed","failovers"]},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"bounce":{"type":"number"},"complaint":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"failover":{"type":"number"}},"required":["delivery","bounce","complaint","open","click","failover"]},"series":{"type":"array","items":{"type":"object","properties":{"sent":{"type":"number"},"delivered":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"opened":{"type":"number"},"clicked":{"type":"number"},"failed":{"type":"number"},"failovers":{"type":"number"},"t":{"type":"string"}},"required":["sent","delivered","bounced","complained","opened","clicked","failed","failovers","t"]}},"byProvider":{"type":"array","items":{"type":"object","properties":{"sent":{"type":"number"},"delivered":{"type":"number"},"bounced":{"type":"number"},"complained":{"type":"number"},"opened":{"type":"number"},"clicked":{"type":"number"},"failed":{"type":"number"},"failovers":{"type":"number"},"connectionId":{"type":"string"},"provider":{"type":"string"},"name":{"type":"string"},"avgLatencyMs":{"type":["number","null"]},"topErrors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"count":{"type":"number"}},"required":["code","count"]}}},"required":["sent","delivered","bounced","complained","opened","clicked","failed","failovers","connectionId","provider","name","avgLatencyMs","topErrors"]}},"timezone":{"type":"string"}},"required":["totals","rates","series","byProvider"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/analytics/quota":{"get":{"operationId":"getAnalyticsQuota","tags":["Analytics"],"summary":"Pooled and per-provider quota for today","description":"Includes a naive forecast of when today's pooled quota runs out at the current pace.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"pooled":{"type":"object","properties":{"dailyLimit":{"type":["number","null"],"description":"Sum of the daily limits of active real providers; null when one has no limit."},"usedToday":{"type":"number","description":"Sent today through real providers (the Sandbox provider is not counted)."},"remainingToday":{"type":["number","null"]},"forecastExhaustAt":{"type":["string","null"]},"excluded":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"name":{"type":"string"},"reason":{"type":"string","enum":["sandbox","paused","error"]},"usedToday":{"type":"number"}},"required":["connectionId","name","reason","usedToday"]}}},"required":["dailyLimit","usedToday","remainingToday","forecastExhaustAt"]},"connections":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"name":{"type":"string"},"dailyLimit":{"type":["number","null"]},"usedToday":{"type":"number"},"monthlyLimit":{"type":["number","null"]},"usedThisMonth":{"type":"number"},"health":{"type":"number"},"status":{"type":"string"}},"required":["connectionId","provider","name","dailyLimit","usedToday","monthlyLimit","usedThisMonth","health","status"]}}},"required":["pooled","connections"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/events":{"get":{"operationId":"listEvents","tags":["Analytics"],"summary":"Event log","description":"Every lifecycle event (queued, sent, delivered, bounced, failover, opened, received, …), newest first.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"type","in":"query"},{"schema":{"type":"string"},"required":false,"name":"messageId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"provider","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"messageId":{"type":["string","null"]},"provider":{"type":["string","null"]},"connectionId":{"type":["string","null"]},"recipient":{"type":["string","null"]},"data":{"type":["object","null"],"additionalProperties":{}},"occurredAt":{"type":"string"}},"required":["id","type","messageId","provider","connectionId","recipient","data","occurredAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contact-attributes":{"get":{"operationId":"listContactAttributes","tags":["Contacts"],"summary":"List contact attributes","description":"System attributes (email, first_name, last_name, phone) are always present.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string"},"type":{"type":"string","enum":["text","number","date","boolean","category"]},"options":{"type":"array","items":{"type":"string"}},"system":{"type":"boolean"}},"required":["key","label","type","system"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createContactAttribute","tags":["Contacts"],"summary":"Create a contact attribute","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string"},"type":{"type":"string","enum":["text","number","date","boolean","category"]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label","type"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string"},"type":{"type":"string","enum":["text","number","date","boolean","category"]},"options":{"type":"array","items":{"type":"string"}},"system":{"type":"boolean"}},"required":["key","label","type","system"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contact-attributes/{key}":{"delete":{"operationId":"deleteContactAttribute","tags":["Contacts"],"summary":"Delete a contact attribute","description":"Values already stored on contacts are kept.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/lists":{"get":{"operationId":"listLists","tags":["Lists"],"summary":"List contact lists","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["list"]},"name":{"type":"string"},"description":{"type":["string","null"]},"contactCount":{"type":"number"},"subscribedCount":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","object","name","description","contactCount","subscribedCount","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createList","tags":["Lists"],"summary":"Create a list","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":["string","null"],"maxLength":500}},"required":["name"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["list"]},"name":{"type":"string"},"description":{"type":["string","null"]},"contactCount":{"type":"number"},"subscribedCount":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","object","name","description","contactCount","subscribedCount","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/lists/{id}":{"get":{"operationId":"getList","tags":["Lists"],"summary":"Get a list","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["list"]},"name":{"type":"string"},"description":{"type":["string","null"]},"contactCount":{"type":"number"},"subscribedCount":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","object","name","description","contactCount","subscribedCount","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateList","tags":["Lists"],"summary":"Rename or describe a list","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":["string","null"],"maxLength":500}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["list"]},"name":{"type":"string"},"description":{"type":["string","null"]},"contactCount":{"type":"number"},"subscribedCount":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","object","name","description","contactCount","subscribedCount","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteList","tags":["Lists"],"summary":"Delete a list","description":"Contacts are kept; only their membership in this list is removed.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/segments":{"get":{"operationId":"listSegments","tags":["Segments"],"summary":"List segments (with contact counts)","description":"`counts=false` skips counting and returns the last computed `contactCount` (with `countedAt`) — use it for pickers. `counts=live` recounts every segment. By default counts are reused until contacts, lists or engagement change.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","enum":["true","false","none","live"]},"required":false,"name":"counts","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["segment"]},"name":{"type":"string"},"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]}]}},"contactCount":{"type":"number"},"countedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","match","conditions","contactCount","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createSegment","tags":["Segments"],"summary":"Create a segment","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"match":{"type":"string","enum":["all","any"],"default":"all"},"conditions":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]}]},"minItems":1}},"required":["name","conditions"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["segment"]},"name":{"type":"string"},"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]}]}},"contactCount":{"type":"number"},"countedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","match","conditions","contactCount","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/segments/preview":{"post":{"operationId":"previewSegment","tags":["Segments"],"summary":"Count contacts matching unsaved conditions","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"],"default":"all"},"conditions":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]}]},"minItems":1}},"required":["conditions"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"number"},"sample":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["contact"]},"email":{"type":"string"},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"phone":{"type":["string","null"]},"attributes":{"type":"object","additionalProperties":{}},"listIds":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]},"source":{"type":["string","null"],"enum":["import","api","form","manual",null]},"engagement":{"type":"object","properties":{"lastOpenedAt":{"type":["string","null"]},"lastClickedAt":{"type":["string","null"]},"campaignsReceived":{"type":"number"},"opens":{"type":"number"},"clicks":{"type":"number"}},"required":["lastOpenedAt","lastClickedAt","campaignsReceived","opens","clicks"]},"quality":{"type":["string","null"],"enum":["ok","invalid","typo","no_mx","disposable","role",null],"description":"Address quality: ok, invalid, typo, no_mx (the domain has no mail server), disposable or role. Null until checked."},"qualitySuggestion":{"type":["string","null"],"description":"Corrected address when `quality` is `typo`, for example ann@gmail.com for ann@gmial.com."},"sunsetState":{"type":["string","null"],"enum":["reengage_sent","inactive",null],"description":"Sunsetting: a re-engagement email was sent, or the contact was marked inactive."},"consent":{"type":["object","null"],"properties":{"method":{"type":"string","enum":["double_opt_in","single_opt_in","import","api"]},"formId":{"type":["string","null"]},"submissionId":{"type":["string","null"]},"importId":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"confirmedAt":{"type":["string","null"]},"ipHash":{"type":["string","null"]},"userAgent":{"type":["string","null"]},"consentText":{"type":["string","null"]},"consentVersion":{"type":["number","null"]},"confirmedElsewhere":{"type":"boolean"}},"required":["method"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","email","firstName","lastName","phone","attributes","listIds","status","source","engagement","createdAt","updatedAt"]}}},"required":["count","sample"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/segments/{id}":{"get":{"operationId":"getSegment","tags":["Segments"],"summary":"Get a segment","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["true","false","none","live"]},"required":false,"name":"counts","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["segment"]},"name":{"type":"string"},"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]}]}},"contactCount":{"type":"number"},"countedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","match","conditions","contactCount","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateSegment","tags":["Segments"],"summary":"Update a segment","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"match":{"type":"string","enum":["all","any"],"default":"all"},"conditions":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]}]},"minItems":1}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["segment"]},"name":{"type":"string"},"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]}]}},"contactCount":{"type":"number"},"countedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","object","name","match","conditions","contactCount","createdAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteSegment","tags":["Segments"],"summary":"Delete a segment","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contacts/import-presets":{"get":{"operationId":"listContactImportPresets","tags":["Imports"],"summary":"CSV import presets","description":"Common export layouts: column-name patterns (compared lowercase, letters and digits only) → attribute keys, and source status values → contact status (`skip` leaves the row out). A column mapped to `status` sets the contact status.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"columns":{"type":"array","items":{"type":"object","properties":{"patterns":{"type":"array","items":{"type":"string"}},"key":{"type":"string"}},"required":["patterns","key"]}},"statusColumn":{"type":"array","items":{"type":"string"}},"statusMapping":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","name","description","columns","statusColumn","statusMapping"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contacts/imports":{"post":{"operationId":"uploadContactImport","tags":["Imports"],"summary":"Upload a CSV file (step 1)","description":"Send JSON `{ \"fileName\": \"contacts.csv\", \"csv\": \"<file text>\" }` or multipart/form-data with a `file` field. UTF-8, up to 50 MB and 500,000 rows; `,` `;` and tab delimiters are detected. The response lists the columns with sample values and a suggested attribute for each. Nothing is imported until you call `/start`.","security":[{"bearer":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["import"]},"status":{"type":"string","enum":["uploaded","processing","completed","failed"]},"fileName":{"type":"string"},"totalRows":{"type":"number"},"columns":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"samples":{"type":"array","items":{"type":"string"}},"suggested":{"type":["string","null"]},"values":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"count":{"type":"number"}},"required":["value","count"]},"description":"Distinct values with counts, for status columns"}},"required":["name","samples","suggested"]}},"mapping":{"type":["object","null"],"additionalProperties":{"type":"string"}},"listIds":{"type":"array","items":{"type":"string"}},"updateExisting":{"type":"boolean"},"result":{"type":["object","null"],"properties":{"created":{"type":"number"},"updated":{"type":"number"},"skipped":{"type":"number"},"invalid":{"type":"number"},"errors":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number"},"message":{"type":"string"}},"required":["row","message"]}},"statuses":{"type":"object","additionalProperties":{"type":"number"}},"quality":{"type":"object","properties":{"checked":{"type":"number"},"typos":{"type":"number"},"typosFixed":{"type":"number"},"noMx":{"type":"number"},"disposable":{"type":"number"},"samples":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number"},"email":{"type":"string"},"issue":{"type":"string","enum":["typo","no_mx","disposable"]},"suggestion":{"type":["string","null"]}},"required":["row","email","issue"]}},"available":{"type":"boolean","description":"False when address checks are not available on this server; counts are then zero."}},"required":["checked","typos","typosFixed","noMx","disposable","samples","available"]}},"required":["created","updated","skipped","invalid","errors"]},"options":{"type":["object","null"],"properties":{"preset":{"type":["string","null"]},"statusMapping":{"type":"object","additionalProperties":{"type":"string"}},"consentConfirmedElsewhere":{"type":"boolean"},"fixTypos":{"type":"boolean"}}},"detectedPreset":{"type":["string","null"]},"statusValues":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"count":{"type":"number"},"suggested":{"type":"string"}},"required":["value","count","suggested"]}},"createdAt":{"type":"string"},"completedAt":{"type":["string","null"]}},"required":["id","object","status","fileName","totalRows","columns","mapping","listIds","updateExisting","result","createdAt","completedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"get":{"operationId":"listContactImports","tags":["Imports"],"summary":"Import history","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["import"]},"status":{"type":"string","enum":["uploaded","processing","completed","failed"]},"fileName":{"type":"string"},"totalRows":{"type":"number"},"columns":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"samples":{"type":"array","items":{"type":"string"}},"suggested":{"type":["string","null"]},"values":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"count":{"type":"number"}},"required":["value","count"]},"description":"Distinct values with counts, for status columns"}},"required":["name","samples","suggested"]}},"mapping":{"type":["object","null"],"additionalProperties":{"type":"string"}},"listIds":{"type":"array","items":{"type":"string"}},"updateExisting":{"type":"boolean"},"result":{"type":["object","null"],"properties":{"created":{"type":"number"},"updated":{"type":"number"},"skipped":{"type":"number"},"invalid":{"type":"number"},"errors":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number"},"message":{"type":"string"}},"required":["row","message"]}},"statuses":{"type":"object","additionalProperties":{"type":"number"}},"quality":{"type":"object","properties":{"checked":{"type":"number"},"typos":{"type":"number"},"typosFixed":{"type":"number"},"noMx":{"type":"number"},"disposable":{"type":"number"},"samples":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number"},"email":{"type":"string"},"issue":{"type":"string","enum":["typo","no_mx","disposable"]},"suggestion":{"type":["string","null"]}},"required":["row","email","issue"]}},"available":{"type":"boolean","description":"False when address checks are not available on this server; counts are then zero."}},"required":["checked","typos","typosFixed","noMx","disposable","samples","available"]}},"required":["created","updated","skipped","invalid","errors"]},"options":{"type":["object","null"],"properties":{"preset":{"type":["string","null"]},"statusMapping":{"type":"object","additionalProperties":{"type":"string"}},"consentConfirmedElsewhere":{"type":"boolean"},"fixTypos":{"type":"boolean"}}},"detectedPreset":{"type":["string","null"]},"statusValues":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"count":{"type":"number"},"suggested":{"type":"string"}},"required":["value","count","suggested"]}},"createdAt":{"type":"string"},"completedAt":{"type":["string","null"]}},"required":["id","object","status","fileName","totalRows","columns","mapping","listIds","updateExisting","result","createdAt","completedAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contacts/imports/{id}":{"get":{"operationId":"getContactImport","tags":["Imports"],"summary":"Get an import (poll while processing)","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["import"]},"status":{"type":"string","enum":["uploaded","processing","completed","failed"]},"fileName":{"type":"string"},"totalRows":{"type":"number"},"columns":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"samples":{"type":"array","items":{"type":"string"}},"suggested":{"type":["string","null"]},"values":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"count":{"type":"number"}},"required":["value","count"]},"description":"Distinct values with counts, for status columns"}},"required":["name","samples","suggested"]}},"mapping":{"type":["object","null"],"additionalProperties":{"type":"string"}},"listIds":{"type":"array","items":{"type":"string"}},"updateExisting":{"type":"boolean"},"result":{"type":["object","null"],"properties":{"created":{"type":"number"},"updated":{"type":"number"},"skipped":{"type":"number"},"invalid":{"type":"number"},"errors":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number"},"message":{"type":"string"}},"required":["row","message"]}},"statuses":{"type":"object","additionalProperties":{"type":"number"}},"quality":{"type":"object","properties":{"checked":{"type":"number"},"typos":{"type":"number"},"typosFixed":{"type":"number"},"noMx":{"type":"number"},"disposable":{"type":"number"},"samples":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number"},"email":{"type":"string"},"issue":{"type":"string","enum":["typo","no_mx","disposable"]},"suggestion":{"type":["string","null"]}},"required":["row","email","issue"]}},"available":{"type":"boolean","description":"False when address checks are not available on this server; counts are then zero."}},"required":["checked","typos","typosFixed","noMx","disposable","samples","available"]}},"required":["created","updated","skipped","invalid","errors"]},"options":{"type":["object","null"],"properties":{"preset":{"type":["string","null"]},"statusMapping":{"type":"object","additionalProperties":{"type":"string"}},"consentConfirmedElsewhere":{"type":"boolean"},"fixTypos":{"type":"boolean"}}},"detectedPreset":{"type":["string","null"]},"statusValues":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"count":{"type":"number"},"suggested":{"type":"string"}},"required":["value","count","suggested"]}},"createdAt":{"type":"string"},"completedAt":{"type":["string","null"]},"processedRows":{"type":"number"}},"required":["id","object","status","fileName","totalRows","columns","mapping","listIds","updateExisting","result","createdAt","completedAt","processedRows"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contacts/imports/{id}/start":{"post":{"operationId":"startContactImport","tags":["Imports"],"summary":"Map columns and start the import (step 2)","description":"`mapping` maps each CSV column name to an attribute key or `ignore`; exactly one column must map to `email`. `consentConfirmed` must be true. Contacts already suppressed (bounced, complained, unsubscribed) are imported with that status and are never mailed.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mapping":{"type":"object","additionalProperties":{"type":"string"},"description":"CSV column name → attribute key (`email`, `first_name`, `plan`, …) or `ignore`."},"listIds":{"type":"array","items":{"type":"string"},"default":[],"description":"Lists every imported contact is added to."},"newListName":{"type":"string","description":"Create a list with this name and add the imported contacts to it."},"updateExisting":{"type":"boolean","default":true,"description":"`true`: existing contacts are updated and added to the lists. `false`: rows for existing contacts are skipped entirely (not updated, not added to lists)."},"createMissingAttributes":{"type":"boolean","default":true,"description":"Create contact attributes for mapped keys that do not exist yet."},"consentConfirmed":{"type":"boolean","enum":[true],"description":"You confirm these people agreed to receive email from you."},"preset":{"type":"string","description":"Source preset id from `GET /v1/contacts/import-presets` (recorded with the import; mapping is still taken from `mapping`)."},"statusMapping":{"type":"object","additionalProperties":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","skip"]},"description":"With a column mapped to `status`: source value (case-insensitive) → contact status, or `skip` to leave those rows out. Values not listed use the preset mapping, then `subscribed`."},"consentConfirmedElsewhere":{"type":"boolean","description":"Record on each imported contact that consent was collected outside OneSend (stored as consent proof with method `import`)."},"fixTypos":{"type":"boolean","description":"Replace addresses that have a likely domain typo (gmial.com → gmail.com) with the suggested address."}},"required":["mapping","consentConfirmed"]}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["import"]},"status":{"type":"string","enum":["uploaded","processing","completed","failed"]},"fileName":{"type":"string"},"totalRows":{"type":"number"},"columns":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"samples":{"type":"array","items":{"type":"string"}},"suggested":{"type":["string","null"]},"values":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"count":{"type":"number"}},"required":["value","count"]},"description":"Distinct values with counts, for status columns"}},"required":["name","samples","suggested"]}},"mapping":{"type":["object","null"],"additionalProperties":{"type":"string"}},"listIds":{"type":"array","items":{"type":"string"}},"updateExisting":{"type":"boolean"},"result":{"type":["object","null"],"properties":{"created":{"type":"number"},"updated":{"type":"number"},"skipped":{"type":"number"},"invalid":{"type":"number"},"errors":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number"},"message":{"type":"string"}},"required":["row","message"]}},"statuses":{"type":"object","additionalProperties":{"type":"number"}},"quality":{"type":"object","properties":{"checked":{"type":"number"},"typos":{"type":"number"},"typosFixed":{"type":"number"},"noMx":{"type":"number"},"disposable":{"type":"number"},"samples":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number"},"email":{"type":"string"},"issue":{"type":"string","enum":["typo","no_mx","disposable"]},"suggestion":{"type":["string","null"]}},"required":["row","email","issue"]}},"available":{"type":"boolean","description":"False when address checks are not available on this server; counts are then zero."}},"required":["checked","typos","typosFixed","noMx","disposable","samples","available"]}},"required":["created","updated","skipped","invalid","errors"]},"options":{"type":["object","null"],"properties":{"preset":{"type":["string","null"]},"statusMapping":{"type":"object","additionalProperties":{"type":"string"}},"consentConfirmedElsewhere":{"type":"boolean"},"fixTypos":{"type":"boolean"}}},"detectedPreset":{"type":["string","null"]},"statusValues":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"count":{"type":"number"},"suggested":{"type":"string"}},"required":["value","count","suggested"]}},"createdAt":{"type":"string"},"completedAt":{"type":["string","null"]}},"required":["id","object","status","fileName","totalRows","columns","mapping","listIds","updateExisting","result","createdAt","completedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contacts/imports/{id}/errors.csv":{"get":{"operationId":"getContactImportErrors","tags":["Imports"],"summary":"Download rows that were not imported (CSV)","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contacts":{"get":{"operationId":"listContacts","tags":["Contacts"],"summary":"List contacts","description":"`cursor` is a row offset: pass back `nextCursor` unchanged. `total` is the number of matching contacts.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"string"},"required":false,"name":"listId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"segmentId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","description":"Comma separated address quality values (ok, invalid, typo, no_mx, disposable, role, unchecked)."},"required":false,"description":"Comma separated address quality values (ok, invalid, typo, no_mx, disposable, role, unchecked).","name":"quality","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["contact"]},"email":{"type":"string"},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"phone":{"type":["string","null"]},"attributes":{"type":"object","additionalProperties":{}},"listIds":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]},"source":{"type":["string","null"],"enum":["import","api","form","manual",null]},"engagement":{"type":"object","properties":{"lastOpenedAt":{"type":["string","null"]},"lastClickedAt":{"type":["string","null"]},"campaignsReceived":{"type":"number"},"opens":{"type":"number"},"clicks":{"type":"number"}},"required":["lastOpenedAt","lastClickedAt","campaignsReceived","opens","clicks"]},"quality":{"type":["string","null"],"enum":["ok","invalid","typo","no_mx","disposable","role",null],"description":"Address quality: ok, invalid, typo, no_mx (the domain has no mail server), disposable or role. Null until checked."},"qualitySuggestion":{"type":["string","null"],"description":"Corrected address when `quality` is `typo`, for example ann@gmail.com for ann@gmial.com."},"sunsetState":{"type":["string","null"],"enum":["reengage_sent","inactive",null],"description":"Sunsetting: a re-engagement email was sent, or the contact was marked inactive."},"consent":{"type":["object","null"],"properties":{"method":{"type":"string","enum":["double_opt_in","single_opt_in","import","api"]},"formId":{"type":["string","null"]},"submissionId":{"type":["string","null"]},"importId":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"confirmedAt":{"type":["string","null"]},"ipHash":{"type":["string","null"]},"userAgent":{"type":["string","null"]},"consentText":{"type":["string","null"]},"consentVersion":{"type":["number","null"]},"confirmedElsewhere":{"type":"boolean"}},"required":["method"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","email","firstName","lastName","phone","attributes","listIds","status","source","engagement","createdAt","updatedAt"]}},"nextCursor":{"type":["string","null"]},"total":{"type":"number"}},"required":["data","nextCursor","total"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createContact","tags":["Contacts"],"summary":"Create or update a contact (by email)","description":"Attributes are merged; `null` removes one. `listIds` are added to existing memberships.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"Unique per workspace; stored lowercased. Creating an existing email updates that contact."},"firstName":{"type":["string","null"],"description":"Available in templates as `{{first_name}}`."},"lastName":{"type":["string","null"],"description":"Available in templates as `{{last_name}}`."},"phone":{"type":["string","null"]},"attributes":{"type":"object","additionalProperties":{},"description":"Custom attributes by key, for example `{ \"plan\": \"pro\" }`. Available in templates as `{{plan}}` or `{{contact.plan}}`. Keys you have not created under contact attributes are stored, but not exported or offered in the segment builder."},"listIds":{"type":"array","items":{"type":"string"},"description":"Lists to add the contact to."},"status":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"],"description":"Defaults to `subscribed`."}},"required":["email"],"example":{"email":"ada@example.com","firstName":"Ada","lastName":"Lovelace","attributes":{"plan":"pro"},"listIds":["lst_…"]}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["contact"]},"email":{"type":"string"},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"phone":{"type":["string","null"]},"attributes":{"type":"object","additionalProperties":{}},"listIds":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]},"source":{"type":["string","null"],"enum":["import","api","form","manual",null]},"engagement":{"type":"object","properties":{"lastOpenedAt":{"type":["string","null"]},"lastClickedAt":{"type":["string","null"]},"campaignsReceived":{"type":"number"},"opens":{"type":"number"},"clicks":{"type":"number"}},"required":["lastOpenedAt","lastClickedAt","campaignsReceived","opens","clicks"]},"quality":{"type":["string","null"],"enum":["ok","invalid","typo","no_mx","disposable","role",null],"description":"Address quality: ok, invalid, typo, no_mx (the domain has no mail server), disposable or role. Null until checked."},"qualitySuggestion":{"type":["string","null"],"description":"Corrected address when `quality` is `typo`, for example ann@gmail.com for ann@gmial.com."},"sunsetState":{"type":["string","null"],"enum":["reengage_sent","inactive",null],"description":"Sunsetting: a re-engagement email was sent, or the contact was marked inactive."},"consent":{"type":["object","null"],"properties":{"method":{"type":"string","enum":["double_opt_in","single_opt_in","import","api"]},"formId":{"type":["string","null"]},"submissionId":{"type":["string","null"]},"importId":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"confirmedAt":{"type":["string","null"]},"ipHash":{"type":["string","null"]},"userAgent":{"type":["string","null"]},"consentText":{"type":["string","null"]},"consentVersion":{"type":["number","null"]},"confirmedElsewhere":{"type":"boolean"}},"required":["method"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","email","firstName","lastName","phone","attributes","listIds","status","source","engagement","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contacts/bulk":{"post":{"operationId":"bulkUpdateContacts","tags":["Contacts"],"summary":"Bulk actions on contacts","description":"Actions: `add_to_list` / `remove_from_list` (with `listId` or `listIds`), `unsubscribe`, `resubscribe` (only contacts that unsubscribed, never bounced or complained ones), `delete`.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":10000},"action":{"type":"string","enum":["add_to_lists","remove_from_lists","add_to_list","remove_from_list","unsubscribe","resubscribe","delete"]},"listIds":{"type":"array","items":{"type":"string"}},"listId":{"type":"string"}},"required":["ids","action"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"number"},"affected":{"type":"number"}},"required":["updated","affected"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contacts/export":{"get":{"operationId":"exportContacts","tags":["Contacts"],"summary":"Export contacts as CSV (streamed)","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","enum":["csv"],"default":"csv"},"required":false,"name":"format","in":"query"},{"schema":{"type":"string"},"required":false,"name":"listId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"segmentId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"}],"responses":{"200":{"description":"Success","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contacts/{id}":{"get":{"operationId":"getContact","tags":["Contacts"],"summary":"Get a contact","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["contact"]},"email":{"type":"string"},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"phone":{"type":["string","null"]},"attributes":{"type":"object","additionalProperties":{}},"listIds":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]},"source":{"type":["string","null"],"enum":["import","api","form","manual",null]},"engagement":{"type":"object","properties":{"lastOpenedAt":{"type":["string","null"]},"lastClickedAt":{"type":["string","null"]},"campaignsReceived":{"type":"number"},"opens":{"type":"number"},"clicks":{"type":"number"}},"required":["lastOpenedAt","lastClickedAt","campaignsReceived","opens","clicks"]},"quality":{"type":["string","null"],"enum":["ok","invalid","typo","no_mx","disposable","role",null],"description":"Address quality: ok, invalid, typo, no_mx (the domain has no mail server), disposable or role. Null until checked."},"qualitySuggestion":{"type":["string","null"],"description":"Corrected address when `quality` is `typo`, for example ann@gmail.com for ann@gmial.com."},"sunsetState":{"type":["string","null"],"enum":["reengage_sent","inactive",null],"description":"Sunsetting: a re-engagement email was sent, or the contact was marked inactive."},"consent":{"type":["object","null"],"properties":{"method":{"type":"string","enum":["double_opt_in","single_opt_in","import","api"]},"formId":{"type":["string","null"]},"submissionId":{"type":["string","null"]},"importId":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"confirmedAt":{"type":["string","null"]},"ipHash":{"type":["string","null"]},"userAgent":{"type":["string","null"]},"consentText":{"type":["string","null"]},"consentVersion":{"type":["number","null"]},"confirmedElsewhere":{"type":"boolean"}},"required":["method"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","email","firstName","lastName","phone","attributes","listIds","status","source","engagement","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateContact","tags":["Contacts"],"summary":"Update a contact","description":"Attributes are merged (`null` removes one). `listIds`, when given, replaces the contact’s list memberships. Setting `status: \"subscribed\"` resubscribes an unsubscribed contact.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"Unique per workspace; stored lowercased. Creating an existing email updates that contact."},"firstName":{"type":["string","null"],"description":"Available in templates as `{{first_name}}`."},"lastName":{"type":["string","null"],"description":"Available in templates as `{{last_name}}`."},"phone":{"type":["string","null"]},"attributes":{"type":"object","additionalProperties":{},"description":"Custom attributes by key, for example `{ \"plan\": \"pro\" }`. Available in templates as `{{plan}}` or `{{contact.plan}}`. Keys you have not created under contact attributes are stored, but not exported or offered in the segment builder."},"listIds":{"type":"array","items":{"type":"string"},"description":"Lists to add the contact to."},"status":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"],"description":"Defaults to `subscribed`."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["contact"]},"email":{"type":"string"},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"phone":{"type":["string","null"]},"attributes":{"type":"object","additionalProperties":{}},"listIds":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]},"source":{"type":["string","null"],"enum":["import","api","form","manual",null]},"engagement":{"type":"object","properties":{"lastOpenedAt":{"type":["string","null"]},"lastClickedAt":{"type":["string","null"]},"campaignsReceived":{"type":"number"},"opens":{"type":"number"},"clicks":{"type":"number"}},"required":["lastOpenedAt","lastClickedAt","campaignsReceived","opens","clicks"]},"quality":{"type":["string","null"],"enum":["ok","invalid","typo","no_mx","disposable","role",null],"description":"Address quality: ok, invalid, typo, no_mx (the domain has no mail server), disposable or role. Null until checked."},"qualitySuggestion":{"type":["string","null"],"description":"Corrected address when `quality` is `typo`, for example ann@gmail.com for ann@gmial.com."},"sunsetState":{"type":["string","null"],"enum":["reengage_sent","inactive",null],"description":"Sunsetting: a re-engagement email was sent, or the contact was marked inactive."},"consent":{"type":["object","null"],"properties":{"method":{"type":"string","enum":["double_opt_in","single_opt_in","import","api"]},"formId":{"type":["string","null"]},"submissionId":{"type":["string","null"]},"importId":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"confirmedAt":{"type":["string","null"]},"ipHash":{"type":["string","null"]},"userAgent":{"type":["string","null"]},"consentText":{"type":["string","null"]},"consentVersion":{"type":["number","null"]},"confirmedElsewhere":{"type":"boolean"}},"required":["method"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","email","firstName","lastName","phone","attributes","listIds","status","source","engagement","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteContact","tags":["Contacts"],"summary":"Delete a contact","description":"Removes the contact and its list memberships. Suppressions are kept, so a deleted address that bounced stays blocked. With `erase=true` (GDPR erasure), the address is also removed from messages, events, campaign recipients, clicks, conversions, form submissions and received mail, and a suppression keyed by a hash of the address keeps the person from being mailed again. See docs/privacy.md.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"erase","in":"query"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contacts/{id}/activity":{"get":{"operationId":"getContactActivity","tags":["Contacts"],"summary":"Contact activity timeline","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["sent","delivered","opened","clicked","bounced","unsubscribed","complained","converted","added_to_list","imported"]},"campaignId":{"type":["string","null"]},"campaignName":{"type":["string","null"]},"messageId":{"type":["string","null"]},"detail":{"type":["string","null"]},"occurredAt":{"type":"string"}},"required":["type","campaignId","campaignName","messageId","detail","occurredAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns":{"get":{"operationId":"listCampaigns","tags":["Campaigns"],"summary":"List campaigns with headline stats","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["campaign"]},"name":{"type":"string"},"status":{"type":"string","enum":["draft","scheduled","sending","sent","paused","canceled","failed"]},"subject":{"type":"string"},"previewText":{"type":["string","null"]},"fromName":{"type":"string"},"fromEmail":{"type":"string"},"replyTo":{"type":["string","null"]},"templateId":{"type":["string","null"]},"recipients":{"type":"object","properties":{"listIds":{"type":"array","items":{"type":"string"}},"segmentIds":{"type":"array","items":{"type":"string"}},"excludeListIds":{"type":"array","items":{"type":"string"}}},"required":["listIds","segmentIds","excludeListIds"]},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"utm":{"type":["object","null"],"properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaign":{"type":"string"}},"required":["source","medium","campaign"]}},"required":["opens","clicks","utm"]},"currency":{"type":"string","default":"USD"},"tags":{"type":"array","items":{"type":"string"}},"policyId":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"estimatedRecipients":{"type":["number","null"]},"plan":{"type":["object","null"],"properties":{"perDay":{"type":"number"},"days":{"type":"number"},"unlimited":{"type":"boolean","description":"No provider daily limit: everything is sent today (perDay is the audience size)."},"limitedBy":{"type":"string","enum":["quota","warmup","pacing"],"description":"What spreads the campaign over more than one day: provider quotas, the sending domain's warm-up, or per mailbox provider pacing."},"reason":{"type":"string","description":"One sentence explaining the plan, for example \"Sends over 4 days because acme.dev is warming up.\""},"domain":{"type":"string"}},"required":["perDay","days"]},"delivery":{"type":["object","null"],"properties":{"bestTime":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"includeInactive":{"type":"boolean"}},"description":"Delivery options: send each email at the recipient's best time within 24 hours, and include contacts with address problems or inactive contacts (both skipped by default)."},"pausedReason":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["bounce_rate","complaint_rate","workspace_guard","manual"]},"auto":{"type":"boolean"},"message":{"type":"string"},"at":{"type":"string"},"value":{"type":"number"},"threshold":{"type":"number"},"sample":{"type":"number"}},"required":["code","auto","message","at"],"description":"Why the campaign is paused. `auto: true` when a safeguard paused it; it stays paused until resumed."},"abTest":{"type":["object","null"],"properties":{"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"],"maxLength":80},"subject":{"type":["string","null"],"maxLength":998},"previewText":{"type":["string","null"],"maxLength":300},"fromName":{"type":["string","null"],"maxLength":200},"templateId":{"type":["string","null"]},"html":{"type":["string","null"]}},"required":["id"]}},"testPercent":{"type":"number"},"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"],"enum":["testing","waiting_for_pick","winner_sent",null],"description":"Set once sending starts."},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"],"enum":["auto","manual",null]}},"required":["variants","testPercent","metric","durationHours","winnerSelection"],"description":"A/B test settings and progress."},"stats":{"type":["object","null"],"properties":{"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"opens":{"type":"number"},"uniqueClicks":{"type":"number"},"clicks":{"type":"number"},"hardBounces":{"type":"number"},"softBounces":{"type":"number"},"unsubscribes":{"type":"number"},"complaints":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]}},"required":["recipients","sent","delivered","uniqueOpens","opens","uniqueClicks","clicks","hardBounces","softBounces","unsubscribes","complaints","conversions","revenue","rates"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","subject","previewText","fromName","fromEmail","replyTo","templateId","recipients","tracking","tags","policyId","scheduledAt","sentAt","estimatedRecipients","plan","stats","createdAt","updatedAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createCampaign","tags":["Campaigns"],"summary":"Create a draft campaign","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"description":"Internal name, shown in lists and reports."},"subject":{"type":"string","maxLength":998,"description":"Subject line. `{{variables}}` (contact fields such as `{{first_name}}`) are filled in per recipient."},"previewText":{"type":["string","null"],"maxLength":300,"description":"Preview text shown after the subject in most inboxes."},"fromName":{"type":"string","description":"Sender name, for example \"Acme\"."},"fromEmail":{"type":"string","description":"Sender address, for example news@acme.com. Its domain should be verified."},"replyTo":{"type":["string","null"],"description":"Reply-To address."},"templateId":{"type":["string","null"],"description":"Saved template to send. Its variables are filled from each contact; see `GET /v1/campaigns/{id}/check` for variables no contact field provides."},"html":{"type":"string","description":"HTML content when not using a template."},"recipients":{"type":"object","properties":{"listIds":{"type":"array","items":{"type":"string"},"default":[]},"segmentIds":{"type":"array","items":{"type":"string"},"default":[]},"excludeListIds":{"type":"array","items":{"type":"string"},"default":[]}},"additionalProperties":false,"description":"Contacts in any of `listIds` or `segmentIds`, minus `excludeListIds`. Unsubscribed, bounced and suppressed contacts are skipped."},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"utm":{"type":["object","null"],"properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaign":{"type":"string"}},"required":["source","medium","campaign"]}},"additionalProperties":false,"description":"Open and click tracking, and UTM parameters added to links."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO currency for revenue in reports, for example USD."},"tags":{"type":"array","items":{"type":"string"}},"policyId":{"type":["string","null"],"description":"Routing policy; defaults to the workspace default."},"delivery":{"type":["object","null"],"properties":{"bestTime":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"includeInactive":{"type":"boolean"}},"additionalProperties":false,"description":"`bestTime`: send each email at the hour the recipient usually opens (within 24 hours of the start). `includeQualityIssues` and `includeInactive` include contacts that campaigns skip by default."},"abTest":{"type":["object","null"],"properties":{"enabled":{"type":"boolean","description":"`false` turns the test off (same as `abTest: null`)."},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"a, b, c or d (assigned in order)."},"name":{"type":["string","null"],"maxLength":80},"subject":{"type":["string","null"],"maxLength":998},"previewText":{"type":["string","null"],"maxLength":300},"fromName":{"type":["string","null"],"maxLength":200},"templateId":{"type":["string","null"]},"html":{"type":["string","null"]}}},"minItems":2,"maxItems":4},"testPercent":{"type":"number","minimum":5,"maximum":50,"description":"Share of the recipients in the test group, split evenly between the variants. Default 20."},"metric":{"type":"string","enum":["open","click","conversion","revenue"],"description":"How the winner is picked: open, click or conversion rate, or revenue per delivered email. Default open."},"durationHours":{"type":"number","minimum":1,"maximum":168,"description":"How long the test group gets before the winner is picked. Default 4."},"winnerSelection":{"type":"string","enum":["auto","manual"],"description":"`auto`: the leading variant is sent to the rest when the test ends. `manual`: the campaign waits for POST /v1/campaigns/{id}/ab-test/winner."}},"additionalProperties":false,"description":"A/B test: 2 to 4 variants sent to a test group first; the winner goes to the rest. `null` turns it off."}},"required":["name"],"additionalProperties":false,"example":{"name":"November newsletter","subject":"News for {{first_name}}","fromName":"Acme","fromEmail":"news@acme.com","templateId":"tpl_…","recipients":{"listIds":["lst_…"],"segmentIds":[],"excludeListIds":[]}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["campaign"]},"name":{"type":"string"},"status":{"type":"string","enum":["draft","scheduled","sending","sent","paused","canceled","failed"]},"subject":{"type":"string"},"previewText":{"type":["string","null"]},"fromName":{"type":"string"},"fromEmail":{"type":"string"},"replyTo":{"type":["string","null"]},"templateId":{"type":["string","null"]},"recipients":{"type":"object","properties":{"listIds":{"type":"array","items":{"type":"string"}},"segmentIds":{"type":"array","items":{"type":"string"}},"excludeListIds":{"type":"array","items":{"type":"string"}}},"required":["listIds","segmentIds","excludeListIds"]},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"utm":{"type":["object","null"],"properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaign":{"type":"string"}},"required":["source","medium","campaign"]}},"required":["opens","clicks","utm"]},"currency":{"type":"string","default":"USD"},"tags":{"type":"array","items":{"type":"string"}},"policyId":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"estimatedRecipients":{"type":["number","null"]},"plan":{"type":["object","null"],"properties":{"perDay":{"type":"number"},"days":{"type":"number"},"unlimited":{"type":"boolean","description":"No provider daily limit: everything is sent today (perDay is the audience size)."},"limitedBy":{"type":"string","enum":["quota","warmup","pacing"],"description":"What spreads the campaign over more than one day: provider quotas, the sending domain's warm-up, or per mailbox provider pacing."},"reason":{"type":"string","description":"One sentence explaining the plan, for example \"Sends over 4 days because acme.dev is warming up.\""},"domain":{"type":"string"}},"required":["perDay","days"]},"delivery":{"type":["object","null"],"properties":{"bestTime":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"includeInactive":{"type":"boolean"}},"description":"Delivery options: send each email at the recipient's best time within 24 hours, and include contacts with address problems or inactive contacts (both skipped by default)."},"pausedReason":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["bounce_rate","complaint_rate","workspace_guard","manual"]},"auto":{"type":"boolean"},"message":{"type":"string"},"at":{"type":"string"},"value":{"type":"number"},"threshold":{"type":"number"},"sample":{"type":"number"}},"required":["code","auto","message","at"],"description":"Why the campaign is paused. `auto: true` when a safeguard paused it; it stays paused until resumed."},"abTest":{"type":["object","null"],"properties":{"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"],"maxLength":80},"subject":{"type":["string","null"],"maxLength":998},"previewText":{"type":["string","null"],"maxLength":300},"fromName":{"type":["string","null"],"maxLength":200},"templateId":{"type":["string","null"]},"html":{"type":["string","null"]}},"required":["id"]}},"testPercent":{"type":"number"},"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"],"enum":["testing","waiting_for_pick","winner_sent",null],"description":"Set once sending starts."},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"],"enum":["auto","manual",null]}},"required":["variants","testPercent","metric","durationHours","winnerSelection"],"description":"A/B test settings and progress."},"stats":{"type":["object","null"],"properties":{"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"opens":{"type":"number"},"uniqueClicks":{"type":"number"},"clicks":{"type":"number"},"hardBounces":{"type":"number"},"softBounces":{"type":"number"},"unsubscribes":{"type":"number"},"complaints":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]}},"required":["recipients","sent","delivered","uniqueOpens","opens","uniqueClicks","clicks","hardBounces","softBounces","unsubscribes","complaints","conversions","revenue","rates"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","subject","previewText","fromName","fromEmail","replyTo","templateId","recipients","tracking","tags","policyId","scheduledAt","sentAt","estimatedRecipients","plan","stats","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}":{"get":{"operationId":"getCampaign","tags":["Campaigns"],"summary":"Get a campaign","description":"Drafts include a live recipient estimate and sending plan; started campaigns include stats.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["campaign"]},"name":{"type":"string"},"status":{"type":"string","enum":["draft","scheduled","sending","sent","paused","canceled","failed"]},"subject":{"type":"string"},"previewText":{"type":["string","null"]},"fromName":{"type":"string"},"fromEmail":{"type":"string"},"replyTo":{"type":["string","null"]},"templateId":{"type":["string","null"]},"recipients":{"type":"object","properties":{"listIds":{"type":"array","items":{"type":"string"}},"segmentIds":{"type":"array","items":{"type":"string"}},"excludeListIds":{"type":"array","items":{"type":"string"}}},"required":["listIds","segmentIds","excludeListIds"]},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"utm":{"type":["object","null"],"properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaign":{"type":"string"}},"required":["source","medium","campaign"]}},"required":["opens","clicks","utm"]},"currency":{"type":"string","default":"USD"},"tags":{"type":"array","items":{"type":"string"}},"policyId":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"estimatedRecipients":{"type":["number","null"]},"plan":{"type":["object","null"],"properties":{"perDay":{"type":"number"},"days":{"type":"number"},"unlimited":{"type":"boolean","description":"No provider daily limit: everything is sent today (perDay is the audience size)."},"limitedBy":{"type":"string","enum":["quota","warmup","pacing"],"description":"What spreads the campaign over more than one day: provider quotas, the sending domain's warm-up, or per mailbox provider pacing."},"reason":{"type":"string","description":"One sentence explaining the plan, for example \"Sends over 4 days because acme.dev is warming up.\""},"domain":{"type":"string"}},"required":["perDay","days"]},"delivery":{"type":["object","null"],"properties":{"bestTime":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"includeInactive":{"type":"boolean"}},"description":"Delivery options: send each email at the recipient's best time within 24 hours, and include contacts with address problems or inactive contacts (both skipped by default)."},"pausedReason":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["bounce_rate","complaint_rate","workspace_guard","manual"]},"auto":{"type":"boolean"},"message":{"type":"string"},"at":{"type":"string"},"value":{"type":"number"},"threshold":{"type":"number"},"sample":{"type":"number"}},"required":["code","auto","message","at"],"description":"Why the campaign is paused. `auto: true` when a safeguard paused it; it stays paused until resumed."},"abTest":{"type":["object","null"],"properties":{"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"],"maxLength":80},"subject":{"type":["string","null"],"maxLength":998},"previewText":{"type":["string","null"],"maxLength":300},"fromName":{"type":["string","null"],"maxLength":200},"templateId":{"type":["string","null"]},"html":{"type":["string","null"]}},"required":["id"]}},"testPercent":{"type":"number"},"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"],"enum":["testing","waiting_for_pick","winner_sent",null],"description":"Set once sending starts."},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"],"enum":["auto","manual",null]}},"required":["variants","testPercent","metric","durationHours","winnerSelection"],"description":"A/B test settings and progress."},"stats":{"type":["object","null"],"properties":{"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"opens":{"type":"number"},"uniqueClicks":{"type":"number"},"clicks":{"type":"number"},"hardBounces":{"type":"number"},"softBounces":{"type":"number"},"unsubscribes":{"type":"number"},"complaints":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]}},"required":["recipients","sent","delivered","uniqueOpens","opens","uniqueClicks","clicks","hardBounces","softBounces","unsubscribes","complaints","conversions","revenue","rates"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","subject","previewText","fromName","fromEmail","replyTo","templateId","recipients","tracking","tags","policyId","scheduledAt","sentAt","estimatedRecipients","plan","stats","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateCampaign","tags":["Campaigns"],"summary":"Edit a campaign","description":"Drafts and scheduled campaigns can be edited. Once sending has started only the name and tags can change.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"description":"Internal name, shown in lists and reports."},"subject":{"type":"string","maxLength":998,"description":"Subject line. `{{variables}}` (contact fields such as `{{first_name}}`) are filled in per recipient."},"previewText":{"type":["string","null"],"maxLength":300,"description":"Preview text shown after the subject in most inboxes."},"fromName":{"type":"string","description":"Sender name, for example \"Acme\"."},"fromEmail":{"type":"string","description":"Sender address, for example news@acme.com. Its domain should be verified."},"replyTo":{"type":["string","null"],"description":"Reply-To address."},"templateId":{"type":["string","null"],"description":"Saved template to send. Its variables are filled from each contact; see `GET /v1/campaigns/{id}/check` for variables no contact field provides."},"html":{"type":"string","description":"HTML content when not using a template."},"recipients":{"type":"object","properties":{"listIds":{"type":"array","items":{"type":"string"},"default":[]},"segmentIds":{"type":"array","items":{"type":"string"},"default":[]},"excludeListIds":{"type":"array","items":{"type":"string"},"default":[]}},"additionalProperties":false,"description":"Contacts in any of `listIds` or `segmentIds`, minus `excludeListIds`. Unsubscribed, bounced and suppressed contacts are skipped."},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"utm":{"type":["object","null"],"properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaign":{"type":"string"}},"required":["source","medium","campaign"]}},"additionalProperties":false,"description":"Open and click tracking, and UTM parameters added to links."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO currency for revenue in reports, for example USD."},"tags":{"type":"array","items":{"type":"string"}},"policyId":{"type":["string","null"],"description":"Routing policy; defaults to the workspace default."},"delivery":{"type":["object","null"],"properties":{"bestTime":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"includeInactive":{"type":"boolean"}},"additionalProperties":false,"description":"`bestTime`: send each email at the hour the recipient usually opens (within 24 hours of the start). `includeQualityIssues` and `includeInactive` include contacts that campaigns skip by default."},"abTest":{"type":["object","null"],"properties":{"enabled":{"type":"boolean","description":"`false` turns the test off (same as `abTest: null`)."},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"a, b, c or d (assigned in order)."},"name":{"type":["string","null"],"maxLength":80},"subject":{"type":["string","null"],"maxLength":998},"previewText":{"type":["string","null"],"maxLength":300},"fromName":{"type":["string","null"],"maxLength":200},"templateId":{"type":["string","null"]},"html":{"type":["string","null"]}}},"minItems":2,"maxItems":4},"testPercent":{"type":"number","minimum":5,"maximum":50,"description":"Share of the recipients in the test group, split evenly between the variants. Default 20."},"metric":{"type":"string","enum":["open","click","conversion","revenue"],"description":"How the winner is picked: open, click or conversion rate, or revenue per delivered email. Default open."},"durationHours":{"type":"number","minimum":1,"maximum":168,"description":"How long the test group gets before the winner is picked. Default 4."},"winnerSelection":{"type":"string","enum":["auto","manual"],"description":"`auto`: the leading variant is sent to the rest when the test ends. `manual`: the campaign waits for POST /v1/campaigns/{id}/ab-test/winner."}},"additionalProperties":false,"description":"A/B test: 2 to 4 variants sent to a test group first; the winner goes to the rest. `null` turns it off."}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["campaign"]},"name":{"type":"string"},"status":{"type":"string","enum":["draft","scheduled","sending","sent","paused","canceled","failed"]},"subject":{"type":"string"},"previewText":{"type":["string","null"]},"fromName":{"type":"string"},"fromEmail":{"type":"string"},"replyTo":{"type":["string","null"]},"templateId":{"type":["string","null"]},"recipients":{"type":"object","properties":{"listIds":{"type":"array","items":{"type":"string"}},"segmentIds":{"type":"array","items":{"type":"string"}},"excludeListIds":{"type":"array","items":{"type":"string"}}},"required":["listIds","segmentIds","excludeListIds"]},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"utm":{"type":["object","null"],"properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaign":{"type":"string"}},"required":["source","medium","campaign"]}},"required":["opens","clicks","utm"]},"currency":{"type":"string","default":"USD"},"tags":{"type":"array","items":{"type":"string"}},"policyId":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"estimatedRecipients":{"type":["number","null"]},"plan":{"type":["object","null"],"properties":{"perDay":{"type":"number"},"days":{"type":"number"},"unlimited":{"type":"boolean","description":"No provider daily limit: everything is sent today (perDay is the audience size)."},"limitedBy":{"type":"string","enum":["quota","warmup","pacing"],"description":"What spreads the campaign over more than one day: provider quotas, the sending domain's warm-up, or per mailbox provider pacing."},"reason":{"type":"string","description":"One sentence explaining the plan, for example \"Sends over 4 days because acme.dev is warming up.\""},"domain":{"type":"string"}},"required":["perDay","days"]},"delivery":{"type":["object","null"],"properties":{"bestTime":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"includeInactive":{"type":"boolean"}},"description":"Delivery options: send each email at the recipient's best time within 24 hours, and include contacts with address problems or inactive contacts (both skipped by default)."},"pausedReason":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["bounce_rate","complaint_rate","workspace_guard","manual"]},"auto":{"type":"boolean"},"message":{"type":"string"},"at":{"type":"string"},"value":{"type":"number"},"threshold":{"type":"number"},"sample":{"type":"number"}},"required":["code","auto","message","at"],"description":"Why the campaign is paused. `auto: true` when a safeguard paused it; it stays paused until resumed."},"abTest":{"type":["object","null"],"properties":{"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"],"maxLength":80},"subject":{"type":["string","null"],"maxLength":998},"previewText":{"type":["string","null"],"maxLength":300},"fromName":{"type":["string","null"],"maxLength":200},"templateId":{"type":["string","null"]},"html":{"type":["string","null"]}},"required":["id"]}},"testPercent":{"type":"number"},"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"],"enum":["testing","waiting_for_pick","winner_sent",null],"description":"Set once sending starts."},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"],"enum":["auto","manual",null]}},"required":["variants","testPercent","metric","durationHours","winnerSelection"],"description":"A/B test settings and progress."},"stats":{"type":["object","null"],"properties":{"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"opens":{"type":"number"},"uniqueClicks":{"type":"number"},"clicks":{"type":"number"},"hardBounces":{"type":"number"},"softBounces":{"type":"number"},"unsubscribes":{"type":"number"},"complaints":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]}},"required":["recipients","sent","delivered","uniqueOpens","opens","uniqueClicks","clicks","hardBounces","softBounces","unsubscribes","complaints","conversions","revenue","rates"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","subject","previewText","fromName","fromEmail","replyTo","templateId","recipients","tracking","tags","policyId","scheduledAt","sentAt","estimatedRecipients","plan","stats","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteCampaign","tags":["Campaigns"],"summary":"Delete a campaign","description":"A campaign that is sending must be paused or canceled first. Emails already sent stay in the logs and stay viewable: the campaign disappears from the API, but what is needed to show those emails is kept.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/check":{"get":{"operationId":"getCampaignCheck","tags":["Campaigns"],"summary":"Check a campaign before sending","description":"What would stop the campaign from being scheduled (`problems`), and template `{{variables}}` that no contact provides (`missingVariables`). Show these in a review step before sending.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ready":{"type":"boolean","description":"False when `problems` would stop the campaign from being scheduled."},"problems":{"type":"array","items":{"type":"string"},"description":"Blocking problems, the same ones schedule refuses with `campaign_incomplete`."},"missingVariables":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","description":"Variable path, for example `issue_number` or `contact.plan`."},"usedIn":{"type":"array","items":{"type":"string","enum":["subject","preheader","content"]}}},"required":["path","usedIn"]},"description":"Template variables no contact field, contact attribute or system variable provides. They are empty in every email: sample data is never sent to real recipients."},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["missing_variables","transactional_template"]},"message":{"type":"string"},"variables":{"type":"array","items":{"type":"string"}}},"required":["code","message"]}}},"required":["ready","problems","missingVariables","warnings"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/duplicate":{"post":{"operationId":"duplicateCampaign","tags":["Campaigns"],"summary":"Duplicate as a new draft","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["campaign"]},"name":{"type":"string"},"status":{"type":"string","enum":["draft","scheduled","sending","sent","paused","canceled","failed"]},"subject":{"type":"string"},"previewText":{"type":["string","null"]},"fromName":{"type":"string"},"fromEmail":{"type":"string"},"replyTo":{"type":["string","null"]},"templateId":{"type":["string","null"]},"recipients":{"type":"object","properties":{"listIds":{"type":"array","items":{"type":"string"}},"segmentIds":{"type":"array","items":{"type":"string"}},"excludeListIds":{"type":"array","items":{"type":"string"}}},"required":["listIds","segmentIds","excludeListIds"]},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"utm":{"type":["object","null"],"properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaign":{"type":"string"}},"required":["source","medium","campaign"]}},"required":["opens","clicks","utm"]},"currency":{"type":"string","default":"USD"},"tags":{"type":"array","items":{"type":"string"}},"policyId":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"estimatedRecipients":{"type":["number","null"]},"plan":{"type":["object","null"],"properties":{"perDay":{"type":"number"},"days":{"type":"number"},"unlimited":{"type":"boolean","description":"No provider daily limit: everything is sent today (perDay is the audience size)."},"limitedBy":{"type":"string","enum":["quota","warmup","pacing"],"description":"What spreads the campaign over more than one day: provider quotas, the sending domain's warm-up, or per mailbox provider pacing."},"reason":{"type":"string","description":"One sentence explaining the plan, for example \"Sends over 4 days because acme.dev is warming up.\""},"domain":{"type":"string"}},"required":["perDay","days"]},"delivery":{"type":["object","null"],"properties":{"bestTime":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"includeInactive":{"type":"boolean"}},"description":"Delivery options: send each email at the recipient's best time within 24 hours, and include contacts with address problems or inactive contacts (both skipped by default)."},"pausedReason":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["bounce_rate","complaint_rate","workspace_guard","manual"]},"auto":{"type":"boolean"},"message":{"type":"string"},"at":{"type":"string"},"value":{"type":"number"},"threshold":{"type":"number"},"sample":{"type":"number"}},"required":["code","auto","message","at"],"description":"Why the campaign is paused. `auto: true` when a safeguard paused it; it stays paused until resumed."},"abTest":{"type":["object","null"],"properties":{"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"],"maxLength":80},"subject":{"type":["string","null"],"maxLength":998},"previewText":{"type":["string","null"],"maxLength":300},"fromName":{"type":["string","null"],"maxLength":200},"templateId":{"type":["string","null"]},"html":{"type":["string","null"]}},"required":["id"]}},"testPercent":{"type":"number"},"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"],"enum":["testing","waiting_for_pick","winner_sent",null],"description":"Set once sending starts."},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"],"enum":["auto","manual",null]}},"required":["variants","testPercent","metric","durationHours","winnerSelection"],"description":"A/B test settings and progress."},"stats":{"type":["object","null"],"properties":{"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"opens":{"type":"number"},"uniqueClicks":{"type":"number"},"clicks":{"type":"number"},"hardBounces":{"type":"number"},"softBounces":{"type":"number"},"unsubscribes":{"type":"number"},"complaints":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]}},"required":["recipients","sent","delivered","uniqueOpens","opens","uniqueClicks","clicks","hardBounces","softBounces","unsubscribes","complaints","conversions","revenue","rates"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","subject","previewText","fromName","fromEmail","replyTo","templateId","recipients","tracking","tags","policyId","scheduledAt","sentAt","estimatedRecipients","plan","stats","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/test":{"post":{"operationId":"testCampaign","tags":["Campaigns"],"summary":"Send a test email","description":"Sent through your routing policy like a real send, with \"[Test]\" in the subject. Not counted in campaign stats.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"array","items":{"type":"string","format":"email"},"minItems":1,"maxItems":5}},"required":["to"]}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"messageIds":{"type":"array","items":{"type":"string"}}},"required":["messageIds"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"402":{"description":"Payment required (type `payment_required`): `license_required`, a self-hosted server without an active license key (`details.buyUrl`); on the cloud, only when cloud plans are enabled, `plan_required` (the workspace has no plan; `details.upgradeUrl`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/schedule":{"post":{"operationId":"scheduleCampaign","tags":["Campaigns"],"summary":"Schedule, or send now","description":"`scheduledAt: null` sends now. Recipients are fixed when sending starts. When the audience is larger than today’s remaining quota on providers that allow campaigns, the rest is sent on the following days. Not available to test-mode keys.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"scheduledAt":{"type":["string","null"]},"bestTime":{"type":"boolean","description":"Send each email at the recipient's best time within 24 hours of `scheduledAt` (or now). Saved as `delivery.bestTime`."}},"required":["scheduledAt"]}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["campaign"]},"name":{"type":"string"},"status":{"type":"string","enum":["draft","scheduled","sending","sent","paused","canceled","failed"]},"subject":{"type":"string"},"previewText":{"type":["string","null"]},"fromName":{"type":"string"},"fromEmail":{"type":"string"},"replyTo":{"type":["string","null"]},"templateId":{"type":["string","null"]},"recipients":{"type":"object","properties":{"listIds":{"type":"array","items":{"type":"string"}},"segmentIds":{"type":"array","items":{"type":"string"}},"excludeListIds":{"type":"array","items":{"type":"string"}}},"required":["listIds","segmentIds","excludeListIds"]},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"utm":{"type":["object","null"],"properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaign":{"type":"string"}},"required":["source","medium","campaign"]}},"required":["opens","clicks","utm"]},"currency":{"type":"string","default":"USD"},"tags":{"type":"array","items":{"type":"string"}},"policyId":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"estimatedRecipients":{"type":["number","null"]},"plan":{"type":["object","null"],"properties":{"perDay":{"type":"number"},"days":{"type":"number"},"unlimited":{"type":"boolean","description":"No provider daily limit: everything is sent today (perDay is the audience size)."},"limitedBy":{"type":"string","enum":["quota","warmup","pacing"],"description":"What spreads the campaign over more than one day: provider quotas, the sending domain's warm-up, or per mailbox provider pacing."},"reason":{"type":"string","description":"One sentence explaining the plan, for example \"Sends over 4 days because acme.dev is warming up.\""},"domain":{"type":"string"}},"required":["perDay","days"]},"delivery":{"type":["object","null"],"properties":{"bestTime":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"includeInactive":{"type":"boolean"}},"description":"Delivery options: send each email at the recipient's best time within 24 hours, and include contacts with address problems or inactive contacts (both skipped by default)."},"pausedReason":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["bounce_rate","complaint_rate","workspace_guard","manual"]},"auto":{"type":"boolean"},"message":{"type":"string"},"at":{"type":"string"},"value":{"type":"number"},"threshold":{"type":"number"},"sample":{"type":"number"}},"required":["code","auto","message","at"],"description":"Why the campaign is paused. `auto: true` when a safeguard paused it; it stays paused until resumed."},"abTest":{"type":["object","null"],"properties":{"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"],"maxLength":80},"subject":{"type":["string","null"],"maxLength":998},"previewText":{"type":["string","null"],"maxLength":300},"fromName":{"type":["string","null"],"maxLength":200},"templateId":{"type":["string","null"]},"html":{"type":["string","null"]}},"required":["id"]}},"testPercent":{"type":"number"},"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"],"enum":["testing","waiting_for_pick","winner_sent",null],"description":"Set once sending starts."},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"],"enum":["auto","manual",null]}},"required":["variants","testPercent","metric","durationHours","winnerSelection"],"description":"A/B test settings and progress."},"stats":{"type":["object","null"],"properties":{"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"opens":{"type":"number"},"uniqueClicks":{"type":"number"},"clicks":{"type":"number"},"hardBounces":{"type":"number"},"softBounces":{"type":"number"},"unsubscribes":{"type":"number"},"complaints":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]}},"required":["recipients","sent","delivered","uniqueOpens","opens","uniqueClicks","clicks","hardBounces","softBounces","unsubscribes","complaints","conversions","revenue","rates"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","subject","previewText","fromName","fromEmail","replyTo","templateId","recipients","tracking","tags","policyId","scheduledAt","sentAt","estimatedRecipients","plan","stats","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"402":{"description":"Payment required (type `payment_required`): `license_required`, a self-hosted server without an active license key (`details.buyUrl`); on the cloud, only when cloud plans are enabled, `plan_required` (the workspace has no plan; `details.upgradeUrl`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/pause":{"post":{"operationId":"pauseCampaign","tags":["Campaigns"],"summary":"Pause sending (emails not yet handed to a provider are held)","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["campaign"]},"name":{"type":"string"},"status":{"type":"string","enum":["draft","scheduled","sending","sent","paused","canceled","failed"]},"subject":{"type":"string"},"previewText":{"type":["string","null"]},"fromName":{"type":"string"},"fromEmail":{"type":"string"},"replyTo":{"type":["string","null"]},"templateId":{"type":["string","null"]},"recipients":{"type":"object","properties":{"listIds":{"type":"array","items":{"type":"string"}},"segmentIds":{"type":"array","items":{"type":"string"}},"excludeListIds":{"type":"array","items":{"type":"string"}}},"required":["listIds","segmentIds","excludeListIds"]},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"utm":{"type":["object","null"],"properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaign":{"type":"string"}},"required":["source","medium","campaign"]}},"required":["opens","clicks","utm"]},"currency":{"type":"string","default":"USD"},"tags":{"type":"array","items":{"type":"string"}},"policyId":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"estimatedRecipients":{"type":["number","null"]},"plan":{"type":["object","null"],"properties":{"perDay":{"type":"number"},"days":{"type":"number"},"unlimited":{"type":"boolean","description":"No provider daily limit: everything is sent today (perDay is the audience size)."},"limitedBy":{"type":"string","enum":["quota","warmup","pacing"],"description":"What spreads the campaign over more than one day: provider quotas, the sending domain's warm-up, or per mailbox provider pacing."},"reason":{"type":"string","description":"One sentence explaining the plan, for example \"Sends over 4 days because acme.dev is warming up.\""},"domain":{"type":"string"}},"required":["perDay","days"]},"delivery":{"type":["object","null"],"properties":{"bestTime":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"includeInactive":{"type":"boolean"}},"description":"Delivery options: send each email at the recipient's best time within 24 hours, and include contacts with address problems or inactive contacts (both skipped by default)."},"pausedReason":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["bounce_rate","complaint_rate","workspace_guard","manual"]},"auto":{"type":"boolean"},"message":{"type":"string"},"at":{"type":"string"},"value":{"type":"number"},"threshold":{"type":"number"},"sample":{"type":"number"}},"required":["code","auto","message","at"],"description":"Why the campaign is paused. `auto: true` when a safeguard paused it; it stays paused until resumed."},"abTest":{"type":["object","null"],"properties":{"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"],"maxLength":80},"subject":{"type":["string","null"],"maxLength":998},"previewText":{"type":["string","null"],"maxLength":300},"fromName":{"type":["string","null"],"maxLength":200},"templateId":{"type":["string","null"]},"html":{"type":["string","null"]}},"required":["id"]}},"testPercent":{"type":"number"},"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"],"enum":["testing","waiting_for_pick","winner_sent",null],"description":"Set once sending starts."},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"],"enum":["auto","manual",null]}},"required":["variants","testPercent","metric","durationHours","winnerSelection"],"description":"A/B test settings and progress."},"stats":{"type":["object","null"],"properties":{"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"opens":{"type":"number"},"uniqueClicks":{"type":"number"},"clicks":{"type":"number"},"hardBounces":{"type":"number"},"softBounces":{"type":"number"},"unsubscribes":{"type":"number"},"complaints":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]}},"required":["recipients","sent","delivered","uniqueOpens","opens","uniqueClicks","clicks","hardBounces","softBounces","unsubscribes","complaints","conversions","revenue","rates"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","subject","previewText","fromName","fromEmail","replyTo","templateId","recipients","tracking","tags","policyId","scheduledAt","sentAt","estimatedRecipients","plan","stats","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/resume":{"post":{"operationId":"resumeCampaign","tags":["Campaigns"],"summary":"Resume a paused campaign","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["campaign"]},"name":{"type":"string"},"status":{"type":"string","enum":["draft","scheduled","sending","sent","paused","canceled","failed"]},"subject":{"type":"string"},"previewText":{"type":["string","null"]},"fromName":{"type":"string"},"fromEmail":{"type":"string"},"replyTo":{"type":["string","null"]},"templateId":{"type":["string","null"]},"recipients":{"type":"object","properties":{"listIds":{"type":"array","items":{"type":"string"}},"segmentIds":{"type":"array","items":{"type":"string"}},"excludeListIds":{"type":"array","items":{"type":"string"}}},"required":["listIds","segmentIds","excludeListIds"]},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"utm":{"type":["object","null"],"properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaign":{"type":"string"}},"required":["source","medium","campaign"]}},"required":["opens","clicks","utm"]},"currency":{"type":"string","default":"USD"},"tags":{"type":"array","items":{"type":"string"}},"policyId":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"estimatedRecipients":{"type":["number","null"]},"plan":{"type":["object","null"],"properties":{"perDay":{"type":"number"},"days":{"type":"number"},"unlimited":{"type":"boolean","description":"No provider daily limit: everything is sent today (perDay is the audience size)."},"limitedBy":{"type":"string","enum":["quota","warmup","pacing"],"description":"What spreads the campaign over more than one day: provider quotas, the sending domain's warm-up, or per mailbox provider pacing."},"reason":{"type":"string","description":"One sentence explaining the plan, for example \"Sends over 4 days because acme.dev is warming up.\""},"domain":{"type":"string"}},"required":["perDay","days"]},"delivery":{"type":["object","null"],"properties":{"bestTime":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"includeInactive":{"type":"boolean"}},"description":"Delivery options: send each email at the recipient's best time within 24 hours, and include contacts with address problems or inactive contacts (both skipped by default)."},"pausedReason":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["bounce_rate","complaint_rate","workspace_guard","manual"]},"auto":{"type":"boolean"},"message":{"type":"string"},"at":{"type":"string"},"value":{"type":"number"},"threshold":{"type":"number"},"sample":{"type":"number"}},"required":["code","auto","message","at"],"description":"Why the campaign is paused. `auto: true` when a safeguard paused it; it stays paused until resumed."},"abTest":{"type":["object","null"],"properties":{"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"],"maxLength":80},"subject":{"type":["string","null"],"maxLength":998},"previewText":{"type":["string","null"],"maxLength":300},"fromName":{"type":["string","null"],"maxLength":200},"templateId":{"type":["string","null"]},"html":{"type":["string","null"]}},"required":["id"]}},"testPercent":{"type":"number"},"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"],"enum":["testing","waiting_for_pick","winner_sent",null],"description":"Set once sending starts."},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"],"enum":["auto","manual",null]}},"required":["variants","testPercent","metric","durationHours","winnerSelection"],"description":"A/B test settings and progress."},"stats":{"type":["object","null"],"properties":{"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"opens":{"type":"number"},"uniqueClicks":{"type":"number"},"clicks":{"type":"number"},"hardBounces":{"type":"number"},"softBounces":{"type":"number"},"unsubscribes":{"type":"number"},"complaints":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]}},"required":["recipients","sent","delivered","uniqueOpens","opens","uniqueClicks","clicks","hardBounces","softBounces","unsubscribes","complaints","conversions","revenue","rates"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","subject","previewText","fromName","fromEmail","replyTo","templateId","recipients","tracking","tags","policyId","scheduledAt","sentAt","estimatedRecipients","plan","stats","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/cancel":{"post":{"operationId":"cancelCampaign","tags":["Campaigns"],"summary":"Cancel (emails not yet handed to a provider are dropped)","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["campaign"]},"name":{"type":"string"},"status":{"type":"string","enum":["draft","scheduled","sending","sent","paused","canceled","failed"]},"subject":{"type":"string"},"previewText":{"type":["string","null"]},"fromName":{"type":"string"},"fromEmail":{"type":"string"},"replyTo":{"type":["string","null"]},"templateId":{"type":["string","null"]},"recipients":{"type":"object","properties":{"listIds":{"type":"array","items":{"type":"string"}},"segmentIds":{"type":"array","items":{"type":"string"}},"excludeListIds":{"type":"array","items":{"type":"string"}}},"required":["listIds","segmentIds","excludeListIds"]},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"utm":{"type":["object","null"],"properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaign":{"type":"string"}},"required":["source","medium","campaign"]}},"required":["opens","clicks","utm"]},"currency":{"type":"string","default":"USD"},"tags":{"type":"array","items":{"type":"string"}},"policyId":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"estimatedRecipients":{"type":["number","null"]},"plan":{"type":["object","null"],"properties":{"perDay":{"type":"number"},"days":{"type":"number"},"unlimited":{"type":"boolean","description":"No provider daily limit: everything is sent today (perDay is the audience size)."},"limitedBy":{"type":"string","enum":["quota","warmup","pacing"],"description":"What spreads the campaign over more than one day: provider quotas, the sending domain's warm-up, or per mailbox provider pacing."},"reason":{"type":"string","description":"One sentence explaining the plan, for example \"Sends over 4 days because acme.dev is warming up.\""},"domain":{"type":"string"}},"required":["perDay","days"]},"delivery":{"type":["object","null"],"properties":{"bestTime":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"includeInactive":{"type":"boolean"}},"description":"Delivery options: send each email at the recipient's best time within 24 hours, and include contacts with address problems or inactive contacts (both skipped by default)."},"pausedReason":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["bounce_rate","complaint_rate","workspace_guard","manual"]},"auto":{"type":"boolean"},"message":{"type":"string"},"at":{"type":"string"},"value":{"type":"number"},"threshold":{"type":"number"},"sample":{"type":"number"}},"required":["code","auto","message","at"],"description":"Why the campaign is paused. `auto: true` when a safeguard paused it; it stays paused until resumed."},"abTest":{"type":["object","null"],"properties":{"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"],"maxLength":80},"subject":{"type":["string","null"],"maxLength":998},"previewText":{"type":["string","null"],"maxLength":300},"fromName":{"type":["string","null"],"maxLength":200},"templateId":{"type":["string","null"]},"html":{"type":["string","null"]}},"required":["id"]}},"testPercent":{"type":"number"},"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"],"enum":["testing","waiting_for_pick","winner_sent",null],"description":"Set once sending starts."},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"],"enum":["auto","manual",null]}},"required":["variants","testPercent","metric","durationHours","winnerSelection"],"description":"A/B test settings and progress."},"stats":{"type":["object","null"],"properties":{"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"opens":{"type":"number"},"uniqueClicks":{"type":"number"},"clicks":{"type":"number"},"hardBounces":{"type":"number"},"softBounces":{"type":"number"},"unsubscribes":{"type":"number"},"complaints":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]}},"required":["recipients","sent","delivered","uniqueOpens","opens","uniqueClicks","clicks","hardBounces","softBounces","unsubscribes","complaints","conversions","revenue","rates"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","subject","previewText","fromName","fromEmail","replyTo","templateId","recipients","tracking","tags","policyId","scheduledAt","sentAt","estimatedRecipients","plan","stats","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/ab-test":{"get":{"operationId":"getCampaignAbTest","tags":["Campaigns"],"summary":"A/B test results","description":"Results per variant, the leader and whether the difference is likely to be chance (two-proportion z-test, 95%).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"testPercent":{"type":"number"},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"]},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"]},"held":{"type":"number","description":"Recipients waiting for the winner."},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"subject":{"type":["string","null"]},"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"uniqueClicks":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"open":{"type":"number"},"click":{"type":"number"},"conversion":{"type":"number"},"revenuePerEmail":{"type":"number"}},"required":["open","click","conversion","revenuePerEmail"]},"value":{"type":"number","description":"The winner metric for this variant."},"success":{"type":"number"},"winner":{"type":"boolean"}},"required":["id","name","subject","recipients","sent","delivered","uniqueOpens","uniqueClicks","conversions","revenue","rates","value","success","winner"]}},"leader":{"type":["string","null"]},"comparison":{"type":["object","null"],"properties":{"leader":{"type":"string"},"runnerUp":{"type":"string"},"z":{"type":"number"},"pValue":{"type":"number"},"significant":{"type":"boolean"}},"required":["leader","runnerUp","z","pValue","significant"],"description":"Two-proportion z-test between the leader and the runner-up (revenue uses the conversion rate). Significant at 95% when pValue < 0.05."},"summary":{"type":"string","description":"For example \"Variant B is ahead, but the difference may be chance.\""}},"required":["metric","testPercent","durationHours","winnerSelection","phase","testStartedAt","decideAt","winnerId","decidedAt","decidedBy","held","variants","leader","comparison","summary"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/ab-test/winner":{"post":{"operationId":"pickCampaignAbWinner","tags":["Campaigns"],"summary":"Pick the A/B test winner","description":"Sends the winning variant to the rest of the recipients now. Needed when `winnerSelection` is `manual`; with `auto` it ends the test early.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"variantId":{"type":"string"}},"required":["variantId"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"testPercent":{"type":"number"},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"]},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"]},"held":{"type":"number","description":"Recipients waiting for the winner."},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"subject":{"type":["string","null"]},"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"uniqueClicks":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"open":{"type":"number"},"click":{"type":"number"},"conversion":{"type":"number"},"revenuePerEmail":{"type":"number"}},"required":["open","click","conversion","revenuePerEmail"]},"value":{"type":"number","description":"The winner metric for this variant."},"success":{"type":"number"},"winner":{"type":"boolean"}},"required":["id","name","subject","recipients","sent","delivered","uniqueOpens","uniqueClicks","conversions","revenue","rates","value","success","winner"]}},"leader":{"type":["string","null"]},"comparison":{"type":["object","null"],"properties":{"leader":{"type":"string"},"runnerUp":{"type":"string"},"z":{"type":"number"},"pValue":{"type":"number"},"significant":{"type":"boolean"}},"required":["leader","runnerUp","z","pValue","significant"],"description":"Two-proportion z-test between the leader and the runner-up (revenue uses the conversion rate). Significant at 95% when pValue < 0.05."},"summary":{"type":"string","description":"For example \"Variant B is ahead, but the difference may be chance.\""}},"required":["metric","testPercent","durationHours","winnerSelection","phase","testStartedAt","decideAt","winnerId","decidedAt","decidedBy","held","variants","leader","comparison","summary"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/report":{"get":{"operationId":"getCampaignReport","tags":["Campaigns"],"summary":"Campaign report","description":"Rates: delivery = delivered/sent · open = unique opens/delivered · click = unique clicks/delivered · click-to-open = unique clicks/unique opens · bounce = (hard+soft)/sent · unsubscribe, complaint and conversion = count/delivered. \"Delivered\" is accepted by the provider and not bounced. Conversions count recipients who converted at least once; revenue sums every conversion.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"campaign":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["campaign"]},"name":{"type":"string"},"status":{"type":"string","enum":["draft","scheduled","sending","sent","paused","canceled","failed"]},"subject":{"type":"string"},"previewText":{"type":["string","null"]},"fromName":{"type":"string"},"fromEmail":{"type":"string"},"replyTo":{"type":["string","null"]},"templateId":{"type":["string","null"]},"recipients":{"type":"object","properties":{"listIds":{"type":"array","items":{"type":"string"}},"segmentIds":{"type":"array","items":{"type":"string"}},"excludeListIds":{"type":"array","items":{"type":"string"}}},"required":["listIds","segmentIds","excludeListIds"]},"tracking":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"},"utm":{"type":["object","null"],"properties":{"source":{"type":"string"},"medium":{"type":"string"},"campaign":{"type":"string"}},"required":["source","medium","campaign"]}},"required":["opens","clicks","utm"]},"currency":{"type":"string","default":"USD"},"tags":{"type":"array","items":{"type":"string"}},"policyId":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"estimatedRecipients":{"type":["number","null"]},"plan":{"type":["object","null"],"properties":{"perDay":{"type":"number"},"days":{"type":"number"},"unlimited":{"type":"boolean","description":"No provider daily limit: everything is sent today (perDay is the audience size)."},"limitedBy":{"type":"string","enum":["quota","warmup","pacing"],"description":"What spreads the campaign over more than one day: provider quotas, the sending domain's warm-up, or per mailbox provider pacing."},"reason":{"type":"string","description":"One sentence explaining the plan, for example \"Sends over 4 days because acme.dev is warming up.\""},"domain":{"type":"string"}},"required":["perDay","days"]},"delivery":{"type":["object","null"],"properties":{"bestTime":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"includeInactive":{"type":"boolean"}},"description":"Delivery options: send each email at the recipient's best time within 24 hours, and include contacts with address problems or inactive contacts (both skipped by default)."},"pausedReason":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["bounce_rate","complaint_rate","workspace_guard","manual"]},"auto":{"type":"boolean"},"message":{"type":"string"},"at":{"type":"string"},"value":{"type":"number"},"threshold":{"type":"number"},"sample":{"type":"number"}},"required":["code","auto","message","at"],"description":"Why the campaign is paused. `auto: true` when a safeguard paused it; it stays paused until resumed."},"abTest":{"type":["object","null"],"properties":{"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"],"maxLength":80},"subject":{"type":["string","null"],"maxLength":998},"previewText":{"type":["string","null"],"maxLength":300},"fromName":{"type":["string","null"],"maxLength":200},"templateId":{"type":["string","null"]},"html":{"type":["string","null"]}},"required":["id"]}},"testPercent":{"type":"number"},"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"],"enum":["testing","waiting_for_pick","winner_sent",null],"description":"Set once sending starts."},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"],"enum":["auto","manual",null]}},"required":["variants","testPercent","metric","durationHours","winnerSelection"],"description":"A/B test settings and progress."},"stats":{"type":["object","null"],"properties":{"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"opens":{"type":"number"},"uniqueClicks":{"type":"number"},"clicks":{"type":"number"},"hardBounces":{"type":"number"},"softBounces":{"type":"number"},"unsubscribes":{"type":"number"},"complaints":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]}},"required":["recipients","sent","delivered","uniqueOpens","opens","uniqueClicks","clicks","hardBounces","softBounces","unsubscribes","complaints","conversions","revenue","rates"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","status","subject","previewText","fromName","fromEmail","replyTo","templateId","recipients","tracking","tags","policyId","scheduledAt","sentAt","estimatedRecipients","plan","stats","createdAt","updatedAt"]},"stats":{"type":"object","properties":{"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"opens":{"type":"number"},"uniqueClicks":{"type":"number"},"clicks":{"type":"number"},"hardBounces":{"type":"number"},"softBounces":{"type":"number"},"unsubscribes":{"type":"number"},"complaints":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]}},"required":["recipients","sent","delivered","uniqueOpens","opens","uniqueClicks","clicks","hardBounces","softBounces","unsubscribes","complaints","conversions","revenue","rates"]},"series":{"type":"array","items":{"type":"object","properties":{"t":{"type":"string"},"opens":{"type":"number"},"clicks":{"type":"number"},"conversions":{"type":"number"}},"required":["t","opens","clicks","conversions"]}},"links":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"clicks":{"type":"number"},"uniqueClicks":{"type":"number"}},"required":["url","clicks","uniqueClicks"]}},"byProvider":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"provider":{"type":"string"},"name":{"type":"string"},"sent":{"type":"number"},"delivered":{"type":"number"},"bounced":{"type":"number"},"failed":{"type":"number"}},"required":["connectionId","provider","name","sent","delivered","bounced","failed"]}},"byRecipientDomain":{"type":"array","items":{"type":"object","properties":{"domain":{"type":"string"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"uniqueClicks":{"type":"number"},"bounced":{"type":"number"}},"required":["domain","sent","delivered","uniqueOpens","uniqueClicks","bounced"]}},"bounceReasons":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"type":{"type":"string","enum":["hard","soft"]},"count":{"type":"number"}},"required":["code","type","count"]}},"abTest":{"type":["object","null"],"properties":{"metric":{"type":"string","enum":["open","click","conversion","revenue"]},"testPercent":{"type":"number"},"durationHours":{"type":"number"},"winnerSelection":{"type":"string","enum":["auto","manual"]},"phase":{"type":["string","null"]},"testStartedAt":{"type":["string","null"]},"decideAt":{"type":["string","null"]},"winnerId":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"decidedBy":{"type":["string","null"]},"held":{"type":"number","description":"Recipients waiting for the winner."},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"subject":{"type":["string","null"]},"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"uniqueClicks":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"},"rates":{"type":"object","properties":{"open":{"type":"number"},"click":{"type":"number"},"conversion":{"type":"number"},"revenuePerEmail":{"type":"number"}},"required":["open","click","conversion","revenuePerEmail"]},"value":{"type":"number","description":"The winner metric for this variant."},"success":{"type":"number"},"winner":{"type":"boolean"}},"required":["id","name","subject","recipients","sent","delivered","uniqueOpens","uniqueClicks","conversions","revenue","rates","value","success","winner"]}},"leader":{"type":["string","null"]},"comparison":{"type":["object","null"],"properties":{"leader":{"type":"string"},"runnerUp":{"type":"string"},"z":{"type":"number"},"pValue":{"type":"number"},"significant":{"type":"boolean"}},"required":["leader","runnerUp","z","pValue","significant"],"description":"Two-proportion z-test between the leader and the runner-up (revenue uses the conversion rate). Significant at 95% when pValue < 0.05."},"summary":{"type":"string","description":"For example \"Variant B is ahead, but the difference may be chance.\""}},"required":["metric","testPercent","durationHours","winnerSelection","phase","testStartedAt","decideAt","winnerId","decidedAt","decidedBy","held","variants","leader","comparison","summary"],"description":"Results per variant, when the campaign has an A/B test."}},"required":["campaign","stats","series","links","byProvider","byRecipientDomain","bounceReasons"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/recipients":{"get":{"operationId":"listCampaignRecipients","tags":["Campaigns"],"summary":"Recipient activity (JSON or CSV)","description":"`cursor` is a row offset: pass back `nextCursor` unchanged. `format=csv` returns every matching row as a file.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["all","delivered","opened","clicked","bounced","unsubscribed","complained","converted","not_opened"],"default":"all"},"required":false,"name":"filter","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","enum":["json","csv"],"default":"json"},"required":false,"name":"format","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"contactId":{"type":["string","null"]},"connectionId":{"type":["string","null"]},"connectionName":{"type":["string","null"]},"email":{"type":"string"},"messageId":{"type":["string","null"]},"status":{"type":"string"},"provider":{"type":["string","null"]},"openedAt":{"type":["string","null"]},"clickedAt":{"type":["string","null"]},"convertedAt":{"type":["string","null"]},"bounceType":{"type":["string","null"],"enum":["hard","soft",null]}},"required":["contactId","email","messageId","status","provider","openedAt","clickedAt","convertedAt","bounceType"]}},"nextCursor":{"type":["string","null"]},"total":{"type":"number"}},"required":["data","nextCursor","total"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/statistics/overview":{"get":{"operationId":"getStatisticsOverview","tags":["Statistics"],"summary":"Email statistics with filters and previous-period comparison","description":"Defaults to the last 30 days. `previous` holds the same rates for the period of equal length just before `from`. `provider` accepts provider ids (e.g. `resend`) or connection ids, comma separated.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"until","in":"query"},{"schema":{"type":"string","enum":["all","transactional","marketing"],"default":"all"},"required":false,"name":"type","in":"query"},{"schema":{"type":"string"},"required":false,"name":"campaignId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"provider","in":"query"},{"schema":{"type":"string"},"required":false,"name":"domain","in":"query"},{"schema":{"type":"string"},"required":false,"name":"recipientDomain","in":"query"},{"schema":{"type":"string"},"required":false,"name":"tag","in":"query"},{"schema":{"type":"string"},"required":false,"name":"templateId","in":"query"},{"schema":{"type":"string","enum":["hour","day","week"],"default":"day","description":"Bucket size. Days and weeks start at midnight in the workspace time zone. Ranges: hour ≤ 31 days, day ≤ 2 years, week ≤ 10 years."},"required":false,"description":"Bucket size. Days and weeks start at midnight in the workspace time zone. Ranges: hour ≤ 31 days, day ≤ 2 years, week ≤ 10 years.","name":"interval","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"totals":{"type":"object","properties":{"recipients":{"type":"number"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"opens":{"type":"number"},"uniqueClicks":{"type":"number"},"clicks":{"type":"number"},"hardBounces":{"type":"number"},"softBounces":{"type":"number"},"unsubscribes":{"type":"number"},"complaints":{"type":"number"},"conversions":{"type":"number"},"revenue":{"type":"number"}},"required":["recipients","sent","delivered","uniqueOpens","opens","uniqueClicks","clicks","hardBounces","softBounces","unsubscribes","complaints","conversions","revenue"]},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]},"previous":{"type":["object","null"],"properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"clickToOpen":{"type":"number"},"bounce":{"type":"number"},"unsubscribe":{"type":"number"},"complaint":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","clickToOpen","bounce","unsubscribe","complaint","conversion"]},"series":{"type":"array","items":{"type":"object","properties":{"t":{"type":"string"},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"uniqueClicks":{"type":"number"},"bounces":{"type":"number"},"unsubscribes":{"type":"number"},"conversions":{"type":"number"},"complaints":{"type":"number","description":"Messages with a spam complaint in the bucket (event time)."}},"required":["t","sent","delivered","uniqueOpens","uniqueClicks","bounces","unsubscribes","conversions"]}},"topCampaigns":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"sentAt":{"type":["string","null"]},"recipients":{"type":"number"},"openRate":{"type":"number"},"clickRate":{"type":"number"},"bounceRate":{"type":"number"},"conversionRate":{"type":"number"}},"required":["id","name","sentAt","recipients","openRate","clickRate","bounceRate","conversionRate"]}},"byRecipientDomain":{"type":"array","items":{"type":"object","properties":{"domain":{"type":"string"},"sent":{"type":"number"},"delivered":{"type":"number"},"openRate":{"type":"number"},"bounceRate":{"type":"number"}},"required":["domain","sent","delivered","openRate","bounceRate"]}},"timezone":{"type":"string"}},"required":["totals","rates","previous","series","topCampaigns","byRecipientDomain"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/statistics/breakdown":{"get":{"operationId":"getStatisticsBreakdown","tags":["Statistics"],"summary":"Email by mailbox provider and by category","description":"Same filters as the overview (default last 30 days). `byMailboxProvider` groups recipients by their mailbox provider from the recipient domain (gmail.com and googlemail.com → google; outlook, hotmail, live and msn → outlook; yahoo, ymail and aol → yahoo; icloud, me and mac → apple; proton → proton; everything else → other). `byCategory` lists transactional email, each campaign and automation email.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"until","in":"query"},{"schema":{"type":"string","enum":["all","transactional","marketing"],"default":"all"},"required":false,"name":"type","in":"query"},{"schema":{"type":"string"},"required":false,"name":"campaignId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"provider","in":"query"},{"schema":{"type":"string"},"required":false,"name":"domain","in":"query"},{"schema":{"type":"string"},"required":false,"name":"recipientDomain","in":"query"},{"schema":{"type":"string"},"required":false,"name":"tag","in":"query"},{"schema":{"type":"string"},"required":false,"name":"templateId","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"byMailboxProvider":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","enum":["google","outlook","yahoo","apple","proton","other"]},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"uniqueClicks":{"type":"number"},"bounced":{"type":"number"},"complaints":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"bounce":{"type":"number"},"complaint":{"type":"number"}},"required":["delivery","open","click","bounce","complaint"]}},"required":["provider","sent","delivered","uniqueOpens","uniqueClicks","bounced","complaints","rates"]}},"byCategory":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["transactional","campaign","automation"]},"campaignId":{"type":["string","null"]},"name":{"type":["string","null"]},"sent":{"type":"number"},"delivered":{"type":"number"},"uniqueOpens":{"type":"number"},"uniqueClicks":{"type":"number"},"bounced":{"type":"number"},"complaints":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"bounce":{"type":"number"},"complaint":{"type":"number"}},"required":["delivery","open","click","bounce","complaint"]}},"required":["kind","campaignId","name","sent","delivered","uniqueOpens","uniqueClicks","bounced","complaints","rates"]}}},"required":["byMailboxProvider","byCategory"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/conversions":{"post":{"operationId":"createConversion","tags":["Conversions"],"summary":"Record a conversion","description":"Attribution: `token` (the `os_ct` query parameter added to tracked links) → `messageId` → `email` (the most recent campaign click by that address within the attribution window, 7 days by default). Send `idempotencyKey` (e.g. your order id) to make retries safe.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","maxLength":2048,"description":"The `os_ct` query parameter added to tracked links. Best attribution."},"messageId":{"type":"string","maxLength":64,"description":"Credit a specific email."},"email":{"type":"string","maxLength":320,"format":"email","description":"Credit the most recent campaign click by this address within the attribution window."},"campaignId":{"type":"string","maxLength":64,"description":"With `email`: only consider this campaign."},"goal":{"type":"string","maxLength":80,"default":"conversion","description":"What happened, for example `purchase` or `signup`."},"value":{"type":"number","minimum":0,"maximum":1000000000,"description":"Revenue, at most 1,000,000,000."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO currency, for example USD."},"occurredAt":{"type":"string","description":"When it happened (ISO 8601). Defaults to now."},"idempotencyKey":{"type":"string","maxLength":200,"description":"For example your order id: a retry with the same key is not counted twice."}},"example":{"token":"eyJ3Ijoid3NfLi4uIn0.abc","goal":"purchase","value":49,"currency":"USD","idempotencyKey":"order_1042"}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"goal":{"type":"string"},"value":{"type":["number","null"]},"currency":{"type":["string","null"]},"contactId":{"type":["string","null"]},"email":{"type":["string","null"]},"campaignId":{"type":["string","null"]},"messageId":{"type":["string","null"]},"attributedBy":{"type":"string","enum":["token","message","email","none"]},"occurredAt":{"type":"string"}},"required":["id","goal","value","currency","contactId","email","campaignId","messageId","attributedBy","occurredAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"get":{"operationId":"listConversions","tags":["Conversions"],"summary":"List conversions","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"campaignId","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"goal":{"type":"string"},"value":{"type":["number","null"]},"currency":{"type":["string","null"]},"contactId":{"type":["string","null"]},"email":{"type":["string","null"]},"campaignId":{"type":["string","null"]},"messageId":{"type":["string","null"]},"attributedBy":{"type":"string","enum":["token","message","email","none"]},"occurredAt":{"type":"string"}},"required":["id","goal","value","currency","contactId","email","campaignId","messageId","attributedBy","occurredAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/settings":{"get":{"operationId":"listAiSettings","tags":["AI assistant"],"summary":"AI settings","description":"Whether the assistant is on, the default model connection, the brand voice (writing profile) and the privacy settings (what may be sent to the model provider). The assistant is off until turned on.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"defaultConnectionId":{"type":["string","null"]},"writingProfile":{"type":"object","properties":{"styleNotes":{"type":"string","maxLength":2000,"description":"How you write: tone, length, words to avoid. Included in drafting prompts."},"signOff":{"type":"string","maxLength":300,"description":"Added at the end of drafted replies, for example \"Thanks,\\nAda\"."}},"required":["styleNotes","signOff"]},"privacy":{"type":"object","properties":{"brandVoice":{"type":"boolean","description":"Include the brand voice (style notes and sign-off) in prompts. Default true."},"facts":{"type":"boolean","description":"Include matching facts (workspace notes) in prompts. Default true."},"providerResponses":{"type":"boolean","description":"Send provider and SMTP error text (with addresses removed) when explaining a failed email. Off: only codes are sent. Default true."},"recipientDomains":{"type":"boolean","description":"Send the recipient's domain (for example gmail.com) when explaining a failed email. Default true."},"domainNames":{"type":"boolean","description":"Send your sending domain and provider connection names. Off: they are replaced with placeholders such as \"domain 1\". Default true."}},"required":["brandVoice","facts","providerResponses","recipientDomains","domainNames"]},"logPrompts":{"type":"boolean"},"rateLimitPerMinute":{"type":"number"}},"required":["enabled","defaultConnectionId","writingProfile","privacy","logPrompts","rateLimitPerMinute"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateAiSetting","tags":["AI assistant"],"summary":"Update AI settings","description":"Turn the assistant on or off, choose the default connection, edit the brand voice (writing profile) and the privacy settings. Admins only.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"defaultConnectionId":{"type":["string","null"]},"writingProfile":{"type":"object","properties":{"styleNotes":{"type":"string","maxLength":2000,"description":"How you write: tone, length, words to avoid. Included in drafting prompts."},"signOff":{"type":"string","maxLength":300,"description":"Added at the end of drafted replies, for example \"Thanks,\\nAda\"."}}},"privacy":{"type":"object","properties":{"brandVoice":{"type":"boolean","description":"Include the brand voice (style notes and sign-off) in prompts. Default true."},"facts":{"type":"boolean","description":"Include matching facts (workspace notes) in prompts. Default true."},"providerResponses":{"type":"boolean","description":"Send provider and SMTP error text (with addresses removed) when explaining a failed email. Off: only codes are sent. Default true."},"recipientDomains":{"type":"boolean","description":"Send the recipient's domain (for example gmail.com) when explaining a failed email. Default true."},"domainNames":{"type":"boolean","description":"Send your sending domain and provider connection names. Off: they are replaced with placeholders such as \"domain 1\". Default true."}}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"defaultConnectionId":{"type":["string","null"]},"writingProfile":{"type":"object","properties":{"styleNotes":{"type":"string","maxLength":2000,"description":"How you write: tone, length, words to avoid. Included in drafting prompts."},"signOff":{"type":"string","maxLength":300,"description":"Added at the end of drafted replies, for example \"Thanks,\\nAda\"."}},"required":["styleNotes","signOff"]},"privacy":{"type":"object","properties":{"brandVoice":{"type":"boolean","description":"Include the brand voice (style notes and sign-off) in prompts. Default true."},"facts":{"type":"boolean","description":"Include matching facts (workspace notes) in prompts. Default true."},"providerResponses":{"type":"boolean","description":"Send provider and SMTP error text (with addresses removed) when explaining a failed email. Off: only codes are sent. Default true."},"recipientDomains":{"type":"boolean","description":"Send the recipient's domain (for example gmail.com) when explaining a failed email. Default true."},"domainNames":{"type":"boolean","description":"Send your sending domain and provider connection names. Off: they are replaced with placeholders such as \"domain 1\". Default true."}},"required":["brandVoice","facts","providerResponses","recipientDomains","domainNames"]},"logPrompts":{"type":"boolean"},"rateLimitPerMinute":{"type":"number"}},"required":["enabled","defaultConnectionId","writingProfile","privacy","logPrompts","rateLimitPerMinute"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/connections":{"get":{"operationId":"listAiConnections","tags":["AI assistant"],"summary":"List AI connections","description":"Model provider connections. API keys are never returned; `keyHint` shows the last characters.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["ai_connection"]},"name":{"type":"string"},"kind":{"type":"string","enum":["openai_compatible","anthropic","google"]},"model":{"type":"string"},"baseUrl":{"type":["string","null"]},"authHeader":{"type":"string","enum":["bearer","api-key"]},"apiVersion":{"type":["string","null"]},"keyHint":{"type":["string","null"]},"isDefault":{"type":"boolean"},"status":{"type":"string","enum":["untested","ok","error"]},"lastError":{"type":["string","null"]},"lastTestedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","kind","model","baseUrl","authHeader","apiVersion","keyHint","isDefault","status","lastError","lastTestedAt","createdAt","updatedAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createAiConnection","tags":["AI assistant"],"summary":"Add an AI connection","description":"`openai_compatible` needs `baseUrl` (OpenAI, Azure OpenAI, API gateways, or a local server such as Ollama at http://localhost:11434/v1). `anthropic` and `google` need `apiKey`. The key is encrypted at rest. Prompt content goes to the provider you choose; usage is billed by that provider.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"kind":{"type":"string","enum":["openai_compatible","anthropic","google"]},"model":{"type":"string","minLength":1,"maxLength":200,"description":"Model id as the provider names it."},"apiKey":{"type":"string","maxLength":4096,"description":"Encrypted at rest and never returned. Optional for local OpenAI-compatible servers such as Ollama."},"baseUrl":{"type":"string","maxLength":2048,"format":"uri","description":"Required for `openai_compatible`. Optional for `anthropic` and `google` (an API gateway). Private and loopback addresses need ONESEND_ALLOW_PRIVATE_NETWORK=true."},"authHeader":{"type":"string","enum":["bearer","api-key"],"description":"openai_compatible only. Default `bearer`."},"apiVersion":{"type":"string","maxLength":40,"description":"openai_compatible: sent as the `api-version` query parameter (Azure). anthropic: the `anthropic-version` header (default 2023-06-01)."},"makeDefault":{"type":"boolean","description":"Use this connection when a request does not name one. The first connection becomes the default."}},"required":["name","kind","model"],"example":{"name":"Local Ollama","kind":"openai_compatible","model":"llama3.2","baseUrl":"http://localhost:11434/v1"}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["ai_connection"]},"name":{"type":"string"},"kind":{"type":"string","enum":["openai_compatible","anthropic","google"]},"model":{"type":"string"},"baseUrl":{"type":["string","null"]},"authHeader":{"type":"string","enum":["bearer","api-key"]},"apiVersion":{"type":["string","null"]},"keyHint":{"type":["string","null"]},"isDefault":{"type":"boolean"},"status":{"type":"string","enum":["untested","ok","error"]},"lastError":{"type":["string","null"]},"lastTestedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","kind","model","baseUrl","authHeader","apiVersion","keyHint","isDefault","status","lastError","lastTestedAt","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/connections/{id}":{"get":{"operationId":"getAiConnection","tags":["AI assistant"],"summary":"Get an AI connection","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["ai_connection"]},"name":{"type":"string"},"kind":{"type":"string","enum":["openai_compatible","anthropic","google"]},"model":{"type":"string"},"baseUrl":{"type":["string","null"]},"authHeader":{"type":"string","enum":["bearer","api-key"]},"apiVersion":{"type":["string","null"]},"keyHint":{"type":["string","null"]},"isDefault":{"type":"boolean"},"status":{"type":"string","enum":["untested","ok","error"]},"lastError":{"type":["string","null"]},"lastTestedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","kind","model","baseUrl","authHeader","apiVersion","keyHint","isDefault","status","lastError","lastTestedAt","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateAiConnection","tags":["AI assistant"],"summary":"Update an AI connection","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"model":{"type":"string","minLength":1,"maxLength":200},"apiKey":{"type":"string","maxLength":4096,"description":"Replaces the stored key. Send an empty string to remove it."},"baseUrl":{"type":["string","null"],"maxLength":2048,"format":"uri"},"authHeader":{"type":"string","enum":["bearer","api-key"]},"apiVersion":{"type":["string","null"],"maxLength":40},"makeDefault":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["ai_connection"]},"name":{"type":"string"},"kind":{"type":"string","enum":["openai_compatible","anthropic","google"]},"model":{"type":"string"},"baseUrl":{"type":["string","null"]},"authHeader":{"type":"string","enum":["bearer","api-key"]},"apiVersion":{"type":["string","null"]},"keyHint":{"type":["string","null"]},"isDefault":{"type":"boolean"},"status":{"type":"string","enum":["untested","ok","error"]},"lastError":{"type":["string","null"]},"lastTestedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","name","kind","model","baseUrl","authHeader","apiVersion","keyHint","isDefault","status","lastError","lastTestedAt","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteAiConnection","tags":["AI assistant"],"summary":"Delete an AI connection","description":"The stored key is deleted. When it was the default, the oldest remaining connection is used.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/connections/{id}/test":{"post":{"operationId":"testAiConnection","tags":["AI assistant"],"summary":"Test an AI connection","description":"Sends a short prompt to the model and reports whether it answered. Works while the assistant is turned off.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"model":{"type":"string"},"latencyMs":{"type":"number"},"sample":{"type":["string","null"]},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["ok","model","latencyMs","sample","error"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/notes":{"get":{"operationId":"listAiNotes","tags":["AI assistant"],"summary":"List workspace notes","description":"Facts the AI can use: short notes (policies, product facts, prices) included in drafts, templates, rewrites, answers and explanations when they match the topic (up to 3 notes and 4,000 characters per prompt). The privacy setting `facts` turns this off.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["ai_note"]},"title":{"type":"string"},"text":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","title","text","createdAt","updatedAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createAiNote","tags":["AI assistant"],"summary":"Add a note","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"text":{"type":"string","minLength":1,"maxLength":8000}},"required":["title","text"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["ai_note"]},"title":{"type":"string"},"text":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","title","text","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/notes/{id}":{"get":{"operationId":"getAiNote","tags":["AI assistant"],"summary":"Get a note","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["ai_note"]},"title":{"type":"string"},"text":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","title","text","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateAiNote","tags":["AI assistant"],"summary":"Update a note","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"text":{"type":"string","minLength":1,"maxLength":8000}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["ai_note"]},"title":{"type":"string"},"text":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","object","title","text","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteAiNote","tags":["AI assistant"],"summary":"Delete a note","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/usage":{"get":{"operationId":"getAiUsage","tags":["AI assistant"],"summary":"AI usage","description":"Model calls and token counts per day, feature and model (tokens only when the provider reports them). Costs are billed by your model provider.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":90,"default":30},"required":false,"name":"days","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"number"},"totals":{"type":"object","properties":{"calls":{"type":"number"},"errors":{"type":"number"},"inputTokens":{"type":"number"},"outputTokens":{"type":"number"}},"required":["calls","errors","inputTokens","outputTokens"]},"data":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"feature":{"type":"string","enum":["test","summarize","draft_reply","subjects","generate_template","rewrite","triage","ask","explain_failure","deliverability_review","spam_check","write_campaign","translate_template","quick_replies","translate_message"]},"connectionId":{"type":["string","null"]},"model":{"type":["string","null"]},"calls":{"type":"number"},"errors":{"type":"number"},"inputTokens":{"type":"number"},"outputTokens":{"type":"number"}},"required":["day","feature","connectionId","model","calls","errors","inputTokens","outputTokens"]}}},"required":["days","totals","data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/summarize":{"post":{"operationId":"summarizeAi","tags":["AI assistant"],"summary":"Summarize a thread","description":"Bullet summary and action items for an inbox thread, a received message's thread, or a sent email with its replies. The thread content is sent to the model provider. Returns 403 `ai_disabled` while the assistant is turned off and 400 `ai_not_configured` without a connection.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"threadId":{"type":"string","description":"An inbox thread (received and sent messages)."},"messageId":{"type":"string","description":"A received message (`inb_` inbox id); its thread is summarized."},"emailId":{"type":"string","description":"A sent email; it is summarized with the replies in its thread."},"connectionId":{"type":"string","description":"AI connection to use. Defaults to the workspace default."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"array","items":{"type":"string"}},"actionItems":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"owner":{"type":["string","null"]},"due":{"type":["string","null"]}},"required":["text","owner","due"]}},"sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["inbound","sent"]},"threadId":{"type":["string","null"]},"subject":{"type":"string"},"from":{"type":"string"},"at":{"type":"string"},"link":{"type":"string"}},"required":["id","kind","threadId","subject","from","at","link"]}},"usage":{"type":"object","properties":{"connectionId":{"type":"string"},"model":{"type":"string"},"inputTokens":{"type":["number","null"]},"outputTokens":{"type":["number","null"]},"latencyMs":{"type":"number"}},"required":["connectionId","model","inputTokens","outputTokens","latencyMs"]}},"required":["summary","actionItems","sources","usage"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/subjects":{"post":{"operationId":"createAiSubject","tags":["AI assistant"],"summary":"Suggest subject lines and preview text","description":"Suggestions from the email content or a topic. Returns 403 `ai_disabled` while the assistant is turned off and 400 `ai_not_configured` without a connection.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","maxLength":100000,"description":"The email content (text or HTML)."},"topic":{"type":"string","maxLength":1000,"description":"What the email is about, when there is no body yet."},"currentSubject":{"type":"string","maxLength":300},"kind":{"type":"string","enum":["subject","preview","both"],"default":"both"},"count":{"type":"integer","minimum":1,"maximum":10,"default":5},"connectionId":{"type":"string","description":"AI connection to use. Defaults to the workspace default."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"subjects":{"type":"array","items":{"type":"string"}},"previewTexts":{"type":"array","items":{"type":"string"}},"context":{"type":"object","properties":{"brandVoice":{"type":"boolean"},"facts":{"type":"array","items":{"type":"string"}}},"required":["brandVoice","facts"]},"usage":{"type":"object","properties":{"connectionId":{"type":"string"},"model":{"type":"string"},"inputTokens":{"type":["number","null"]},"outputTokens":{"type":["number","null"]},"latencyMs":{"type":"number"}},"required":["connectionId","model","inputTokens","outputTokens","latencyMs"]}},"required":["subjects","previewTexts","usage"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/generate-template":{"post":{"operationId":"generateTemplateAi","tags":["AI assistant"],"summary":"Generate a template","description":"Returns a template document (blocks) from a description. The document is validated; when the first answer is not valid the model is asked once more. Raw HTML blocks are removed. Nothing is saved. Returns 403 `ai_disabled` while the assistant is turned off and 400 `ai_not_configured` without a connection.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"prompt":{"type":"string","minLength":3,"maxLength":4000,"description":"For example \"Order shipped notification with tracking button and order summary table\"."},"type":{"type":"string","enum":["transactional","broadcast"],"default":"transactional"},"brand":{"type":"object","properties":{"primary":{"type":"string"},"accent":{"type":"string"},"logoUrl":{"type":"string"},"companyName":{"type":"string","maxLength":120}}},"connectionId":{"type":"string","description":"AI connection to use. Defaults to the workspace default."}},"required":["prompt"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"document":{"type":"object","additionalProperties":{}},"subject":{"type":"string"},"preheader":{"type":"string"},"variables":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}},"attempts":{"type":"number"},"context":{"type":"object","properties":{"brandVoice":{"type":"boolean"},"facts":{"type":"array","items":{"type":"string"}}},"required":["brandVoice","facts"]},"usage":{"type":"object","properties":{"connectionId":{"type":"string"},"model":{"type":"string"},"inputTokens":{"type":["number","null"]},"outputTokens":{"type":["number","null"]},"latencyMs":{"type":"number"}},"required":["connectionId","model","inputTokens","outputTokens","latencyMs"]}},"required":["document","subject","preheader","variables","warnings","attempts","usage"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/rewrite":{"post":{"operationId":"rewriteAi","tags":["AI assistant"],"summary":"Rewrite text","description":"Shorter, clearer, friendlier, more formal, grammar fixes, translation or a custom instruction. Returns 403 `ai_disabled` while the assistant is turned off and 400 `ai_not_configured` without a connection.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":20000},"mode":{"type":"string","enum":["shorter","clearer","friendlier","more_formal","fix_grammar","translate","custom"]},"language":{"type":"string","maxLength":60,"description":"Required for `translate`, for example \"German\"."},"instruction":{"type":"string","maxLength":1000,"description":"Required for `custom`."},"connectionId":{"type":"string","description":"AI connection to use. Defaults to the workspace default."}},"required":["text","mode"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"},"context":{"type":"object","properties":{"brandVoice":{"type":"boolean"},"facts":{"type":"array","items":{"type":"string"}}},"required":["brandVoice","facts"]},"usage":{"type":"object","properties":{"connectionId":{"type":"string"},"model":{"type":"string"},"inputTokens":{"type":["number","null"]},"outputTokens":{"type":["number","null"]},"latencyMs":{"type":"number"}},"required":["connectionId","model","inputTokens","outputTokens","latencyMs"]}},"required":["text","usage"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/explain-failure":{"post":{"operationId":"explainFailureAi","tags":["AI assistant"],"summary":"Explain a failed email","description":"For a bounced, failed, deferred, complained or suppressed email: rule-based hints for known codes (550 5.1.1 user unknown, SPF and DKIM failures, DMARC rejections, full mailboxes, provider limits and rate limits, blocklists), the SMTP codes, the sending domain's DNS status, and links to the settings that fix it. The model gets codes, provider messages with addresses removed and the domain status; never the recipient address, the subject or the content. The rule-based part is returned also while the assistant is off; `ai.status` says whether the model added its wording (`ok`, `not_requested`, `disabled`, `not_configured`, `rate_limited`, `error`). Prompts include the brand voice and matching facts (workspace notes) unless the privacy settings leave them out.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"emailId":{"type":"string","description":"A sent email (`msg_` id)."},"useAi":{"type":"boolean","default":true,"description":"Ask the model to word the result. The rule-based part is returned either way, also while the assistant is off."},"language":{"type":"string","maxLength":60,"description":"Language of the AI wording, for example \"German\". Default: English for explanations, the content's language for copy."},"connectionId":{"type":"string","description":"AI connection to use. Defaults to the workspace default."}},"required":["emailId"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"emailId":{"type":"string"},"status":{"type":"string"},"summary":{"type":"string"},"hints":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","description":"For example `user_unknown`, `spf_fail`, `dmarc_reject`, `mailbox_full`, `rate_limited`, `provider_quota`."},"severity":{"type":"string","enum":["error","warning","info"]},"title":{"type":"string"},"explanation":{"type":"string"},"actions":{"type":"array","items":{"type":"string"}},"links":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"href":{"type":"string","description":"A dashboard path, for example `/domains/dom_1`."}},"required":["label","href"]}},"retryable":{"type":"boolean","description":"Sending again later can succeed without changing anything."}},"required":["code","severity","title","explanation","actions","links","retryable"]}},"facts":{"type":"object","properties":{"provider":{"type":["string","null"]},"connectionId":{"type":["string","null"]},"smtpCode":{"type":["string","null"],"description":"Basic SMTP reply code, for example 550."},"enhancedCode":{"type":["string","null"],"description":"Enhanced status code, for example 5.1.1."},"httpStatus":{"type":["number","null"]},"errorCode":{"type":["string","null"]},"recipientDomain":{"type":["string","null"]},"mailboxProvider":{"type":["string","null"]},"sendingDomain":{"type":["string","null"]},"domain":{"type":["object","null"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"spf":{"type":"string","enum":["ok","missing","mismatch","pending","not_needed","unknown"]},"dkim":{"type":"string","enum":["ok","missing","mismatch","pending","not_needed","unknown"]},"dmarc":{"type":"string","enum":["ok","missing","mismatch","pending","not_needed","unknown"]},"returnPath":{"type":"string","enum":["ok","missing","mismatch","pending","not_needed","unknown"]},"dmarcPolicy":{"type":["string","null"]}},"required":["id","name","status","spf","dkim","dmarc","returnPath","dmarcPolicy"]},"attempts":{"type":"number"},"events":{"type":"array","items":{"type":"string"}}},"required":["provider","connectionId","smtpCode","enhancedCode","httpStatus","errorCode","recipientDomain","mailboxProvider","sendingDomain","domain","attempts","events"]},"ai":{"type":"object","properties":{"status":{"type":"string","enum":["ok","not_requested","disabled","not_configured","rate_limited","error"]},"message":{"type":["string","null"]},"usage":{"type":["object","null"],"properties":{"connectionId":{"type":"string"},"model":{"type":"string"},"inputTokens":{"type":["number","null"]},"outputTokens":{"type":["number","null"]},"latencyMs":{"type":"number"}},"required":["connectionId","model","inputTokens","outputTokens","latencyMs"]},"explanation":{"type":["string","null"]},"steps":{"type":"array","items":{"type":"string"}}},"required":["status","message","usage","explanation","steps"]}},"required":["emailId","status","summary","hints","facts","ai"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/deliverability-review":{"post":{"operationId":"deliverabilityReviewAi","tags":["AI assistant"],"summary":"Review deliverability","description":"A prioritized list of fixes from the workspace's DNS and authentication status per domain (SPF, DKIM, DMARC, alignment), bounce and complaint rates overall and per provider, suppression growth, warm-up and webhook health. Checks for data this server does not record are listed in `skipped`. Only aggregates are sent to the model. The rule-based part is returned also while the assistant is off; `ai.status` says whether the model added its wording (`ok`, `not_requested`, `disabled`, `not_configured`, `rate_limited`, `error`). Prompts include the brand voice and matching facts (workspace notes) unless the privacy settings leave them out.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"integer","minimum":1,"maximum":90,"default":30,"description":"Window for bounce, complaint and suppression rates."},"useAi":{"type":"boolean","default":true,"description":"Ask the model to word the result. The rule-based part is returned either way, also while the assistant is off."},"language":{"type":"string","maxLength":60,"description":"Language of the AI wording, for example \"German\". Default: English for explanations, the content's language for copy."},"connectionId":{"type":"string","description":"AI connection to use. Defaults to the workspace default."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"days":{"type":"number"},"findings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"priority":{"type":"string","enum":["high","medium","low"]},"area":{"type":"string","enum":["authentication","bounces","complaints","providers","suppressions","warmup","webhooks","setup"]},"title":{"type":"string"},"detail":{"type":"string"},"fix":{"type":"string"},"links":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"href":{"type":"string","description":"A dashboard path, for example `/domains/dom_1`."}},"required":["label","href"]}},"domain":{"type":["string","null"]},"connectionId":{"type":["string","null"]},"aiText":{"type":["string","null"]}},"required":["code","priority","area","title","detail","fix","links","domain","connectionId","aiText"]}},"passed":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"title":{"type":"string"}},"required":["code","title"]}},"stats":{"type":"object","properties":{"sent":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"},"domains":{"type":"number"},"providers":{"type":"number"},"suppressions":{"type":"object","properties":{"total":{"type":"number"},"addedLast7Days":{"type":"number"},"addedPrevious7Days":{"type":"number"}},"required":["total","addedLast7Days","addedPrevious7Days"]}},"required":["sent","bounceRate","complaintRate","domains","providers","suppressions"]},"skipped":{"type":"array","items":{"type":"string"}},"ai":{"type":"object","properties":{"status":{"type":"string","enum":["ok","not_requested","disabled","not_configured","rate_limited","error"]},"message":{"type":["string","null"]},"usage":{"type":["object","null"],"properties":{"connectionId":{"type":"string"},"model":{"type":"string"},"inputTokens":{"type":["number","null"]},"outputTokens":{"type":["number","null"]},"latencyMs":{"type":"number"}},"required":["connectionId","model","inputTokens","outputTokens","latencyMs"]},"summary":{"type":["string","null"]}},"required":["status","message","usage","summary"]}},"required":["checkedAt","days","findings","passed","stats","skipped","ai"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/spam-check":{"post":{"operationId":"spamCheckAi","tags":["AI assistant"],"summary":"Check content for spam before sending","description":"The content check (spammy phrases, image-to-text ratio, URL shorteners, all-caps subjects, missing unsubscribe link) plus link domains compared with the sending domain and a postal address for marketing email. With the assistant on, the model suggests a calmer subject, preview text and rewrites of flagged passages. A stored template is shown to the model with its own test data, never with `variables`. The rule-based part is returned also while the assistant is off; `ai.status` says whether the model added its wording (`ok`, `not_requested`, `disabled`, `not_configured`, `rate_limited`, `error`). Prompts include the brand voice and matching facts (workspace notes) unless the privacy settings leave them out.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string","maxLength":998,"default":""},"previewText":{"type":"string","maxLength":500},"html":{"type":"string","maxLength":2000000},"text":{"type":"string","maxLength":500000},"template":{"type":"string","maxLength":200,"description":"A stored template (id or slug), rendered with its test data, instead of html and text."},"variables":{"type":"object","additionalProperties":{}},"type":{"type":"string","enum":["transactional","broadcast"],"default":"broadcast","description":"`broadcast` (marketing) adds the unsubscribe and postal address checks."},"fromEmail":{"type":"string","maxLength":320,"description":"Sender address: link domains are compared with its domain."},"useAi":{"type":"boolean","default":true,"description":"Ask the model to word the result. The rule-based part is returned either way, also while the assistant is off."},"connectionId":{"type":"string","description":"AI connection to use. Defaults to the workspace default."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":"string","enum":["good","review","risky"],"description":"`risky`: at least one error or three warnings. `review`: a warning. `good`: neither."},"findings":{"type":"array","items":{"type":"object","properties":{"level":{"type":"string","enum":["ok","info","warning","error"]},"code":{"type":"string"},"message":{"type":"string"}},"required":["level","code","message"]}},"stats":{"type":"object","properties":{"words":{"type":"number"},"links":{"type":"number"},"images":{"type":"number"},"subjectLength":{"type":"number"},"linkDomains":{"type":"array","items":{"type":"string"}},"otherLinkDomains":{"type":"array","items":{"type":"string"}}},"required":["words","links","images","subjectLength","linkDomains","otherLinkDomains"]},"ai":{"type":"object","properties":{"status":{"type":"string","enum":["ok","not_requested","disabled","not_configured","rate_limited","error"]},"message":{"type":["string","null"]},"usage":{"type":["object","null"],"properties":{"connectionId":{"type":"string"},"model":{"type":"string"},"inputTokens":{"type":["number","null"]},"outputTokens":{"type":["number","null"]},"latencyMs":{"type":"number"}},"required":["connectionId","model","inputTokens","outputTokens","latencyMs"]},"subject":{"type":["string","null"]},"previewText":{"type":["string","null"]},"notes":{"type":"array","items":{"type":"string"}},"rewrites":{"type":"array","items":{"type":"object","properties":{"original":{"type":"string"},"suggestion":{"type":"string"}},"required":["original","suggestion"]}},"context":{"type":["object","null"],"properties":{"brandVoice":{"type":"boolean"},"facts":{"type":"array","items":{"type":"string"}}},"required":["brandVoice","facts"]}},"required":["status","message","usage","subject","previewText","notes","rewrites","context"]}},"required":["verdict","findings","stats","ai"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/write-campaign":{"post":{"operationId":"writeCampaignAi","tags":["AI assistant"],"summary":"Write a campaign from a goal","description":"Subject line, preview text and a validated template document (blocks) for a goal and an audience described in words, in the brand voice and with matching facts. Uses template generation (one retry when the first answer is not valid). Nothing is saved. Returns 403 `ai_disabled` while the assistant is turned off and 400 `ai_not_configured` without a connection.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"goal":{"type":"string","minLength":3,"maxLength":2000,"description":"What the campaign should achieve, for example \"Get trial users to book an onboarding call\"."},"audience":{"type":"string","maxLength":1000,"description":"Who receives it, in words. Never a list of contacts."},"callToAction":{"type":"object","properties":{"label":{"type":"string","maxLength":80},"url":{"type":"string","maxLength":2048}}},"length":{"type":"string","enum":["short","medium","long"],"default":"medium"},"language":{"type":"string","maxLength":60,"description":"Language of the AI wording, for example \"German\". Default: English for explanations, the content's language for copy."},"brand":{"type":"object","properties":{"primary":{"type":"string"},"accent":{"type":"string"},"logoUrl":{"type":"string"},"companyName":{"type":"string","maxLength":120}}},"connectionId":{"type":"string","description":"AI connection to use. Defaults to the workspace default."}},"required":["goal"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string"},"previewText":{"type":"string"},"document":{"type":"object","additionalProperties":{}},"variables":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}},"attempts":{"type":"number"},"context":{"type":"object","properties":{"brandVoice":{"type":"boolean"},"facts":{"type":"array","items":{"type":"string"}}},"required":["brandVoice","facts"]},"usage":{"type":"object","properties":{"connectionId":{"type":"string"},"model":{"type":"string"},"inputTokens":{"type":["number","null"]},"outputTokens":{"type":["number","null"]},"latencyMs":{"type":"number"}},"required":["connectionId","model","inputTokens","outputTokens","latencyMs"]}},"required":["subject","previewText","document","variables","warnings","attempts","context","usage"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/ai/translate-template":{"post":{"operationId":"translateTemplateAi","tags":["AI assistant"],"summary":"Translate a template","description":"Translates every text of a template document (all text blocks, buttons, lists, tables and the footer) and the subject and preheader. Structure, styles, links and {{ variables }} are not sent for translation and stay unchanged; a translated text that changed a variable or a link is kept in the original language (`segments.kept`). Large templates take several model requests. Nothing is saved. Returns 403 `ai_disabled` while the assistant is turned off and 400 `ai_not_configured` without a connection. Prompts include the brand voice and matching facts (workspace notes) unless the privacy settings leave them out.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"document":{"type":"object","additionalProperties":{},"description":"A template document (`{ version, theme, blocks }`)."},"template":{"type":"string","maxLength":200,"description":"Or a stored template (id or slug): its current version is translated. Nothing is saved."},"subject":{"type":"string","maxLength":998},"preheader":{"type":"string","maxLength":500},"language":{"type":"string","minLength":2,"maxLength":60,"description":"Target language, for example \"German\" or \"pt-BR\"."},"connectionId":{"type":"string","description":"AI connection to use. Defaults to the workspace default."}},"required":["language"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"document":{"type":"object","additionalProperties":{}},"subject":{"type":"string"},"preheader":{"type":"string"},"language":{"type":"string"},"segments":{"type":"object","properties":{"total":{"type":"number"},"translated":{"type":"number"},"kept":{"type":"number","description":"Kept in the original language because the translation changed a variable or a link."}},"required":["total","translated","kept"]},"warnings":{"type":"array","items":{"type":"string"}},"context":{"type":"object","properties":{"brandVoice":{"type":"boolean"},"facts":{"type":"array","items":{"type":"string"}}},"required":["brandVoice","facts"]},"usage":{"type":"object","properties":{"connectionId":{"type":"string"},"model":{"type":"string"},"inputTokens":{"type":["number","null"]},"outputTokens":{"type":["number","null"]},"latencyMs":{"type":"number"}},"required":["connectionId","model","inputTokens","outputTokens","latencyMs"]}},"required":["document","subject","preheader","language","segments","warnings","context","usage"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/tools/dns":{"post":{"operationId":"checkDns","tags":["Tools"],"summary":"Check the email DNS records of any domain","description":"Checks MX, SPF (with the DNS lookup count through nested includes), DKIM, DMARC, BIMI (logo and certificate reachability), MTA-STS and TLS-RPT for any domain, not only domains in this workspace. Uses DNS-over-HTTPS. Nothing is stored. Rate-limited per workspace (30 checks per minute).","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string","minLength":1,"maxLength":253,"description":"Domain name, for example example.com. A URL or an email address is reduced to its domain."},"selectors":{"type":"array","items":{"type":"string","maxLength":63},"maxItems":20,"description":"DKIM selectors to check (the s= tag of a DKIM-Signature). Without them, common selector names are tried."},"checks":{"type":"array","items":{"type":"string","enum":["mx","spf","dkim","dmarc","bimi","mta_sts","tls_rpt"]},"description":"Run only these checks. Default: all."}},"required":["domain"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string"},"checkedAt":{"type":"string"},"status":{"type":"string","enum":["ok","info","warning","error"]},"mx":{"type":"object","properties":{"status":{"type":"string","enum":["ok","info","warning","error"]},"name":{"type":"string","description":"DNS name that was checked"},"records":{"type":"array","items":{"type":"string"}},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ToolFinding"}},"details":{}},"required":["status","name","records","findings"]},"spf":{"type":"object","properties":{"status":{"type":"string","enum":["ok","info","warning","error"]},"name":{"type":"string","description":"DNS name that was checked"},"records":{"type":"array","items":{"type":"string"}},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ToolFinding"}},"details":{}},"required":["status","name","records","findings"]},"dkim":{"type":"object","properties":{"status":{"type":"string","enum":["ok","info","warning","error"]},"name":{"type":"string","description":"DNS name that was checked"},"records":{"type":"array","items":{"type":"string"}},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ToolFinding"}},"details":{}},"required":["status","name","records","findings"]},"dmarc":{"type":"object","properties":{"status":{"type":"string","enum":["ok","info","warning","error"]},"name":{"type":"string","description":"DNS name that was checked"},"records":{"type":"array","items":{"type":"string"}},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ToolFinding"}},"details":{}},"required":["status","name","records","findings"]},"bimi":{"type":"object","properties":{"status":{"type":"string","enum":["ok","info","warning","error"]},"name":{"type":"string","description":"DNS name that was checked"},"records":{"type":"array","items":{"type":"string"}},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ToolFinding"}},"details":{}},"required":["status","name","records","findings"]},"mta_sts":{"type":"object","properties":{"status":{"type":"string","enum":["ok","info","warning","error"]},"name":{"type":"string","description":"DNS name that was checked"},"records":{"type":"array","items":{"type":"string"}},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ToolFinding"}},"details":{}},"required":["status","name","records","findings"]},"tls_rpt":{"type":"object","properties":{"status":{"type":"string","enum":["ok","info","warning","error"]},"name":{"type":"string","description":"DNS name that was checked"},"records":{"type":"array","items":{"type":"string"}},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ToolFinding"}},"details":{}},"required":["status","name","records","findings"]}},"required":["domain","checkedAt","status"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/tools/dmarc":{"post":{"operationId":"generateDmarcRecord","tags":["Tools"],"summary":"Generate a DMARC record","description":"Builds a DMARC TXT record from the chosen policy and options, with a plain-language explanation of each tag. Nothing is published.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string","minLength":1,"maxLength":253,"description":"Domain name, for example example.com. A URL or an email address is reduced to its domain."},"policy":{"type":"string","enum":["none","quarantine","reject"]},"subdomainPolicy":{"type":["string","null"],"enum":["none","quarantine","reject",null]},"pct":{"type":"integer","minimum":0,"maximum":100},"rua":{"type":"array","items":{"type":"string","maxLength":254},"maxItems":5,"description":"Addresses for aggregate reports."},"ruf":{"type":"array","items":{"type":"string","maxLength":254},"maxItems":5,"description":"Addresses for failure reports."},"adkim":{"type":"string","enum":["r","s"]},"aspf":{"type":"string","enum":["r","s"]},"fo":{"type":"string","pattern":"^[01ds](:[01ds])*$"},"ri":{"type":"integer","minimum":3600,"maximum":604800}},"required":["policy"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":["string","null"]},"record":{"type":"string"},"explanation":{"type":"array","items":{"type":"string"}}},"required":["name","record","explanation"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/tools/spf":{"post":{"operationId":"buildSpfRecord","tags":["Tools"],"summary":"Build an SPF record","description":"Builds an SPF record from the sending providers connected to this workspace (or the `providers` you list), extra includes and IP addresses, and counts the DNS lookups it needs (limit 10). Providers that publish SPF on their own return-path subdomain are listed but not added unless `includeSubdomainProviders` is true.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string","minLength":1,"maxLength":253,"description":"Compare with the SPF record published for this domain."},"providers":{"type":"array","items":{"type":"string","maxLength":40},"maxItems":30,"description":"Provider ids. Default: the sending providers connected to this workspace."},"includes":{"type":"array","items":{"type":"string","maxLength":253},"maxItems":20},"ip4":{"type":"array","items":{"type":"string","maxLength":43},"maxItems":20},"ip6":{"type":"array","items":{"type":"string","maxLength":80},"maxItems":20},"mx":{"type":"boolean"},"a":{"type":"boolean"},"all":{"type":"string","enum":["-all","~all","?all"]},"includeSubdomainProviders":{"type":"boolean","description":"Also add includes for providers that publish SPF on their own return-path subdomain."},"countLookups":{"type":"boolean","description":"Resolve includes to count DNS lookups (default true)."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"record":{"type":"string"},"lookups":{"type":["number","null"]},"providers":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string"},"include":{"type":["string","null"]},"added":{"type":"boolean"},"note":{"type":"string"}},"required":["provider","include","added"]}},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ToolFinding"}},"current":{"type":["object","null"],"properties":{"domain":{"type":"string"},"record":{"type":["string","null"]},"lookups":{"type":"number"}},"required":["domain","record","lookups"]}},"required":["record","lookups","providers","findings","current"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/tools/headers":{"post":{"operationId":"analyzeHeaders","tags":["Tools"],"summary":"Analyze email headers","description":"Parses raw message headers: the delivery path (Received hops with the delay at each), the sending IP, SPF, DKIM and DMARC results from Authentication-Results, alignment with the From domain, and spam-filter headers. Nothing is stored.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"headers":{"type":"string","minLength":1,"maxLength":262144,"description":"Raw message headers as copied from \"Show original\" or \"View source\"."}},"required":["headers"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"object","additionalProperties":{}},"hops":{"type":"array","items":{"type":"object","properties":{"index":{"type":"number"},"from":{"type":["string","null"]},"by":{"type":["string","null"]},"with":{"type":["string","null"]},"ip":{"type":["string","null"]},"date":{"type":["string","null"]},"delaySeconds":{"type":["number","null"]},"tls":{"type":"boolean"}},"required":["index","from","by","with","ip","date","delaySeconds","tls"]}},"totalDelaySeconds":{"type":["number","null"]},"sendingIps":{"type":"array","items":{"type":"string"}},"originIp":{"type":["string","null"]},"authentication":{"type":"object","additionalProperties":{}},"dkimSignatures":{"type":"array","items":{"type":"object","additionalProperties":{}}},"alignment":{"type":"object","additionalProperties":{}},"spam":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value":{"type":"string"}},"required":["name","value"]}},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ToolFinding"}},"headerCount":{"type":"number"}},"required":["summary","hops","totalDelaySeconds","sendingIps","originIp","authentication","dkimSignatures","alignment","spam","findings","headerCount"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/tools/address":{"post":{"operationId":"checkAddress","tags":["Tools"],"summary":"Check email addresses","description":"For one address (`email`) or up to 50 (`emails`): syntax, whether the domain accepts email (MX), disposable domains (a small bundled list), role addresses such as info@ or admin@, and whether the address is on this workspace's suppression list. It does not connect to the recipient's mail server. Status: `valid`, `risky`, `invalid`, `suppressed` or `unknown` (DNS could not be reached).","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":998},"emails":{"type":"array","items":{"type":"string","maxLength":998},"maxItems":50}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"input":{"type":"string"},"email":{"type":["string","null"]},"status":{"type":"string","enum":["valid","risky","invalid","suppressed","unknown"]},"syntax":{"type":"boolean"},"domain":{"type":["string","null"]},"mx":{"type":"object","properties":{"found":{"type":["boolean","null"]},"hosts":{"type":"array","items":{"type":"string"}},"implicit":{"type":"boolean"},"nullMx":{"type":"boolean"}},"required":["found","hosts","implicit","nullMx"]},"disposable":{"type":"boolean"},"role":{"type":"boolean"},"suppressed":{"type":["object","null"],"properties":{"reason":{"type":"string"},"scope":{"type":"string"},"createdAt":{"type":"string"}},"required":["reason","scope","createdAt"]},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ToolFinding"}}},"required":["input","email","status","syntax","domain","mx","disposable","role","suppressed","findings"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/tools/content":{"post":{"operationId":"checkContent","tags":["Tools"],"summary":"Check email content before sending","description":"Heuristic checks on a subject and HTML/text, or on a stored template rendered with sample variables: missing plain text, missing unsubscribe link for marketing email, HTML over 102 KB (Gmail clipping), image-to-text ratio, link count, URL shorteners, links whose text shows another domain, images without alt text, all-caps or !!! subjects, and a short list of phrases spam filters weigh. Not a spam score. Nothing is stored.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string","maxLength":998},"html":{"type":"string","maxLength":5000000},"text":{"type":"string","maxLength":2000000},"type":{"type":"string","enum":["transactional","broadcast"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"template":{"type":"string","description":"Template id or slug: checks the rendered template instead of subject/html/text (those override the template when set)."},"variables":{"type":"object","additionalProperties":{},"description":"Sample variables for the template. Default: the template test data."},"viaOneSend":{"type":"boolean","description":"Whether OneSend will send it (it adds List-Unsubscribe headers to broadcasts). Default true."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"False when a finding has level error."},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ToolFinding"}},"stats":{"type":"object","properties":{"htmlBytes":{"type":"number"},"textChars":{"type":"number"},"words":{"type":"number"},"links":{"type":"number"},"uniqueLinkDomains":{"type":"array","items":{"type":"string"}},"images":{"type":"number"},"imagesWithoutAlt":{"type":"number"},"subjectLength":{"type":"number"}},"required":["htmlBytes","textChars","words","links","uniqueLinkDomains","images","imagesWithoutAlt","subjectLength"]},"rendered":{"type":"object","properties":{"subject":{"type":"string"},"templateId":{"type":"string"},"version":{"type":"number"}},"required":["subject","templateId","version"]}},"required":["ok","findings","stats"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/compat/resend/emails":{"post":{"operationId":"compatResendSendEmail","tags":["Compatibility"],"security":[{"bearer":[]}],"summary":"Send an email (Resend-compatible)","description":"Accepts the Resend `POST /emails` payload. Point a Resend SDK at `<your server>/compat/resend` and use a OneSend API key as the key. The email goes through your routing policy like `POST /v1/emails`. Tags become OneSend tags `name:value`; `template.id` is a OneSend template id or slug. Not supported: `react` (render it before sending), `topic_id`, attachment `content_id` (inline images). `text` is not generated from `html`.","parameters":[{"schema":{"type":"string","maxLength":256},"required":false,"name":"idempotency-key","in":"header"},{"schema":{"type":"string","enum":["transactional","broadcast"],"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns."},"required":false,"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns.","name":"x-onesend-type","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string"},"to":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"subject":{"type":"string"},"cc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"bcc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"reply_to":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"html":{"type":"string"},"text":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"attachments":{"type":"array","items":{"type":"object","properties":{"filename":{"type":"string"},"content":{"type":"string"},"path":{"type":"string"},"content_type":{"type":"string"}}}},"tags":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value":{"type":"string"}},"required":["name","value"]}},"scheduled_at":{"type":"string"},"template":{"type":"object","properties":{"id":{"type":"string"},"variables":{"type":"object","additionalProperties":{}}},"required":["id"]}},"required":["from","to","subject"],"additionalProperties":{}}}}},"responses":{"200":{"description":"Queued","headers":{"X-OneSend-Ignored-Fields":{"description":"Comma-separated request fields that were accepted but have no effect in OneSend.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]}}}},"401":{"description":"No API key (`missing_api_key`)","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"name":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","name","message"]}}}},"403":{"description":"Invalid or expired API key (`validation_error`; OneSend `key_expired`), a key without send permission, a key used from an address it does not allow (OneSend `ip_not_allowed`), a recipient outside the key's allowlist (`recipient_not_allowed`), or a session that needs two-factor authentication (all `restricted_api_key`); a sender domain the key may not use (`validation_error`)","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"name":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","name","message"]}}}},"404":{"description":"Template not found (`not_found`)","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"name":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","name","message"]}}}},"409":{"description":"Idempotency-Key reused with a different body (`invalid_idempotent_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"name":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","name","message"]}}}},"422":{"description":"Invalid or missing fields (`validation_error`, `missing_required_field`), and, as `validation_error`: no plan or license for live email (`plan_required`, `license_required`), the plan's monthly emails used (`email_limit`), a sender domain outside the plan (`domain_limit`), or no sending provider that may or can send for the From domain (`no_provider_for_domain`). A batch is refused whole: nothing is queued.","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"name":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","name","message"]}}}},"429":{"description":"The key's hourly or daily send limit (`rate_limit_exceeded`; OneSend `key_rate_limited`), with `Retry-After`","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"name":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","name","message"]}}}}}}},"/compat/resend/emails/batch":{"post":{"operationId":"compatResendSendBatch","tags":["Compatibility"],"security":[{"bearer":[]}],"summary":"Send up to 100 emails (Resend-compatible)","description":"Accepts the Resend `POST /emails/batch` payload: a JSON array of emails. By default one invalid email rejects the batch; with `x-batch-validation: permissive` valid emails are sent and the rest listed in `errors`. With `Idempotency-Key`, item *i* uses `<key>:<i>`.","parameters":[{"schema":{"type":"string","maxLength":256},"required":false,"name":"idempotency-key","in":"header"},{"schema":{"type":"string","enum":["strict","permissive"]},"required":false,"name":"x-batch-validation","in":"header"},{"schema":{"type":"string","enum":["transactional","broadcast"],"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns."},"required":false,"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns.","name":"x-onesend-type","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string"},"to":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"subject":{"type":"string"},"cc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"bcc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"reply_to":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"html":{"type":"string"},"text":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"attachments":{"type":"array","items":{"type":"object","properties":{"filename":{"type":"string"},"content":{"type":"string"},"path":{"type":"string"},"content_type":{"type":"string"}}}},"tags":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value":{"type":"string"}},"required":["name","value"]}},"scheduled_at":{"type":"string"},"template":{"type":"object","properties":{"id":{"type":"string"},"variables":{"type":"object","additionalProperties":{}}},"required":["id"]}},"required":["from","to","subject"],"additionalProperties":{}},"maxItems":100}}}},"responses":{"200":{"description":"Queued","headers":{"X-OneSend-Ignored-Fields":{"description":"Comma-separated request fields that were accepted but have no effect in OneSend.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]}},"errors":{"type":"array","items":{"type":"object","properties":{"index":{"type":"number"},"message":{"type":"string"}},"required":["index","message"]}}},"required":["data"]}}}},"401":{"description":"No API key (`missing_api_key`)","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"name":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","name","message"]}}}},"403":{"description":"Invalid or expired API key (`validation_error`; OneSend `key_expired`), a key without send permission, a key used from an address it does not allow (OneSend `ip_not_allowed`), a recipient outside the key's allowlist (`recipient_not_allowed`), or a session that needs two-factor authentication (all `restricted_api_key`); a sender domain the key may not use (`validation_error`)","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"name":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","name","message"]}}}},"404":{"description":"Template not found (`not_found`)","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"name":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","name","message"]}}}},"409":{"description":"Idempotency-Key reused with a different body (`invalid_idempotent_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"name":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","name","message"]}}}},"422":{"description":"Invalid or missing fields (`validation_error`, `missing_required_field`), and, as `validation_error`: no plan or license for live email (`plan_required`, `license_required`), the plan's monthly emails used (`email_limit`), a sender domain outside the plan (`domain_limit`), or no sending provider that may or can send for the From domain (`no_provider_for_domain`). A batch is refused whole: nothing is queued.","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"name":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","name","message"]}}}},"429":{"description":"The key's hourly or daily send limit (`rate_limit_exceeded`; OneSend `key_rate_limited`), with `Retry-After`","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"name":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","name","message"]}}}}}}},"/compat/sendgrid/v3/mail/send":{"post":{"operationId":"compatSendgridMailSend","tags":["Compatibility"],"security":[{"bearer":[]}],"summary":"Send email (SendGrid v3-compatible)","description":"Accepts the SendGrid v3 `POST /v3/mail/send` payload. Point a SendGrid client at `<your server>/compat/sendgrid` and use a OneSend API key as the key. Each personalization becomes one OneSend email. Mapping: `categories` → tags, `custom_args` → metadata, `send_at` → scheduled send, `substitutions` are replaced in subject and content, `template_id` is a OneSend template id or slug with `dynamic_template_data` as its variables, `tracking_settings.open_tracking/click_tracking` → tracking. `mail_settings.sandbox_mode.enable` validates without sending (200). Ignored: `asm`, `batch_id`, `ip_pool_name`, other mail and tracking settings, inline attachments (`content_id`). Returns 202 with `X-Message-Id` (the first email) and `X-OneSend-Message-Ids` (all of them).","parameters":[{"schema":{"type":"string","maxLength":256},"required":false,"name":"idempotency-key","in":"header"},{"schema":{"type":"string","enum":["transactional","broadcast"],"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns."},"required":false,"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns.","name":"x-onesend-type","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"personalizations":{"type":"array","items":{"type":"object","properties":{"to":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}},"required":["email"]}},"cc":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}},"required":["email"]}},"bcc":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}},"required":["email"]}},"subject":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"substitutions":{"type":"object","additionalProperties":{"type":"string"}},"dynamic_template_data":{"type":"object","additionalProperties":{}},"custom_args":{"type":"object","additionalProperties":{"type":"string"}},"send_at":{"type":"number"}},"required":["to"],"additionalProperties":{}},"maxItems":1000},"from":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}},"required":["email"]},"reply_to":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}},"required":["email"]},"reply_to_list":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}},"required":["email"]}},"subject":{"type":"string"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"value":{"type":"string"}},"required":["type","value"]}},"attachments":{"type":"array","items":{"type":"object","properties":{"content":{"type":"string"},"filename":{"type":"string"},"type":{"type":"string"},"disposition":{"type":"string"}},"required":["content","filename"]}},"template_id":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"categories":{"type":"array","items":{"type":"string"},"maxItems":10},"custom_args":{"type":"object","additionalProperties":{"type":"string"}},"send_at":{"type":"number"}},"required":["personalizations","from"],"additionalProperties":{}}}}},"responses":{"200":{"description":"Sandbox mode: valid, nothing sent"},"202":{"description":"Queued","headers":{"X-Message-Id":{"description":"OneSend id of the first email","schema":{"type":"string"}},"X-OneSend-Message-Ids":{"description":"Every email id, comma-separated","schema":{"type":"string"}},"X-OneSend-Ignored-Fields":{"description":"Comma-separated request fields that were accepted but have no effect in OneSend.","schema":{"type":"string"}}}},"400":{"description":"Invalid payload, or no plan or license for live email (`plan_required`, `license_required`), the plan's monthly emails used (`email_limit`), a sender domain outside the plan (`domain_limit`), or no sending provider that may or can send for the From domain (`no_provider_for_domain`). Nothing is queued for any personalization.","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"field":{"type":["string","null"]},"help":{"type":"null"}},"required":["message","field","help"]}}},"required":["errors"]}}}},"401":{"description":"Missing, invalid or expired API key (OneSend `key_expired`)","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"field":{"type":["string","null"]},"help":{"type":"null"}},"required":["message","field","help"]}}},"required":["errors"]}}}},"403":{"description":"The key may not send, may not send from this domain or to this recipient (`recipient_not_allowed`), is used from an address it does not allow (`ip_not_allowed`), or a session needs two-factor authentication","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"field":{"type":["string","null"]},"help":{"type":"null"}},"required":["message","field","help"]}}},"required":["errors"]}}}},"429":{"description":"The key's hourly or daily send limit (OneSend `key_rate_limited`), with `Retry-After`","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"field":{"type":["string","null"]},"help":{"type":"null"}},"required":["message","field","help"]}}},"required":["errors"]}}}}}}},"/compat/postmark/email":{"post":{"operationId":"compatPostmarkSendEmail","tags":["Compatibility"],"security":[{"postmarkServerToken":[]}],"summary":"Send an email (Postmark-compatible)","description":"Accepts the Postmark `POST /email` payload. Point a Postmark client at `<your server>/compat/postmark` and use a OneSend API key as the server token. `Tag` → tag, `Metadata` → metadata, `TrackOpens`/`TrackLinks` → tracking (`TextOnly` link tracking is treated as on), a `MessageStream` whose name contains \"broadcast\" sends as marketing email. Ignored: `InlineCss`, attachment `ContentID` (inline images).","parameters":[{"schema":{"type":"string","enum":["transactional","broadcast"],"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns."},"required":false,"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns.","name":"x-onesend-type","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"From":{"type":"string"},"To":{"type":"string"},"Cc":{"type":"string"},"Bcc":{"type":"string"},"Subject":{"type":"string"},"Tag":{"type":"string"},"HtmlBody":{"type":"string"},"TextBody":{"type":"string"},"ReplyTo":{"type":"string"},"Headers":{"type":"array","items":{"type":"object","properties":{"Name":{"type":"string"},"Value":{"type":"string"}},"required":["Name","Value"]}},"TrackOpens":{"type":"boolean"},"TrackLinks":{"type":"string","enum":["None","HtmlAndText","HtmlOnly","TextOnly"]},"Metadata":{"type":"object","additionalProperties":{"type":"string"}},"Attachments":{"type":"array","items":{"type":"object","properties":{"Name":{"type":"string"},"Content":{"type":"string"},"ContentType":{"type":"string"}},"required":["Name","Content"]}},"MessageStream":{"type":"string"}},"required":["From","To"],"additionalProperties":{}}}}},"responses":{"200":{"description":"Accepted","headers":{"X-OneSend-Ignored-Fields":{"description":"Comma-separated request fields that were accepted but have no effect in OneSend.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"To":{"type":"string"},"SubmittedAt":{"type":"string"},"MessageID":{"type":"string"},"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["To","ErrorCode","Message"]}}}},"401":{"description":"Missing, invalid or expired X-Postmark-Server-Token (`ErrorCode` 10; OneSend `key_expired`)","content":{"application/json":{"schema":{"type":"object","properties":{"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["ErrorCode","Message"]}}}},"422":{"description":"Invalid message (`ErrorCode` 300), sender domain not allowed for this key (400), invalid JSON (402), key may not send, recipient not allowed, address not allowed or two-factor authentication needed (405), template not found (1101); and with `ErrorCode` 300: no plan or license for live email (`plan_required`, `license_required`), the plan's monthly emails used (`email_limit`), a sender domain outside the plan (`domain_limit`), or no sending provider that may or can send for the From domain (`no_provider_for_domain`)","content":{"application/json":{"schema":{"type":"object","properties":{"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["ErrorCode","Message"]}}}},"429":{"description":"The key's hourly or daily send limit (OneSend `key_rate_limited`), with `Retry-After`","content":{"application/json":{"schema":{"type":"object","properties":{"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["ErrorCode","Message"]}}}}}}},"/compat/postmark/email/withTemplate":{"post":{"operationId":"compatPostmarkSendWithTemplate","tags":["Compatibility"],"security":[{"postmarkServerToken":[]}],"summary":"Send with a template (Postmark-compatible)","description":"Accepts the Postmark `POST /email/withTemplate` payload. `TemplateId` or `TemplateAlias` is a OneSend template id or slug; `TemplateModel` holds its variables. Point a Postmark client at `<your server>/compat/postmark` and use a OneSend API key as the server token. `Tag` → tag, `Metadata` → metadata, `TrackOpens`/`TrackLinks` → tracking (`TextOnly` link tracking is treated as on), a `MessageStream` whose name contains \"broadcast\" sends as marketing email. Ignored: `InlineCss`, attachment `ContentID` (inline images).","parameters":[{"schema":{"type":"string","enum":["transactional","broadcast"],"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns."},"required":false,"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns.","name":"x-onesend-type","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"From":{"type":"string"},"To":{"type":"string"},"Cc":{"type":"string"},"Bcc":{"type":"string"},"Subject":{"type":"string"},"Tag":{"type":"string"},"HtmlBody":{"type":"string"},"TextBody":{"type":"string"},"ReplyTo":{"type":"string"},"Headers":{"type":"array","items":{"type":"object","properties":{"Name":{"type":"string"},"Value":{"type":"string"}},"required":["Name","Value"]}},"TrackOpens":{"type":"boolean"},"TrackLinks":{"type":"string","enum":["None","HtmlAndText","HtmlOnly","TextOnly"]},"Metadata":{"type":"object","additionalProperties":{"type":"string"}},"Attachments":{"type":"array","items":{"type":"object","properties":{"Name":{"type":"string"},"Content":{"type":"string"},"ContentType":{"type":"string"}},"required":["Name","Content"]}},"MessageStream":{"type":"string"},"TemplateId":{"anyOf":[{"type":"number"},{"type":"string"}]},"TemplateAlias":{"type":"string"},"TemplateModel":{"type":"object","additionalProperties":{}}},"required":["From","To"],"additionalProperties":{}}}}},"responses":{"200":{"description":"Accepted","headers":{"X-OneSend-Ignored-Fields":{"description":"Comma-separated request fields that were accepted but have no effect in OneSend.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"To":{"type":"string"},"SubmittedAt":{"type":"string"},"MessageID":{"type":"string"},"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["To","ErrorCode","Message"]}}}},"401":{"description":"Missing, invalid or expired X-Postmark-Server-Token (`ErrorCode` 10; OneSend `key_expired`)","content":{"application/json":{"schema":{"type":"object","properties":{"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["ErrorCode","Message"]}}}},"422":{"description":"Invalid message (`ErrorCode` 300), sender domain not allowed for this key (400), invalid JSON (402), key may not send, recipient not allowed, address not allowed or two-factor authentication needed (405), template not found (1101); and with `ErrorCode` 300: no plan or license for live email (`plan_required`, `license_required`), the plan's monthly emails used (`email_limit`), a sender domain outside the plan (`domain_limit`), or no sending provider that may or can send for the From domain (`no_provider_for_domain`)","content":{"application/json":{"schema":{"type":"object","properties":{"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["ErrorCode","Message"]}}}},"429":{"description":"The key's hourly or daily send limit (OneSend `key_rate_limited`), with `Retry-After`","content":{"application/json":{"schema":{"type":"object","properties":{"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["ErrorCode","Message"]}}}}}}},"/compat/postmark/email/batch":{"post":{"operationId":"compatPostmarkSendBatch","tags":["Compatibility"],"security":[{"postmarkServerToken":[]}],"summary":"Send up to 500 emails (Postmark-compatible)","description":"Accepts the Postmark `POST /email/batch` payload. Each message is validated and sent on its own: check `ErrorCode` in every result. Point a Postmark client at `<your server>/compat/postmark` and use a OneSend API key as the server token. `Tag` → tag, `Metadata` → metadata, `TrackOpens`/`TrackLinks` → tracking (`TextOnly` link tracking is treated as on), a `MessageStream` whose name contains \"broadcast\" sends as marketing email. Ignored: `InlineCss`, attachment `ContentID` (inline images).","parameters":[{"schema":{"type":"string","enum":["transactional","broadcast"],"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns."},"required":false,"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns.","name":"x-onesend-type","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"From":{"type":"string"},"To":{"type":"string"},"Cc":{"type":"string"},"Bcc":{"type":"string"},"Subject":{"type":"string"},"Tag":{"type":"string"},"HtmlBody":{"type":"string"},"TextBody":{"type":"string"},"ReplyTo":{"type":"string"},"Headers":{"type":"array","items":{"type":"object","properties":{"Name":{"type":"string"},"Value":{"type":"string"}},"required":["Name","Value"]}},"TrackOpens":{"type":"boolean"},"TrackLinks":{"type":"string","enum":["None","HtmlAndText","HtmlOnly","TextOnly"]},"Metadata":{"type":"object","additionalProperties":{"type":"string"}},"Attachments":{"type":"array","items":{"type":"object","properties":{"Name":{"type":"string"},"Content":{"type":"string"},"ContentType":{"type":"string"}},"required":["Name","Content"]}},"MessageStream":{"type":"string"}},"required":["From","To"],"additionalProperties":{}},"maxItems":500}}}},"responses":{"200":{"description":"Accepted","headers":{"X-OneSend-Ignored-Fields":{"description":"Comma-separated request fields that were accepted but have no effect in OneSend.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"To":{"type":"string"},"SubmittedAt":{"type":"string"},"MessageID":{"type":"string"},"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["To","ErrorCode","Message"]}}}}},"401":{"description":"Missing, invalid or expired X-Postmark-Server-Token (`ErrorCode` 10; OneSend `key_expired`)","content":{"application/json":{"schema":{"type":"object","properties":{"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["ErrorCode","Message"]}}}},"422":{"description":"Invalid message (`ErrorCode` 300), sender domain not allowed for this key (400), invalid JSON (402), key may not send, recipient not allowed, address not allowed or two-factor authentication needed (405), template not found (1101); and with `ErrorCode` 300: no plan or license for live email (`plan_required`, `license_required`), the plan's monthly emails used (`email_limit`), a sender domain outside the plan (`domain_limit`), or no sending provider that may or can send for the From domain (`no_provider_for_domain`)","content":{"application/json":{"schema":{"type":"object","properties":{"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["ErrorCode","Message"]}}}},"429":{"description":"The key's hourly or daily send limit (OneSend `key_rate_limited`), with `Retry-After`","content":{"application/json":{"schema":{"type":"object","properties":{"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["ErrorCode","Message"]}}}}}}},"/compat/postmark/email/batchWithTemplates":{"post":{"operationId":"compatPostmarkSendBatchWithTemplates","tags":["Compatibility"],"security":[{"postmarkServerToken":[]}],"summary":"Send up to 500 emails with templates (Postmark-compatible)","description":"Accepts the Postmark `POST /email/batchWithTemplates` payload. Point a Postmark client at `<your server>/compat/postmark` and use a OneSend API key as the server token. `Tag` → tag, `Metadata` → metadata, `TrackOpens`/`TrackLinks` → tracking (`TextOnly` link tracking is treated as on), a `MessageStream` whose name contains \"broadcast\" sends as marketing email. Ignored: `InlineCss`, attachment `ContentID` (inline images).","parameters":[{"schema":{"type":"string","enum":["transactional","broadcast"],"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns."},"required":false,"description":"Send as marketing email (`broadcast`): adds List-Unsubscribe headers and uses only providers allowed for campaigns.","name":"x-onesend-type","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"Messages":{"type":"array","items":{"type":"object","properties":{"From":{"type":"string"},"To":{"type":"string"},"Cc":{"type":"string"},"Bcc":{"type":"string"},"Subject":{"type":"string"},"Tag":{"type":"string"},"HtmlBody":{"type":"string"},"TextBody":{"type":"string"},"ReplyTo":{"type":"string"},"Headers":{"type":"array","items":{"type":"object","properties":{"Name":{"type":"string"},"Value":{"type":"string"}},"required":["Name","Value"]}},"TrackOpens":{"type":"boolean"},"TrackLinks":{"type":"string","enum":["None","HtmlAndText","HtmlOnly","TextOnly"]},"Metadata":{"type":"object","additionalProperties":{"type":"string"}},"Attachments":{"type":"array","items":{"type":"object","properties":{"Name":{"type":"string"},"Content":{"type":"string"},"ContentType":{"type":"string"}},"required":["Name","Content"]}},"MessageStream":{"type":"string"},"TemplateId":{"anyOf":[{"type":"number"},{"type":"string"}]},"TemplateAlias":{"type":"string"},"TemplateModel":{"type":"object","additionalProperties":{}}},"required":["From","To"],"additionalProperties":{}},"maxItems":500}},"required":["Messages"]}}}},"responses":{"200":{"description":"Accepted","headers":{"X-OneSend-Ignored-Fields":{"description":"Comma-separated request fields that were accepted but have no effect in OneSend.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"To":{"type":"string"},"SubmittedAt":{"type":"string"},"MessageID":{"type":"string"},"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["To","ErrorCode","Message"]}}}}},"401":{"description":"Missing, invalid or expired X-Postmark-Server-Token (`ErrorCode` 10; OneSend `key_expired`)","content":{"application/json":{"schema":{"type":"object","properties":{"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["ErrorCode","Message"]}}}},"422":{"description":"Invalid message (`ErrorCode` 300), sender domain not allowed for this key (400), invalid JSON (402), key may not send, recipient not allowed, address not allowed or two-factor authentication needed (405), template not found (1101); and with `ErrorCode` 300: no plan or license for live email (`plan_required`, `license_required`), the plan's monthly emails used (`email_limit`), a sender domain outside the plan (`domain_limit`), or no sending provider that may or can send for the From domain (`no_provider_for_domain`)","content":{"application/json":{"schema":{"type":"object","properties":{"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["ErrorCode","Message"]}}}},"429":{"description":"The key's hourly or daily send limit (OneSend `key_rate_limited`), with `Retry-After`","content":{"application/json":{"schema":{"type":"object","properties":{"ErrorCode":{"type":"number"},"Message":{"type":"string"}},"required":["ErrorCode","Message"]}}}}}}},"/v1/deliverability":{"get":{"operationId":"getDeliverability","tags":["Deliverability"],"summary":"Deliverability overview","description":"Bounce, complaint and open rates for the last 7 and 30 days with the thresholds, the workspace guard, warm-up per sending domain, paused campaigns with reasons, contact quality and inactive counts, and the best time to send.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"rates":{"type":"object","properties":{"last7Days":{"type":"object","properties":{"sent":{"type":"number"},"delivered":{"type":"number"},"hardBounces":{"type":"number"},"complaints":{"type":"number"},"uniqueOpens":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"},"openRate":{"type":"number"}},"required":["sent","delivered","hardBounces","complaints","uniqueOpens","bounceRate","complaintRate","openRate"]},"last30Days":{"type":"object","properties":{"sent":{"type":"number"},"delivered":{"type":"number"},"hardBounces":{"type":"number"},"complaints":{"type":"number"},"uniqueOpens":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"},"openRate":{"type":"number"}},"required":["sent","delivered","hardBounces","complaints","uniqueOpens","bounceRate","complaintRate","openRate"]}},"required":["last7Days","last30Days"]},"settings":{"type":"object","properties":{"campaign":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number","description":"Pause a sending campaign when hard bounces / sent exceed this (0.025 = 2.5%). 0.005 to 0.1."},"complaintRate":{"type":"number","description":"Pause when spam complaints / delivered exceed this (0.0008 = 0.08%). 0.0002 to 0.005."},"minSample":{"type":"integer","description":"Emails sent before the rates are judged (50 to 10,000)."},"minSampleFraction":{"type":"number","description":"Or this share of the recipients when smaller (0.01 to 0.5; never fewer than 20 emails)."}},"required":["enabled","bounceRate","complaintRate","minSample","minSampleFraction"]},"workspace":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number","description":"Block new campaign sends when the hard bounce rate over the window exceeds this (0.01 to 0.2)."},"complaintRate":{"type":"number","description":"Block new campaign sends when the complaint rate over the window exceeds this (0.0005 to 0.02)."},"windowDays":{"type":"integer"},"minSample":{"type":"integer"}},"required":["enabled","bounceRate","complaintRate","windowDays","minSample"]},"warmup":{"type":"object","properties":{"enabled":{"type":"boolean"},"startPerDay":{"type":"integer"},"targetPerDay":{"type":"integer"},"days":{"type":"integer"}},"required":["enabled","startPerDay","targetPerDay","days"]},"pacing":{"type":"object","properties":{"enabled":{"type":"boolean"},"firstDayPerProvider":{"type":"integer"},"growth":{"type":"number"}},"required":["enabled","firstDayPerProvider","growth"]},"engagementOrdering":{"type":"boolean"},"quality":{"type":"object","properties":{"exclude":{"type":"array","items":{"type":"string","enum":["ok","invalid","typo","no_mx","disposable","role"]}}},"required":["exclude"]},"sunset":{"type":"object","properties":{"enabled":{"type":"boolean"},"rule":{"type":"string","enum":["campaigns","days"]},"campaigns":{"type":"integer"},"days":{"type":"integer"},"graceDays":{"type":"integer"},"templateId":{"type":["string","null"]},"fromEmail":{"type":["string","null"]},"fromName":{"type":["string","null"]},"subject":{"type":["string","null"]}},"required":["enabled","rule","campaigns","days","graceDays","templateId","fromEmail","fromName","subject"]},"includeSandbox":{"type":"boolean","description":"Apply warm-up and pacing when only the Sandbox provider sends, to preview them."},"routing":{"type":"object","properties":{"recipientAffinity":{"type":"string","enum":["auto","recipient","off"],"description":"Prefer the provider that last accepted email for the recipient. `auto`: per mailbox provider for Gmail, Microsoft and Yahoo addresses, per address otherwise."},"campaignAffinity":{"type":"boolean","description":"A campaign keeps sending through one provider while that provider can send."},"spilloverShare":{"type":"number","description":"When the campaign's provider cannot send, the share of the campaign that may move to other providers per hour (0.01 to 1; 1 = no cap). The rest waits."},"spilloverMinPerHour":{"type":"integer","description":"Emails per hour that may always move, however small the campaign (1 to 100,000)."}},"required":["recipientAffinity","campaignAffinity","spilloverShare","spilloverMinPerHour"]},"providerHealth":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number","description":"Take a provider out of rotation for campaigns when its hard bounce rate over 24 hours or 7 days exceeds this (0.04 = 4%)."},"complaintRate":{"type":"number","description":"Or its spam complaint rate exceeds this (0.001 = 0.1%)."},"minSample24h":{"type":"integer","description":"Emails sent in 24 hours before the 24-hour rates are judged."},"minSample7d":{"type":"integer","description":"Emails sent in 7 days before the 7-day rates are judged."},"severeFactor":{"type":"number","description":"Severe = this many times a threshold: the provider is also taken out of rotation for transactional email."},"transactional":{"type":"boolean","description":"Apply the severe rule to transactional email (a provider out of rotation is still used when no other provider can send)."},"cooldownHours":{"type":"integer","description":"Hours before a provider out of rotation is judged again, on email sent after it was taken out."}},"required":["enabled","bounceRate","complaintRate","minSample24h","minSample7d","severeFactor","transactional","cooldownHours"]},"softBounces":{"type":"object","properties":{"enabled":{"type":"boolean"},"count":{"type":"integer","description":"Soft bounces for one address within the window that suppress it for a while."},"windowDays":{"type":"integer"},"suppressDays":{"type":"integer","description":"Days the temporary suppression lasts."}},"required":["enabled","count","windowDays","suppressDays"]},"providerSync":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Import each provider's suppression list when connected and then periodically."},"intervalHours":{"type":"integer"},"push":{"type":"boolean","description":"Also add suppressions to providers that support it (off by default: the provider list may be shared with other apps)."}},"required":["enabled","intervalHours","push"]},"statusPolling":{"type":"object","properties":{"mode":{"type":"string","enum":["auto","always","off"],"description":"`auto`: ask the provider API for the delivery status of recent emails when no webhook arrived recently."},"quietHours":{"type":"integer","description":"Hours without a webhook after which `auto` starts polling a connection."},"maxAgeHours":{"type":"integer","description":"Emails older than this are not polled."}},"required":["mode","quietHours","maxAgeHours"]}},"required":["campaign","workspace","warmup","pacing","engagementOrdering","quality","sunset","includeSandbox","routing","providerHealth","softBounces","providerSync","statusPolling"]},"guard":{"type":"object","properties":{"blocked":{"type":"boolean","description":"New campaign sends are on hold until the workspace owner acknowledges."},"code":{"type":["string","null"]},"message":{"type":["string","null"]},"blockedAt":{"type":["string","null"]},"acknowledgedAt":{"type":["string","null"]},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"},"sample":{"type":"number"}},"required":["blocked","code","message","blockedAt","acknowledgedAt","bounceRate","complaintRate","sample"]},"warmup":{"type":"array","items":{"type":"object","properties":{"domain":{"type":"string"},"status":{"type":"string","enum":["new","warming","complete","off","established"]},"day":{"type":["number","null"],"description":"Warm-up day (1-based) while warming."},"days":{"type":"number"},"todayLimit":{"type":["number","null"],"description":"Most campaign emails from this domain today while warming; null when not limited."},"plannedToday":{"type":"number"},"startedAt":{"type":["string","null"]}},"required":["domain","status","day","days","todayLimit","plannedToday","startedAt"]}},"pausedCampaigns":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"pausedAt":{"type":["string","null"]},"reason":{"type":["object","null"],"properties":{"code":{"type":"string"},"auto":{"type":"boolean"},"message":{"type":"string"}},"required":["code","auto","message"]}},"required":["id","name","pausedAt","reason"]}},"contacts":{"type":"object","properties":{"quality":{"type":"object","additionalProperties":{"type":"number"},"description":"Contacts per quality value; `unchecked` for contacts not checked yet."},"inactive":{"type":"number"},"reengaging":{"type":"number"},"excludedByDefault":{"type":"number"}},"required":["quality","inactive","reengaging","excludedByDefault"]},"bestTime":{"type":"object","properties":{"hour":{"type":["number","null"],"description":"UTC hour with the most opens (null when there are not enough opens yet)."},"localHour":{"type":["number","null"],"description":"The same hour in the workspace time zone."},"timezone":{"type":"string"},"histogram":{"type":"array","items":{"type":"number"},"description":"Opens per UTC hour over the last 30 days."},"opens":{"type":"number"},"suggestion":{"type":["string","null"]}},"required":["hour","localHour","timezone","histogram","opens","suggestion"]}},"required":["rates","settings","guard","warmup","pausedCampaigns","contacts","bestTime"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/deliverability/alerts":{"get":{"operationId":"listDeliverabilityAlerts","tags":["Deliverability"],"summary":"Deliverability alerts for the dashboard","description":"Campaigns paused by a safeguard and whether new campaign sends are blocked.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"level":{"type":"string","enum":["warning","error"]},"code":{"type":"string"},"title":{"type":"string"},"message":{"type":"string"},"href":{"type":"string"}},"required":["level","code","title","message","href"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/deliverability/settings":{"get":{"operationId":"listDeliverabilitySettings","tags":["Deliverability"],"summary":"Deliverability settings","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"campaign":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number","description":"Pause a sending campaign when hard bounces / sent exceed this (0.025 = 2.5%). 0.005 to 0.1."},"complaintRate":{"type":"number","description":"Pause when spam complaints / delivered exceed this (0.0008 = 0.08%). 0.0002 to 0.005."},"minSample":{"type":"integer","description":"Emails sent before the rates are judged (50 to 10,000)."},"minSampleFraction":{"type":"number","description":"Or this share of the recipients when smaller (0.01 to 0.5; never fewer than 20 emails)."}},"required":["enabled","bounceRate","complaintRate","minSample","minSampleFraction"]},"workspace":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number","description":"Block new campaign sends when the hard bounce rate over the window exceeds this (0.01 to 0.2)."},"complaintRate":{"type":"number","description":"Block new campaign sends when the complaint rate over the window exceeds this (0.0005 to 0.02)."},"windowDays":{"type":"integer"},"minSample":{"type":"integer"}},"required":["enabled","bounceRate","complaintRate","windowDays","minSample"]},"warmup":{"type":"object","properties":{"enabled":{"type":"boolean"},"startPerDay":{"type":"integer"},"targetPerDay":{"type":"integer"},"days":{"type":"integer"}},"required":["enabled","startPerDay","targetPerDay","days"]},"pacing":{"type":"object","properties":{"enabled":{"type":"boolean"},"firstDayPerProvider":{"type":"integer"},"growth":{"type":"number"}},"required":["enabled","firstDayPerProvider","growth"]},"engagementOrdering":{"type":"boolean"},"quality":{"type":"object","properties":{"exclude":{"type":"array","items":{"type":"string","enum":["ok","invalid","typo","no_mx","disposable","role"]}}},"required":["exclude"]},"sunset":{"type":"object","properties":{"enabled":{"type":"boolean"},"rule":{"type":"string","enum":["campaigns","days"]},"campaigns":{"type":"integer"},"days":{"type":"integer"},"graceDays":{"type":"integer"},"templateId":{"type":["string","null"]},"fromEmail":{"type":["string","null"]},"fromName":{"type":["string","null"]},"subject":{"type":["string","null"]}},"required":["enabled","rule","campaigns","days","graceDays","templateId","fromEmail","fromName","subject"]},"includeSandbox":{"type":"boolean","description":"Apply warm-up and pacing when only the Sandbox provider sends, to preview them."},"routing":{"type":"object","properties":{"recipientAffinity":{"type":"string","enum":["auto","recipient","off"],"description":"Prefer the provider that last accepted email for the recipient. `auto`: per mailbox provider for Gmail, Microsoft and Yahoo addresses, per address otherwise."},"campaignAffinity":{"type":"boolean","description":"A campaign keeps sending through one provider while that provider can send."},"spilloverShare":{"type":"number","description":"When the campaign's provider cannot send, the share of the campaign that may move to other providers per hour (0.01 to 1; 1 = no cap). The rest waits."},"spilloverMinPerHour":{"type":"integer","description":"Emails per hour that may always move, however small the campaign (1 to 100,000)."}},"required":["recipientAffinity","campaignAffinity","spilloverShare","spilloverMinPerHour"]},"providerHealth":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number","description":"Take a provider out of rotation for campaigns when its hard bounce rate over 24 hours or 7 days exceeds this (0.04 = 4%)."},"complaintRate":{"type":"number","description":"Or its spam complaint rate exceeds this (0.001 = 0.1%)."},"minSample24h":{"type":"integer","description":"Emails sent in 24 hours before the 24-hour rates are judged."},"minSample7d":{"type":"integer","description":"Emails sent in 7 days before the 7-day rates are judged."},"severeFactor":{"type":"number","description":"Severe = this many times a threshold: the provider is also taken out of rotation for transactional email."},"transactional":{"type":"boolean","description":"Apply the severe rule to transactional email (a provider out of rotation is still used when no other provider can send)."},"cooldownHours":{"type":"integer","description":"Hours before a provider out of rotation is judged again, on email sent after it was taken out."}},"required":["enabled","bounceRate","complaintRate","minSample24h","minSample7d","severeFactor","transactional","cooldownHours"]},"softBounces":{"type":"object","properties":{"enabled":{"type":"boolean"},"count":{"type":"integer","description":"Soft bounces for one address within the window that suppress it for a while."},"windowDays":{"type":"integer"},"suppressDays":{"type":"integer","description":"Days the temporary suppression lasts."}},"required":["enabled","count","windowDays","suppressDays"]},"providerSync":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Import each provider's suppression list when connected and then periodically."},"intervalHours":{"type":"integer"},"push":{"type":"boolean","description":"Also add suppressions to providers that support it (off by default: the provider list may be shared with other apps)."}},"required":["enabled","intervalHours","push"]},"statusPolling":{"type":"object","properties":{"mode":{"type":"string","enum":["auto","always","off"],"description":"`auto`: ask the provider API for the delivery status of recent emails when no webhook arrived recently."},"quietHours":{"type":"integer","description":"Hours without a webhook after which `auto` starts polling a connection."},"maxAgeHours":{"type":"integer","description":"Emails older than this are not polled."}},"required":["mode","quietHours","maxAgeHours"]}},"required":["campaign","workspace","warmup","pacing","engagementOrdering","quality","sunset","includeSandbox","routing","providerHealth","softBounces","providerSync","statusPolling"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateDeliverabilitySetting","tags":["Deliverability"],"summary":"Change deliverability settings","description":"Only the fields you send change. Numbers outside their bounds are refused with 400 `invalid_settings` (see the settings schema for each range). Turning on sunsetting needs a re-engagement template and a sender address.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"campaign":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number","description":"Pause a sending campaign when hard bounces / sent exceed this (0.025 = 2.5%). 0.005 to 0.1."},"complaintRate":{"type":"number","description":"Pause when spam complaints / delivered exceed this (0.0008 = 0.08%). 0.0002 to 0.005."},"minSample":{"type":"integer","description":"Emails sent before the rates are judged (50 to 10,000)."},"minSampleFraction":{"type":"number","description":"Or this share of the recipients when smaller (0.01 to 0.5; never fewer than 20 emails)."}},"additionalProperties":false},"workspace":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number","description":"Block new campaign sends when the hard bounce rate over the window exceeds this (0.01 to 0.2)."},"complaintRate":{"type":"number","description":"Block new campaign sends when the complaint rate over the window exceeds this (0.0005 to 0.02)."},"windowDays":{"type":"integer"},"minSample":{"type":"integer"}},"additionalProperties":false},"warmup":{"type":"object","properties":{"enabled":{"type":"boolean"},"startPerDay":{"type":"integer"},"targetPerDay":{"type":"integer"},"days":{"type":"integer"}},"additionalProperties":false},"pacing":{"type":"object","properties":{"enabled":{"type":"boolean"},"firstDayPerProvider":{"type":"integer"},"growth":{"type":"number"}},"additionalProperties":false},"engagementOrdering":{"type":"boolean"},"quality":{"type":"object","properties":{"exclude":{"type":"array","items":{"type":"string","enum":["ok","invalid","typo","no_mx","disposable","role"]}}},"additionalProperties":false},"sunset":{"type":"object","properties":{"enabled":{"type":"boolean"},"rule":{"type":"string","enum":["campaigns","days"]},"campaigns":{"type":"integer"},"days":{"type":"integer"},"graceDays":{"type":"integer"},"templateId":{"type":["string","null"]},"fromEmail":{"type":["string","null"]},"fromName":{"type":["string","null"]},"subject":{"type":["string","null"]}},"additionalProperties":false},"includeSandbox":{"type":"boolean"},"routing":{"type":"object","properties":{"recipientAffinity":{"type":"string","enum":["auto","recipient","off"],"description":"Prefer the provider that last accepted email for the recipient. `auto`: per mailbox provider for Gmail, Microsoft and Yahoo addresses, per address otherwise."},"campaignAffinity":{"type":"boolean","description":"A campaign keeps sending through one provider while that provider can send."},"spilloverShare":{"type":"number","description":"When the campaign's provider cannot send, the share of the campaign that may move to other providers per hour (0.01 to 1; 1 = no cap). The rest waits."},"spilloverMinPerHour":{"type":"integer","description":"Emails per hour that may always move, however small the campaign (1 to 100,000)."}},"additionalProperties":false},"providerHealth":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number","description":"Take a provider out of rotation for campaigns when its hard bounce rate over 24 hours or 7 days exceeds this (0.04 = 4%)."},"complaintRate":{"type":"number","description":"Or its spam complaint rate exceeds this (0.001 = 0.1%)."},"minSample24h":{"type":"integer","description":"Emails sent in 24 hours before the 24-hour rates are judged."},"minSample7d":{"type":"integer","description":"Emails sent in 7 days before the 7-day rates are judged."},"severeFactor":{"type":"number","description":"Severe = this many times a threshold: the provider is also taken out of rotation for transactional email."},"transactional":{"type":"boolean","description":"Apply the severe rule to transactional email (a provider out of rotation is still used when no other provider can send)."},"cooldownHours":{"type":"integer","description":"Hours before a provider out of rotation is judged again, on email sent after it was taken out."}},"additionalProperties":false},"softBounces":{"type":"object","properties":{"enabled":{"type":"boolean"},"count":{"type":"integer","description":"Soft bounces for one address within the window that suppress it for a while."},"windowDays":{"type":"integer"},"suppressDays":{"type":"integer","description":"Days the temporary suppression lasts."}},"additionalProperties":false},"providerSync":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Import each provider's suppression list when connected and then periodically."},"intervalHours":{"type":"integer"},"push":{"type":"boolean","description":"Also add suppressions to providers that support it (off by default: the provider list may be shared with other apps)."}},"additionalProperties":false},"statusPolling":{"type":"object","properties":{"mode":{"type":"string","enum":["auto","always","off"],"description":"`auto`: ask the provider API for the delivery status of recent emails when no webhook arrived recently."},"quietHours":{"type":"integer","description":"Hours without a webhook after which `auto` starts polling a connection."},"maxAgeHours":{"type":"integer","description":"Emails older than this are not polled."}},"additionalProperties":false}},"additionalProperties":false,"example":{"campaign":{"bounceRate":0.02},"warmup":{"enabled":true,"startPerDay":100,"days":21}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"campaign":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number","description":"Pause a sending campaign when hard bounces / sent exceed this (0.025 = 2.5%). 0.005 to 0.1."},"complaintRate":{"type":"number","description":"Pause when spam complaints / delivered exceed this (0.0008 = 0.08%). 0.0002 to 0.005."},"minSample":{"type":"integer","description":"Emails sent before the rates are judged (50 to 10,000)."},"minSampleFraction":{"type":"number","description":"Or this share of the recipients when smaller (0.01 to 0.5; never fewer than 20 emails)."}},"required":["enabled","bounceRate","complaintRate","minSample","minSampleFraction"]},"workspace":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number","description":"Block new campaign sends when the hard bounce rate over the window exceeds this (0.01 to 0.2)."},"complaintRate":{"type":"number","description":"Block new campaign sends when the complaint rate over the window exceeds this (0.0005 to 0.02)."},"windowDays":{"type":"integer"},"minSample":{"type":"integer"}},"required":["enabled","bounceRate","complaintRate","windowDays","minSample"]},"warmup":{"type":"object","properties":{"enabled":{"type":"boolean"},"startPerDay":{"type":"integer"},"targetPerDay":{"type":"integer"},"days":{"type":"integer"}},"required":["enabled","startPerDay","targetPerDay","days"]},"pacing":{"type":"object","properties":{"enabled":{"type":"boolean"},"firstDayPerProvider":{"type":"integer"},"growth":{"type":"number"}},"required":["enabled","firstDayPerProvider","growth"]},"engagementOrdering":{"type":"boolean"},"quality":{"type":"object","properties":{"exclude":{"type":"array","items":{"type":"string","enum":["ok","invalid","typo","no_mx","disposable","role"]}}},"required":["exclude"]},"sunset":{"type":"object","properties":{"enabled":{"type":"boolean"},"rule":{"type":"string","enum":["campaigns","days"]},"campaigns":{"type":"integer"},"days":{"type":"integer"},"graceDays":{"type":"integer"},"templateId":{"type":["string","null"]},"fromEmail":{"type":["string","null"]},"fromName":{"type":["string","null"]},"subject":{"type":["string","null"]}},"required":["enabled","rule","campaigns","days","graceDays","templateId","fromEmail","fromName","subject"]},"includeSandbox":{"type":"boolean","description":"Apply warm-up and pacing when only the Sandbox provider sends, to preview them."},"routing":{"type":"object","properties":{"recipientAffinity":{"type":"string","enum":["auto","recipient","off"],"description":"Prefer the provider that last accepted email for the recipient. `auto`: per mailbox provider for Gmail, Microsoft and Yahoo addresses, per address otherwise."},"campaignAffinity":{"type":"boolean","description":"A campaign keeps sending through one provider while that provider can send."},"spilloverShare":{"type":"number","description":"When the campaign's provider cannot send, the share of the campaign that may move to other providers per hour (0.01 to 1; 1 = no cap). The rest waits."},"spilloverMinPerHour":{"type":"integer","description":"Emails per hour that may always move, however small the campaign (1 to 100,000)."}},"required":["recipientAffinity","campaignAffinity","spilloverShare","spilloverMinPerHour"]},"providerHealth":{"type":"object","properties":{"enabled":{"type":"boolean"},"bounceRate":{"type":"number","description":"Take a provider out of rotation for campaigns when its hard bounce rate over 24 hours or 7 days exceeds this (0.04 = 4%)."},"complaintRate":{"type":"number","description":"Or its spam complaint rate exceeds this (0.001 = 0.1%)."},"minSample24h":{"type":"integer","description":"Emails sent in 24 hours before the 24-hour rates are judged."},"minSample7d":{"type":"integer","description":"Emails sent in 7 days before the 7-day rates are judged."},"severeFactor":{"type":"number","description":"Severe = this many times a threshold: the provider is also taken out of rotation for transactional email."},"transactional":{"type":"boolean","description":"Apply the severe rule to transactional email (a provider out of rotation is still used when no other provider can send)."},"cooldownHours":{"type":"integer","description":"Hours before a provider out of rotation is judged again, on email sent after it was taken out."}},"required":["enabled","bounceRate","complaintRate","minSample24h","minSample7d","severeFactor","transactional","cooldownHours"]},"softBounces":{"type":"object","properties":{"enabled":{"type":"boolean"},"count":{"type":"integer","description":"Soft bounces for one address within the window that suppress it for a while."},"windowDays":{"type":"integer"},"suppressDays":{"type":"integer","description":"Days the temporary suppression lasts."}},"required":["enabled","count","windowDays","suppressDays"]},"providerSync":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Import each provider's suppression list when connected and then periodically."},"intervalHours":{"type":"integer"},"push":{"type":"boolean","description":"Also add suppressions to providers that support it (off by default: the provider list may be shared with other apps)."}},"required":["enabled","intervalHours","push"]},"statusPolling":{"type":"object","properties":{"mode":{"type":"string","enum":["auto","always","off"],"description":"`auto`: ask the provider API for the delivery status of recent emails when no webhook arrived recently."},"quietHours":{"type":"integer","description":"Hours without a webhook after which `auto` starts polling a connection."},"maxAgeHours":{"type":"integer","description":"Emails older than this are not polled."}},"required":["mode","quietHours","maxAgeHours"]}},"required":["campaign","workspace","warmup","pacing","engagementOrdering","quality","sunset","includeSandbox","routing","providerHealth","softBounces","providerSync","statusPolling"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/deliverability/guard":{"get":{"operationId":"getDeliverabilityGuard","tags":["Deliverability"],"summary":"Workspace guard","description":"Whether new campaign sends are blocked because the bounce or complaint rate of the last 7 days is too high. Transactional email is never blocked.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"blocked":{"type":"boolean","description":"New campaign sends are on hold until the workspace owner acknowledges."},"code":{"type":["string","null"]},"message":{"type":["string","null"]},"blockedAt":{"type":["string","null"]},"acknowledgedAt":{"type":["string","null"]},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"},"sample":{"type":"number"}},"required":["blocked","code","message","blockedAt","acknowledgedAt","bounceRate","complaintRate","sample"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/deliverability/acknowledge":{"post":{"operationId":"acknowledgeDeliverability","tags":["Deliverability"],"summary":"Acknowledge the workspace guard","description":"The workspace owner or an admin confirms they reviewed the bounce or complaint problem. New campaigns can be sent again; the guard then judges only email sent after this moment. Needs a signed-in owner or admin.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"blocked":{"type":"boolean","description":"New campaign sends are on hold until the workspace owner acknowledges."},"code":{"type":["string","null"]},"message":{"type":["string","null"]},"blockedAt":{"type":["string","null"]},"acknowledgedAt":{"type":["string","null"]},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"},"sample":{"type":"number"}},"required":["blocked","code","message","blockedAt","acknowledgedAt","bounceRate","complaintRate","sample"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/deliverability/warmup":{"get":{"operationId":"getDeliverabilityWarmup","tags":["Deliverability"],"summary":"Warm-up per sending domain","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"domain":{"type":"string"},"status":{"type":"string","enum":["new","warming","complete","off","established"]},"day":{"type":["number","null"],"description":"Warm-up day (1-based) while warming."},"days":{"type":"number"},"todayLimit":{"type":["number","null"],"description":"Most campaign emails from this domain today while warming; null when not limited."},"plannedToday":{"type":"number"},"startedAt":{"type":["string","null"]}},"required":["domain","status","day","days","todayLimit","plannedToday","startedAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/deliverability/warmup/{domain}":{"patch":{"operationId":"updateDeliverabilityWarmup","tags":["Deliverability"],"summary":"Change the warm-up of a sending domain","description":"`warming` starts (or with `restart: true` restarts) the ramp today, `off` turns warm-up off for the domain, `established` marks it as already having a sending reputation.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"domain","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["warming","off","established"]},"restart":{"type":"boolean"}},"required":["status"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"domain":{"type":"string"},"status":{"type":"string","enum":["new","warming","complete","off","established"]},"day":{"type":["number","null"],"description":"Warm-up day (1-based) while warming."},"days":{"type":"number"},"todayLimit":{"type":["number","null"],"description":"Most campaign emails from this domain today while warming; null when not limited."},"plannedToday":{"type":"number"},"startedAt":{"type":["string","null"]}},"required":["domain","status","day","days","todayLimit","plannedToday","startedAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/deliverability/best-time":{"get":{"operationId":"getDeliverabilityBestTime","tags":["Deliverability"],"summary":"Best time to send","description":"Opens per UTC hour over the last 30 days and the hour with the most opens, in UTC and in the workspace time zone.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"hour":{"type":["number","null"],"description":"UTC hour with the most opens (null when there are not enough opens yet)."},"localHour":{"type":["number","null"],"description":"The same hour in the workspace time zone."},"timezone":{"type":"string"},"histogram":{"type":"array","items":{"type":"number"},"description":"Opens per UTC hour over the last 30 days."},"opens":{"type":"number"},"suggestion":{"type":["string","null"]}},"required":["hour","localHour","timezone","histogram","opens","suggestion"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/deliverability/quality/check":{"post":{"operationId":"checkDeliverabilityQuality","tags":["Deliverability"],"summary":"Check address quality","description":"Syntax, mistyped domains (with a suggestion), domains without a mail server (MX or A record, cached), temporary-address domains and role addresses, for up to 1,000 addresses. Nothing is stored. `dns: false` skips the mail server lookup.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"emails":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":1000},"dns":{"type":"boolean"}},"required":["emails"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"input":{"type":"string"},"email":{"type":["string","null"]},"domain":{"type":["string","null"]},"quality":{"type":"string","enum":["ok","invalid","typo","no_mx","disposable","role"]},"flags":{"type":"array","items":{"type":"string","enum":["ok","invalid","typo","no_mx","disposable","role"]}},"suggestion":{"type":["string","null"]},"mx":{"type":"string","enum":["found","implicit","missing","unknown","skipped"]},"reason":{"type":["string","null"]},"excludedByDefault":{"type":"boolean"}},"required":["input","email","domain","quality","flags","suggestion","mx","reason","excludedByDefault"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/deliverability/quality/recheck":{"post":{"operationId":"recheckDeliverabilityQuality","tags":["Deliverability"],"summary":"Re-check the address quality of every contact","description":"Clears the stored results; the background check runs again (mail server lookups are cached for 7 days). Up to 500 contacts are checked right away.","security":[{"bearer":[]}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"queued":{"type":"number"},"checked":{"type":"number"}},"required":["queued","checked"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/deliverability/inactive/restore":{"post":{"operationId":"restoreDeliverabilityInactive","tags":["Deliverability"],"summary":"Restore inactive contacts","description":"Sets inactive contacts back to subscribed and resets their sunsetting state. Send `ids`, or `all: true`.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string"},"maxItems":10000},"all":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"restored":{"type":"number"}},"required":["restored"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/deliverability/sunset/run":{"post":{"operationId":"runDeliverabilitySunset","tags":["Deliverability"],"summary":"Run sunsetting now","description":"Sends due re-engagement emails and marks contacts inactive whose grace period ended. Runs automatically every few minutes while sunsetting is on.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"reengaged":{"type":"number"},"deactivated":{"type":"number"},"skipped":{"type":["string","null"]}},"required":["reengaged","deactivated","skipped"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/campaigns/{id}/safeguards":{"get":{"operationId":"listCampaignSafeguards","tags":["Campaigns"],"summary":"Safeguards that apply to a campaign","description":"For the review step: the automatic pause thresholds, warm-up and pacing of the sending domain and the combined sending plan, contacts left out for address problems or inactivity, the workspace guard and the best time to send.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"title":{"type":"string"},"detail":{"type":"string"},"level":{"type":"string","enum":["info","warning","blocking"]}},"required":["code","title","detail","level"]}},"plan":{"type":["object","null"],"properties":{"perDay":{"type":"number"},"days":{"type":"number"},"unlimited":{"type":"boolean"},"limitedBy":{"type":"string"},"reason":{"type":"string"}},"required":["perDay","days"]},"excluded":{"type":"object","properties":{"quality":{"type":"number"},"inactive":{"type":"number"}},"required":["quality","inactive"]},"guard":{"type":"object","properties":{"blocked":{"type":"boolean","description":"New campaign sends are on hold until the workspace owner acknowledges."},"code":{"type":["string","null"]},"message":{"type":["string","null"]},"blockedAt":{"type":["string","null"]},"acknowledgedAt":{"type":["string","null"]},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"},"sample":{"type":"number"}},"required":["blocked","code","message","blockedAt","acknowledgedAt","bounceRate","complaintRate","sample"]},"bestTime":{"type":"object","properties":{"hour":{"type":["number","null"],"description":"UTC hour with the most opens (null when there are not enough opens yet)."},"localHour":{"type":["number","null"],"description":"The same hour in the workspace time zone."},"timezone":{"type":"string"},"histogram":{"type":"array","items":{"type":"number"},"description":"Opens per UTC hour over the last 30 days."},"opens":{"type":"number"},"suggestion":{"type":["string","null"]}},"required":["hour","localHour","timezone","histogram","opens","suggestion"]}},"required":["items","plan","excluded","guard","bestTime"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations":{"get":{"operationId":"listAutomations","tags":["Automations"],"summary":"List automations","description":"Newest first, with run counts (entered, in progress, completed, exited).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Comma-separated: draft, active, paused, stopped."},"required":false,"description":"Comma-separated: draft, active, paused, stopped.","name":"status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation"]},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","active","paused","stopped"]},"trigger":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["list_added"]},"listId":{"type":"string"},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","listId"],"description":"A contact is added to the list (API, dashboard, import, form or another automation)."},{"type":"object","properties":{"type":{"type":"string","enum":["form_confirmed"]},"formId":{"type":["string","null"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"A double opt-in confirmation, or a single opt-in signup, on the form (any form when omitted)."},{"type":"object","properties":{"type":{"type":"string","enum":["attribute_changed"]},"key":{"type":"string"},"value":{"description":"Only when the attribute changes to this value."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","key"]},{"type":"object","properties":{"type":{"type":"string","enum":["event"]},"name":{"type":"string","description":"Event name sent to POST /v1/events/track."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","name"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"attribute":{"type":"string","description":"A date attribute, for example renewal_date or birthday."},"offsetDays":{"type":"integer","minimum":-365,"maximum":365,"description":"Days after the date; negative for before. Default 0."},"repeat":{"type":"string","enum":["yearly","once"],"description":"`yearly` (default): every year on the date. `once`: on the date itself."},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"When to start, HH:MM in the workspace time zone. Default 09:00."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","attribute"]},{"type":"object","properties":{"type":{"type":"string","enum":["campaign_engagement"]},"campaignId":{"type":"string"},"action":{"type":"string","enum":["opened","clicked"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","campaignId","action"]},{"type":"object","properties":{"type":{"type":"string","enum":["conversion"]},"goal":{"type":["string","null"],"description":"Only conversions with this goal, for example purchase."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["manual"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"Only through POST /v1/automations/{id}/enroll or the dashboard."}]},"steps":{"type":"array","items":{"type":"object","additionalProperties":{}}},"settings":{"type":"object","additionalProperties":{}},"goals":{"type":"array","items":{"type":"object","additionalProperties":{}}},"version":{"type":"number","description":"Latest published version; 0 for a draft that was never activated."},"stats":{"type":["object","null"],"properties":{"entered":{"type":"number"},"active":{"type":"number"},"completed":{"type":"number"},"exited":{"type":"number"},"failed":{"type":"number"}},"required":["entered","active","completed","exited","failed"]},"activatedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"webhookDisabledReason":{"type":["string","null"],"description":"OneSend turned this automation's webhook steps off (`key_revoked`, `key_leaked`): the API key that created the automation or added its webhook step was revoked or reported as leaked. The steps are skipped; the rest runs. An admin saving the steps again (PATCH with `steps`) turns them back on."}},"required":["id","object","name","description","status","trigger","steps","settings","goals","version","stats","activatedAt","createdAt","updatedAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createAutomation","tags":["Automations"],"summary":"Create an automation","description":"Created as a draft. Activate it with `POST /v1/automations/{id}/activate`. A `webhook` step (it sends contact data to a URL) needs a signed-in admin or a live `admin` key (403 otherwise), and the workspace owners get a security alert.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":["string","null"],"maxLength":1000},"recipe":{"type":"string","description":"Create from a starter recipe (GET /v1/automations/recipes). Fields you send override the recipe."},"trigger":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["list_added"]},"listId":{"type":"string"},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","listId"],"description":"A contact is added to the list (API, dashboard, import, form or another automation)."},{"type":"object","properties":{"type":{"type":"string","enum":["form_confirmed"]},"formId":{"type":["string","null"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"A double opt-in confirmation, or a single opt-in signup, on the form (any form when omitted)."},{"type":"object","properties":{"type":{"type":"string","enum":["attribute_changed"]},"key":{"type":"string"},"value":{"description":"Only when the attribute changes to this value."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","key"]},{"type":"object","properties":{"type":{"type":"string","enum":["event"]},"name":{"type":"string","description":"Event name sent to POST /v1/events/track."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","name"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"attribute":{"type":"string","description":"A date attribute, for example renewal_date or birthday."},"offsetDays":{"type":"integer","minimum":-365,"maximum":365,"description":"Days after the date; negative for before. Default 0."},"repeat":{"type":"string","enum":["yearly","once"],"description":"`yearly` (default): every year on the date. `once`: on the date itself."},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"When to start, HH:MM in the workspace time zone. Default 09:00."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","attribute"]},{"type":"object","properties":{"type":{"type":"string","enum":["campaign_engagement"]},"campaignId":{"type":"string"},"action":{"type":"string","enum":["opened","clicked"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","campaignId","action"]},{"type":"object","properties":{"type":{"type":"string","enum":["conversion"]},"goal":{"type":["string","null"],"description":"Only conversions with this goal, for example purchase."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["manual"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"Only through POST /v1/automations/{id}/enroll or the dashboard."}]},"steps":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["send_email"]},"templateId":{"type":["string","null"]},"subject":{"type":["string","null"],"description":"Required without a template. `{{variables}}` work, including `{{event.x}}`."},"previewText":{"type":["string","null"]},"html":{"type":["string","null"]},"fromName":{"type":["string","null"]},"fromEmail":{"type":"string"},"replyTo":{"type":["string","null"]},"variables":{"type":["object","null"],"additionalProperties":{"type":"string"},"description":"Extra template variables. Values can use {{contact.x}}, {{event.x}} and {{trigger.x}}."},"tracking":{"type":["object","null"],"properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"}}},"quietHours":{"type":"boolean","description":"Respect the automation's quiet hours (default true)."}},"required":["type","fromEmail"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["wait"]},"duration":{"type":["object","null"],"properties":{"amount":{"type":"number","exclusiveMinimum":0},"unit":{"type":"string","enum":["minutes","hours","days","weeks"]}},"required":["amount","unit"]},"until":{"type":["object","null"],"properties":{"time":{"type":["string","null"],"pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Local time HH:MM in the workspace time zone."},"weekdays":{"type":["array","null"],"items":{"type":"integer","minimum":1,"maximum":7},"description":"1 = Monday … 7 = Sunday"}}}},"required":["type"],"description":"Waits `duration`, then (with `until`) until the next allowed time of day and weekday."},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["wait_until_event"]},"event":{"type":"string"},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"timeout":{"type":"object","properties":{"amount":{"type":"number","exclusiveMinimum":0},"unit":{"type":"string","enum":["minutes","hours","days","weeks"]}},"required":["amount","unit"]},"matched":{"type":"array","items":{"type":"object","additionalProperties":{}},"description":"Steps of this branch (the same step shapes)."},"timedOut":{"type":"array","items":{"type":"object","additionalProperties":{}},"description":"Steps of this branch (the same step shapes)."}},"required":["type","event","timeout","matched","timedOut"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["condition"]},"match":{"type":"string","enum":["all","any"],"default":"all"},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]}},"yes":{"type":"array","items":{"type":"object","additionalProperties":{}},"description":"Steps of this branch (the same step shapes)."},"no":{"type":"array","items":{"type":"object","additionalProperties":{}},"description":"Steps of this branch (the same step shapes)."}},"required":["type","conditions","yes","no"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["update_attribute"]},"key":{"type":"string"},"value":{"description":"null removes the attribute. Text can use {{variables}}."}},"required":["type","key"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["add_to_list"]},"listId":{"type":"string"}},"required":["type","listId"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["remove_from_list"]},"listId":{"type":"string"}},"required":["type","listId"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["webhook"]},"url":{"type":"string","format":"uri"},"payload":{"type":["object","null"],"additionalProperties":{},"description":"Sent as `data.payload`; text values can use {{variables}}."}},"required":["type","url"],"description":"POSTs JSON signed like outgoing webhooks (x-onesend-signature with the automation signing secret). Retried twice; delivered at least once, with x-onesend-delivery for de-duplication."},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["ab_split"]},"branches":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":["string","null"]},"percent":{"type":"number","exclusiveMinimum":0},"steps":{"type":"array","items":{"type":"object","additionalProperties":{}},"description":"Steps of this branch (the same step shapes)."}},"required":["key","percent","steps"]},"minItems":2,"maxItems":4}},"required":["type","branches"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["exit"]}},"required":["type"]}]},"maxItems":200},"settings":{"type":"object","properties":{"reentry":{"type":"object","properties":{"mode":{"type":"string","enum":["never","after","always"]},"days":{"type":["integer","null"],"exclusiveMinimum":0}},"required":["mode"],"description":"`never`: once per contact. `after`: again `days` after the last entry. `always`: whenever the contact has no run in progress."},"maxActiveRuns":{"type":["integer","null"],"exclusiveMinimum":0},"frequencyCap":{"type":["object","null"],"properties":{"emails":{"type":"integer","exclusiveMinimum":0},"hours":{"type":"number","exclusiveMinimum":0}},"required":["emails","hours"],"description":"At most `emails` automation emails per contact in `hours`, across every automation. Later emails wait."},"quietHours":{"type":["object","null"],"properties":{"start":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Local time HH:MM in the workspace time zone."},"end":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Local time HH:MM in the workspace time zone."}},"required":["start","end"]},"testMode":{"type":"boolean","description":"Emails are logged but not delivered."},"exitOnUnsubscribe":{"type":"boolean"},"exitConditions":{"type":["array","null"],"items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]}},"includeInactive":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"migrateRuns":{"type":"string","enum":["safe","none"]}}},"goals":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["conversion"]},"goal":{"type":["string","null"]},"exit":{"type":"boolean"}},"required":["kind"]},{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"exit":{"type":"boolean"}},"required":["kind","name"]},{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["segment"]},"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]}},"exit":{"type":"boolean"}},"required":["kind","match","conditions"]}]},"maxItems":10}},"required":["name"],"example":{"name":"Welcome series","trigger":{"type":"list_added","listId":"lst_…"},"steps":[{"type":"send_email","fromEmail":"hello@acme.dev","subject":"Welcome, {{first_name}}","html":"<p>Hi</p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a>"},{"type":"wait","duration":{"amount":2,"unit":"days"}}]}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation"]},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","active","paused","stopped"]},"trigger":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["list_added"]},"listId":{"type":"string"},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","listId"],"description":"A contact is added to the list (API, dashboard, import, form or another automation)."},{"type":"object","properties":{"type":{"type":"string","enum":["form_confirmed"]},"formId":{"type":["string","null"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"A double opt-in confirmation, or a single opt-in signup, on the form (any form when omitted)."},{"type":"object","properties":{"type":{"type":"string","enum":["attribute_changed"]},"key":{"type":"string"},"value":{"description":"Only when the attribute changes to this value."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","key"]},{"type":"object","properties":{"type":{"type":"string","enum":["event"]},"name":{"type":"string","description":"Event name sent to POST /v1/events/track."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","name"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"attribute":{"type":"string","description":"A date attribute, for example renewal_date or birthday."},"offsetDays":{"type":"integer","minimum":-365,"maximum":365,"description":"Days after the date; negative for before. Default 0."},"repeat":{"type":"string","enum":["yearly","once"],"description":"`yearly` (default): every year on the date. `once`: on the date itself."},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"When to start, HH:MM in the workspace time zone. Default 09:00."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","attribute"]},{"type":"object","properties":{"type":{"type":"string","enum":["campaign_engagement"]},"campaignId":{"type":"string"},"action":{"type":"string","enum":["opened","clicked"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","campaignId","action"]},{"type":"object","properties":{"type":{"type":"string","enum":["conversion"]},"goal":{"type":["string","null"],"description":"Only conversions with this goal, for example purchase."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["manual"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"Only through POST /v1/automations/{id}/enroll or the dashboard."}]},"steps":{"type":"array","items":{"type":"object","additionalProperties":{}}},"settings":{"type":"object","additionalProperties":{}},"goals":{"type":"array","items":{"type":"object","additionalProperties":{}}},"version":{"type":"number","description":"Latest published version; 0 for a draft that was never activated."},"stats":{"type":["object","null"],"properties":{"entered":{"type":"number"},"active":{"type":"number"},"completed":{"type":"number"},"exited":{"type":"number"},"failed":{"type":"number"}},"required":["entered","active","completed","exited","failed"]},"activatedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"webhookDisabledReason":{"type":["string","null"],"description":"OneSend turned this automation's webhook steps off (`key_revoked`, `key_leaked`): the API key that created the automation or added its webhook step was revoked or reported as leaked. The steps are skipped; the rest runs. An admin saving the steps again (PATCH with `steps`) turns them back on."}},"required":["id","object","name","description","status","trigger","steps","settings","goals","version","stats","activatedAt","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/recipes":{"get":{"operationId":"listAutomationRecipes","tags":["Automations"],"summary":"Automation recipes","description":"Complete automations to start from: welcome series, double opt-in follow-up, abandoned cart, win-back, renewal reminder and post-purchase review request. Create one with `POST /v1/automations` and `recipe`.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"definition":{"type":"object","additionalProperties":{}}},"required":["id","name","description","definition"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}":{"get":{"operationId":"getAutomation","tags":["Automations"],"summary":"Get an automation","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation"]},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","active","paused","stopped"]},"trigger":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["list_added"]},"listId":{"type":"string"},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","listId"],"description":"A contact is added to the list (API, dashboard, import, form or another automation)."},{"type":"object","properties":{"type":{"type":"string","enum":["form_confirmed"]},"formId":{"type":["string","null"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"A double opt-in confirmation, or a single opt-in signup, on the form (any form when omitted)."},{"type":"object","properties":{"type":{"type":"string","enum":["attribute_changed"]},"key":{"type":"string"},"value":{"description":"Only when the attribute changes to this value."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","key"]},{"type":"object","properties":{"type":{"type":"string","enum":["event"]},"name":{"type":"string","description":"Event name sent to POST /v1/events/track."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","name"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"attribute":{"type":"string","description":"A date attribute, for example renewal_date or birthday."},"offsetDays":{"type":"integer","minimum":-365,"maximum":365,"description":"Days after the date; negative for before. Default 0."},"repeat":{"type":"string","enum":["yearly","once"],"description":"`yearly` (default): every year on the date. `once`: on the date itself."},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"When to start, HH:MM in the workspace time zone. Default 09:00."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","attribute"]},{"type":"object","properties":{"type":{"type":"string","enum":["campaign_engagement"]},"campaignId":{"type":"string"},"action":{"type":"string","enum":["opened","clicked"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","campaignId","action"]},{"type":"object","properties":{"type":{"type":"string","enum":["conversion"]},"goal":{"type":["string","null"],"description":"Only conversions with this goal, for example purchase."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["manual"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"Only through POST /v1/automations/{id}/enroll or the dashboard."}]},"steps":{"type":"array","items":{"type":"object","additionalProperties":{}}},"settings":{"type":"object","additionalProperties":{}},"goals":{"type":"array","items":{"type":"object","additionalProperties":{}}},"version":{"type":"number","description":"Latest published version; 0 for a draft that was never activated."},"stats":{"type":["object","null"],"properties":{"entered":{"type":"number"},"active":{"type":"number"},"completed":{"type":"number"},"exited":{"type":"number"},"failed":{"type":"number"}},"required":["entered","active","completed","exited","failed"]},"activatedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"webhookDisabledReason":{"type":["string","null"],"description":"OneSend turned this automation's webhook steps off (`key_revoked`, `key_leaked`): the API key that created the automation or added its webhook step was revoked or reported as leaked. The steps are skipped; the rest runs. An admin saving the steps again (PATCH with `steps`) turns them back on."}},"required":["id","object","name","description","status","trigger","steps","settings","goals","version","stats","activatedAt","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"patch":{"operationId":"updateAutomation","tags":["Automations"],"summary":"Edit an automation","description":"A draft is edited in place. Changing the trigger, steps, settings or goals of an active or paused automation publishes a new version: new entries use it, and runs in progress move to it when their current step still exists with the same type (unless `settings.migrateRuns` is `none`). The new definition must be valid (400 `automation_invalid`).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":["string","null"],"maxLength":1000},"trigger":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["list_added"]},"listId":{"type":"string"},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","listId"],"description":"A contact is added to the list (API, dashboard, import, form or another automation)."},{"type":"object","properties":{"type":{"type":"string","enum":["form_confirmed"]},"formId":{"type":["string","null"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"A double opt-in confirmation, or a single opt-in signup, on the form (any form when omitted)."},{"type":"object","properties":{"type":{"type":"string","enum":["attribute_changed"]},"key":{"type":"string"},"value":{"description":"Only when the attribute changes to this value."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","key"]},{"type":"object","properties":{"type":{"type":"string","enum":["event"]},"name":{"type":"string","description":"Event name sent to POST /v1/events/track."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","name"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"attribute":{"type":"string","description":"A date attribute, for example renewal_date or birthday."},"offsetDays":{"type":"integer","minimum":-365,"maximum":365,"description":"Days after the date; negative for before. Default 0."},"repeat":{"type":"string","enum":["yearly","once"],"description":"`yearly` (default): every year on the date. `once`: on the date itself."},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"When to start, HH:MM in the workspace time zone. Default 09:00."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","attribute"]},{"type":"object","properties":{"type":{"type":"string","enum":["campaign_engagement"]},"campaignId":{"type":"string"},"action":{"type":"string","enum":["opened","clicked"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","campaignId","action"]},{"type":"object","properties":{"type":{"type":"string","enum":["conversion"]},"goal":{"type":["string","null"],"description":"Only conversions with this goal, for example purchase."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["manual"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"Only through POST /v1/automations/{id}/enroll or the dashboard."}]},"steps":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["send_email"]},"templateId":{"type":["string","null"]},"subject":{"type":["string","null"],"description":"Required without a template. `{{variables}}` work, including `{{event.x}}`."},"previewText":{"type":["string","null"]},"html":{"type":["string","null"]},"fromName":{"type":["string","null"]},"fromEmail":{"type":"string"},"replyTo":{"type":["string","null"]},"variables":{"type":["object","null"],"additionalProperties":{"type":"string"},"description":"Extra template variables. Values can use {{contact.x}}, {{event.x}} and {{trigger.x}}."},"tracking":{"type":["object","null"],"properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"}}},"quietHours":{"type":"boolean","description":"Respect the automation's quiet hours (default true)."}},"required":["type","fromEmail"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["wait"]},"duration":{"type":["object","null"],"properties":{"amount":{"type":"number","exclusiveMinimum":0},"unit":{"type":"string","enum":["minutes","hours","days","weeks"]}},"required":["amount","unit"]},"until":{"type":["object","null"],"properties":{"time":{"type":["string","null"],"pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Local time HH:MM in the workspace time zone."},"weekdays":{"type":["array","null"],"items":{"type":"integer","minimum":1,"maximum":7},"description":"1 = Monday … 7 = Sunday"}}}},"required":["type"],"description":"Waits `duration`, then (with `until`) until the next allowed time of day and weekday."},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["wait_until_event"]},"event":{"type":"string"},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"timeout":{"type":"object","properties":{"amount":{"type":"number","exclusiveMinimum":0},"unit":{"type":"string","enum":["minutes","hours","days","weeks"]}},"required":["amount","unit"]},"matched":{"type":"array","items":{"type":"object","additionalProperties":{}},"description":"Steps of this branch (the same step shapes)."},"timedOut":{"type":"array","items":{"type":"object","additionalProperties":{}},"description":"Steps of this branch (the same step shapes)."}},"required":["type","event","timeout","matched","timedOut"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["condition"]},"match":{"type":"string","enum":["all","any"],"default":"all"},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]}},"yes":{"type":"array","items":{"type":"object","additionalProperties":{}},"description":"Steps of this branch (the same step shapes)."},"no":{"type":"array","items":{"type":"object","additionalProperties":{}},"description":"Steps of this branch (the same step shapes)."}},"required":["type","conditions","yes","no"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["update_attribute"]},"key":{"type":"string"},"value":{"description":"null removes the attribute. Text can use {{variables}}."}},"required":["type","key"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["add_to_list"]},"listId":{"type":"string"}},"required":["type","listId"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["remove_from_list"]},"listId":{"type":"string"}},"required":["type","listId"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["webhook"]},"url":{"type":"string","format":"uri"},"payload":{"type":["object","null"],"additionalProperties":{},"description":"Sent as `data.payload`; text values can use {{variables}}."}},"required":["type","url"],"description":"POSTs JSON signed like outgoing webhooks (x-onesend-signature with the automation signing secret). Retried twice; delivered at least once, with x-onesend-delivery for de-duplication."},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["ab_split"]},"branches":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":["string","null"]},"percent":{"type":"number","exclusiveMinimum":0},"steps":{"type":"array","items":{"type":"object","additionalProperties":{}},"description":"Steps of this branch (the same step shapes)."}},"required":["key","percent","steps"]},"minItems":2,"maxItems":4}},"required":["type","branches"]},{"type":"object","properties":{"id":{"type":"string","description":"Stable step id; generated when omitted. Reports and email conditions refer to it."},"name":{"type":["string","null"]},"type":{"type":"string","enum":["exit"]}},"required":["type"]}]},"maxItems":200},"settings":{"type":"object","properties":{"reentry":{"type":"object","properties":{"mode":{"type":"string","enum":["never","after","always"]},"days":{"type":["integer","null"],"exclusiveMinimum":0}},"required":["mode"],"description":"`never`: once per contact. `after`: again `days` after the last entry. `always`: whenever the contact has no run in progress."},"maxActiveRuns":{"type":["integer","null"],"exclusiveMinimum":0},"frequencyCap":{"type":["object","null"],"properties":{"emails":{"type":"integer","exclusiveMinimum":0},"hours":{"type":"number","exclusiveMinimum":0}},"required":["emails","hours"],"description":"At most `emails` automation emails per contact in `hours`, across every automation. Later emails wait."},"quietHours":{"type":["object","null"],"properties":{"start":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Local time HH:MM in the workspace time zone."},"end":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"Local time HH:MM in the workspace time zone."}},"required":["start","end"]},"testMode":{"type":"boolean","description":"Emails are logged but not delivered."},"exitOnUnsubscribe":{"type":"boolean"},"exitConditions":{"type":["array","null"],"items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]}},"includeInactive":{"type":"boolean"},"includeQualityIssues":{"type":"boolean"},"migrateRuns":{"type":"string","enum":["safe","none"]}}},"goals":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["conversion"]},"goal":{"type":["string","null"]},"exit":{"type":"boolean"}},"required":["kind"]},{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"exit":{"type":"boolean"}},"required":["kind","name"]},{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["segment"]},"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]}},"exit":{"type":"boolean"}},"required":["kind","match","conditions"]}]},"maxItems":10}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation"]},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","active","paused","stopped"]},"trigger":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["list_added"]},"listId":{"type":"string"},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","listId"],"description":"A contact is added to the list (API, dashboard, import, form or another automation)."},{"type":"object","properties":{"type":{"type":"string","enum":["form_confirmed"]},"formId":{"type":["string","null"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"A double opt-in confirmation, or a single opt-in signup, on the form (any form when omitted)."},{"type":"object","properties":{"type":{"type":"string","enum":["attribute_changed"]},"key":{"type":"string"},"value":{"description":"Only when the attribute changes to this value."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","key"]},{"type":"object","properties":{"type":{"type":"string","enum":["event"]},"name":{"type":"string","description":"Event name sent to POST /v1/events/track."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","name"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"attribute":{"type":"string","description":"A date attribute, for example renewal_date or birthday."},"offsetDays":{"type":"integer","minimum":-365,"maximum":365,"description":"Days after the date; negative for before. Default 0."},"repeat":{"type":"string","enum":["yearly","once"],"description":"`yearly` (default): every year on the date. `once`: on the date itself."},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"When to start, HH:MM in the workspace time zone. Default 09:00."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","attribute"]},{"type":"object","properties":{"type":{"type":"string","enum":["campaign_engagement"]},"campaignId":{"type":"string"},"action":{"type":"string","enum":["opened","clicked"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","campaignId","action"]},{"type":"object","properties":{"type":{"type":"string","enum":["conversion"]},"goal":{"type":["string","null"],"description":"Only conversions with this goal, for example purchase."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["manual"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"Only through POST /v1/automations/{id}/enroll or the dashboard."}]},"steps":{"type":"array","items":{"type":"object","additionalProperties":{}}},"settings":{"type":"object","additionalProperties":{}},"goals":{"type":"array","items":{"type":"object","additionalProperties":{}}},"version":{"type":"number","description":"Latest published version; 0 for a draft that was never activated."},"stats":{"type":["object","null"],"properties":{"entered":{"type":"number"},"active":{"type":"number"},"completed":{"type":"number"},"exited":{"type":"number"},"failed":{"type":"number"}},"required":["entered","active","completed","exited","failed"]},"activatedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"webhookDisabledReason":{"type":["string","null"],"description":"OneSend turned this automation's webhook steps off (`key_revoked`, `key_leaked`): the API key that created the automation or added its webhook step was revoked or reported as leaked. The steps are skipped; the rest runs. An admin saving the steps again (PATCH with `steps`) turns them back on."}},"required":["id","object","name","description","status","trigger","steps","settings","goals","version","stats","activatedAt","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteAutomation","tags":["Automations"],"summary":"Delete an automation","description":"Pause or stop an active automation first. Runs and step history are deleted; emails it sent stay in the email logs.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/validate":{"post":{"operationId":"validateAutomation","tags":["Automations"],"summary":"Check an automation","description":"Every problem that would stop activation, with the step it belongs to.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"valid":{"type":"boolean"},"problems":{"type":"array","items":{"type":"object","properties":{"stepId":{"type":["string","null"]},"field":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}},"required":["valid","problems"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/activate":{"post":{"operationId":"activateAutomation","tags":["Automations"],"summary":"Activate (or resume) an automation","description":"Publishes the current definition as a new version when it changed, then starts accepting entries. A paused automation resumes: runs continue where they were. Fails with 400 `automation_invalid` and `details.problems` when something is missing.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation"]},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","active","paused","stopped"]},"trigger":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["list_added"]},"listId":{"type":"string"},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","listId"],"description":"A contact is added to the list (API, dashboard, import, form or another automation)."},{"type":"object","properties":{"type":{"type":"string","enum":["form_confirmed"]},"formId":{"type":["string","null"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"A double opt-in confirmation, or a single opt-in signup, on the form (any form when omitted)."},{"type":"object","properties":{"type":{"type":"string","enum":["attribute_changed"]},"key":{"type":"string"},"value":{"description":"Only when the attribute changes to this value."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","key"]},{"type":"object","properties":{"type":{"type":"string","enum":["event"]},"name":{"type":"string","description":"Event name sent to POST /v1/events/track."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","name"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"attribute":{"type":"string","description":"A date attribute, for example renewal_date or birthday."},"offsetDays":{"type":"integer","minimum":-365,"maximum":365,"description":"Days after the date; negative for before. Default 0."},"repeat":{"type":"string","enum":["yearly","once"],"description":"`yearly` (default): every year on the date. `once`: on the date itself."},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"When to start, HH:MM in the workspace time zone. Default 09:00."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","attribute"]},{"type":"object","properties":{"type":{"type":"string","enum":["campaign_engagement"]},"campaignId":{"type":"string"},"action":{"type":"string","enum":["opened","clicked"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","campaignId","action"]},{"type":"object","properties":{"type":{"type":"string","enum":["conversion"]},"goal":{"type":["string","null"],"description":"Only conversions with this goal, for example purchase."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["manual"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"Only through POST /v1/automations/{id}/enroll or the dashboard."}]},"steps":{"type":"array","items":{"type":"object","additionalProperties":{}}},"settings":{"type":"object","additionalProperties":{}},"goals":{"type":"array","items":{"type":"object","additionalProperties":{}}},"version":{"type":"number","description":"Latest published version; 0 for a draft that was never activated."},"stats":{"type":["object","null"],"properties":{"entered":{"type":"number"},"active":{"type":"number"},"completed":{"type":"number"},"exited":{"type":"number"},"failed":{"type":"number"}},"required":["entered","active","completed","exited","failed"]},"activatedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"webhookDisabledReason":{"type":["string","null"],"description":"OneSend turned this automation's webhook steps off (`key_revoked`, `key_leaked`): the API key that created the automation or added its webhook step was revoked or reported as leaked. The steps are skipped; the rest runs. An admin saving the steps again (PATCH with `steps`) turns them back on."}},"required":["id","object","name","description","status","trigger","steps","settings","goals","version","stats","activatedAt","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"402":{"description":"Payment required (type `payment_required`): `license_required`, a self-hosted server without an active license key (`details.buyUrl`); on the cloud, only when cloud plans are enabled, `plan_required` (the workspace has no plan; `details.upgradeUrl`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/pause":{"post":{"operationId":"pauseAutomation","tags":["Automations"],"summary":"Pause an automation","description":"No new entries, and runs in progress wait where they are until the automation is activated again.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation"]},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","active","paused","stopped"]},"trigger":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["list_added"]},"listId":{"type":"string"},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","listId"],"description":"A contact is added to the list (API, dashboard, import, form or another automation)."},{"type":"object","properties":{"type":{"type":"string","enum":["form_confirmed"]},"formId":{"type":["string","null"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"A double opt-in confirmation, or a single opt-in signup, on the form (any form when omitted)."},{"type":"object","properties":{"type":{"type":"string","enum":["attribute_changed"]},"key":{"type":"string"},"value":{"description":"Only when the attribute changes to this value."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","key"]},{"type":"object","properties":{"type":{"type":"string","enum":["event"]},"name":{"type":"string","description":"Event name sent to POST /v1/events/track."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","name"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"attribute":{"type":"string","description":"A date attribute, for example renewal_date or birthday."},"offsetDays":{"type":"integer","minimum":-365,"maximum":365,"description":"Days after the date; negative for before. Default 0."},"repeat":{"type":"string","enum":["yearly","once"],"description":"`yearly` (default): every year on the date. `once`: on the date itself."},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"When to start, HH:MM in the workspace time zone. Default 09:00."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","attribute"]},{"type":"object","properties":{"type":{"type":"string","enum":["campaign_engagement"]},"campaignId":{"type":"string"},"action":{"type":"string","enum":["opened","clicked"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","campaignId","action"]},{"type":"object","properties":{"type":{"type":"string","enum":["conversion"]},"goal":{"type":["string","null"],"description":"Only conversions with this goal, for example purchase."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["manual"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"Only through POST /v1/automations/{id}/enroll or the dashboard."}]},"steps":{"type":"array","items":{"type":"object","additionalProperties":{}}},"settings":{"type":"object","additionalProperties":{}},"goals":{"type":"array","items":{"type":"object","additionalProperties":{}}},"version":{"type":"number","description":"Latest published version; 0 for a draft that was never activated."},"stats":{"type":["object","null"],"properties":{"entered":{"type":"number"},"active":{"type":"number"},"completed":{"type":"number"},"exited":{"type":"number"},"failed":{"type":"number"}},"required":["entered","active","completed","exited","failed"]},"activatedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"webhookDisabledReason":{"type":["string","null"],"description":"OneSend turned this automation's webhook steps off (`key_revoked`, `key_leaked`): the API key that created the automation or added its webhook step was revoked or reported as leaked. The steps are skipped; the rest runs. An admin saving the steps again (PATCH with `steps`) turns them back on."}},"required":["id","object","name","description","status","trigger","steps","settings","goals","version","stats","activatedAt","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/stop":{"post":{"operationId":"stopAutomation","tags":["Automations"],"summary":"Stop an automation","description":"No new entries, and every run in progress is canceled. It can be activated again later.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation"]},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","active","paused","stopped"]},"trigger":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["list_added"]},"listId":{"type":"string"},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","listId"],"description":"A contact is added to the list (API, dashboard, import, form or another automation)."},{"type":"object","properties":{"type":{"type":"string","enum":["form_confirmed"]},"formId":{"type":["string","null"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"A double opt-in confirmation, or a single opt-in signup, on the form (any form when omitted)."},{"type":"object","properties":{"type":{"type":"string","enum":["attribute_changed"]},"key":{"type":"string"},"value":{"description":"Only when the attribute changes to this value."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","key"]},{"type":"object","properties":{"type":{"type":"string","enum":["event"]},"name":{"type":"string","description":"Event name sent to POST /v1/events/track."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","name"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"attribute":{"type":"string","description":"A date attribute, for example renewal_date or birthday."},"offsetDays":{"type":"integer","minimum":-365,"maximum":365,"description":"Days after the date; negative for before. Default 0."},"repeat":{"type":"string","enum":["yearly","once"],"description":"`yearly` (default): every year on the date. `once`: on the date itself."},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"When to start, HH:MM in the workspace time zone. Default 09:00."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","attribute"]},{"type":"object","properties":{"type":{"type":"string","enum":["campaign_engagement"]},"campaignId":{"type":"string"},"action":{"type":"string","enum":["opened","clicked"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","campaignId","action"]},{"type":"object","properties":{"type":{"type":"string","enum":["conversion"]},"goal":{"type":["string","null"],"description":"Only conversions with this goal, for example purchase."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["manual"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"Only through POST /v1/automations/{id}/enroll or the dashboard."}]},"steps":{"type":"array","items":{"type":"object","additionalProperties":{}}},"settings":{"type":"object","additionalProperties":{}},"goals":{"type":"array","items":{"type":"object","additionalProperties":{}}},"version":{"type":"number","description":"Latest published version; 0 for a draft that was never activated."},"stats":{"type":["object","null"],"properties":{"entered":{"type":"number"},"active":{"type":"number"},"completed":{"type":"number"},"exited":{"type":"number"},"failed":{"type":"number"}},"required":["entered","active","completed","exited","failed"]},"activatedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"webhookDisabledReason":{"type":["string","null"],"description":"OneSend turned this automation's webhook steps off (`key_revoked`, `key_leaked`): the API key that created the automation or added its webhook step was revoked or reported as leaked. The steps are skipped; the rest runs. An admin saving the steps again (PATCH with `steps`) turns them back on."}},"required":["id","object","name","description","status","trigger","steps","settings","goals","version","stats","activatedAt","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/enroll":{"post":{"operationId":"enrollAutomation","tags":["Automations"],"summary":"Enroll contacts","description":"Up to 1,000 contacts by id or email, or a whole list or segment (in the background). Re-entry rules, trigger conditions and the most runs in progress apply; unsubscribed, bounced and complained contacts are skipped. Works with any trigger type.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contactIds":{"type":"array","items":{"type":"string"},"maxItems":1000},"emails":{"type":"array","items":{"type":"string","format":"email"},"maxItems":1000},"listId":{"type":"string","description":"Enroll the whole list in the background."},"segmentId":{"type":"string","description":"Enroll the whole segment in the background."}}}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"enrollmentId":{"type":"string"},"background":{"type":"boolean"},"enrolled":{"type":"number"},"notFound":{"type":"number"},"skipped":{"type":"object","additionalProperties":{"type":"number"},"description":"Contacts not enrolled, by reason: already_entered, conditions, max_active_runs, unsubscribed."}},"required":["enrollmentId","background","enrolled","notFound","skipped"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/test":{"post":{"operationId":"testAutomation","tags":["Automations"],"summary":"Test with one contact","description":"`dryRun: true` (default) walks the current definition for the contact without sending or changing anything and returns the path, with the subject of each email and the time each step would run. `dryRun: false` starts a real run on the published version with emails sandboxed (logged, not delivered); the automation must be active.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contactId":{"type":"string"},"email":{"type":"string","format":"email"},"dryRun":{"type":"boolean","default":true,"description":"`true`: preview the path without sending or changing anything. `false`: a real run on the published version with emails sandboxed."},"event":{"type":"object","properties":{"name":{"type":"string"},"properties":{"type":"object","additionalProperties":{}}},"required":["name"],"description":"Dry run: the trigger event to use for {{event.x}} variables and event conditions."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string"},"email":{"type":"string"},"end":{"type":"string","enum":["completed","exited","limit"]},"endsAt":{"type":"string"},"path":{"type":"array","items":{"type":"object","properties":{"stepId":{"type":"string"},"type":{"type":"string"},"name":{"type":["string","null"]},"outcome":{"type":"string"},"at":{"type":"string"},"detail":{"type":["object","null"],"additionalProperties":{}}},"required":["stepId","type","name","outcome","at","detail"]}},"problems":{"type":"array","items":{"type":"object","properties":{"stepId":{"type":["string","null"]},"field":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}},"required":["contactId","email","end","endsAt","path","problems"]},{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation_run"]},"automationId":{"type":"string"},"automationName":{"type":["string","null"]},"version":{"type":"number"},"contactId":{"type":"string"},"email":{"type":["string","null"]},"status":{"type":"string","enum":["active","waiting","completed","exited","failed","canceled"]},"stepId":{"type":["string","null"],"description":"The step the run is at (null when completed)."},"waitingFor":{"type":["string","null"],"enum":["wait","event","quiet_hours","frequency_cap",null]},"nextRunAt":{"type":["string","null"]},"exitReason":{"type":["string","null"],"description":"goal, exit_step, exit_condition, unsubscribed, bounced, complained, contact_deleted, stopped, removed, …"},"lastError":{"type":["string","null"]},"test":{"type":"boolean"},"emailsSent":{"type":"number"},"goalReachedAt":{"type":["string","null"]},"enteredAt":{"type":"string"},"completedAt":{"type":["string","null"]}},"required":["id","object","automationId","automationName","version","contactId","email","status","stepId","waitingFor","nextRunAt","exitReason","lastError","test","emailsSent","goalReachedAt","enteredAt","completedAt"]}]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/report":{"get":{"operationId":"getAutomationReport","tags":["Automations"],"summary":"Automation report","description":"Runs entered, in progress, completed and exited (with reasons); goal reached; email results (sent, delivered, opened, clicked, converted, revenue); and per step: runs at the step now, runs that finished it, outcomes (sent or skipped, yes or no, split paths) and email results. Rates: open and click = unique / delivered.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"automation":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation"]},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","active","paused","stopped"]},"trigger":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["list_added"]},"listId":{"type":"string"},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","listId"],"description":"A contact is added to the list (API, dashboard, import, form or another automation)."},{"type":"object","properties":{"type":{"type":"string","enum":["form_confirmed"]},"formId":{"type":["string","null"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"A double opt-in confirmation, or a single opt-in signup, on the form (any form when omitted)."},{"type":"object","properties":{"type":{"type":"string","enum":["attribute_changed"]},"key":{"type":"string"},"value":{"description":"Only when the attribute changes to this value."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","key"]},{"type":"object","properties":{"type":{"type":"string","enum":["event"]},"name":{"type":"string","description":"Event name sent to POST /v1/events/track."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","name"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"attribute":{"type":"string","description":"A date attribute, for example renewal_date or birthday."},"offsetDays":{"type":"integer","minimum":-365,"maximum":365,"description":"Days after the date; negative for before. Default 0."},"repeat":{"type":"string","enum":["yearly","once"],"description":"`yearly` (default): every year on the date. `once`: on the date itself."},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"When to start, HH:MM in the workspace time zone. Default 09:00."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","attribute"]},{"type":"object","properties":{"type":{"type":"string","enum":["campaign_engagement"]},"campaignId":{"type":"string"},"action":{"type":"string","enum":["opened","clicked"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type","campaignId","action"]},{"type":"object","properties":{"type":{"type":"string","enum":["conversion"]},"goal":{"type":["string","null"],"description":"Only conversions with this goal, for example purchase."},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["manual"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["attribute"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","before","after","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["list"]},"op":{"type":"string","enum":["in","not_in"]},"listId":{"type":"string"}},"required":["kind","op","listId"]},{"type":"object","properties":{"kind":{"type":"string","enum":["engagement"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"campaignId":{"type":"string"},"withinDays":{"type":"integer","exclusiveMinimum":0}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["status"]},"op":{"type":"string","enum":["eq","neq"]},"value":{"type":"string","enum":["subscribed","unsubscribed","bounced","complained","pending","inactive"]}},"required":["kind","op","value"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"name":{"type":"string"},"op":{"type":"string","enum":["performed","not_performed"]},"withinDays":{"type":"integer","exclusiveMinimum":0},"sinceEntry":{"type":"boolean","description":"Only events since the contact entered this automation."},"filters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Property name; `a.b` reads nested values."},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["key","op"]}}},"required":["kind","name","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event_property"]},"key":{"type":"string"},"op":{"type":"string","enum":["eq","neq","contains","not_contains","gt","lt","is_set","is_not_set"]},"value":{}},"required":["kind","key","op"],"description":"A property of the trigger event (or the event a wait-until-event step matched)."},{"type":"object","properties":{"kind":{"type":"string","enum":["email"]},"op":{"type":"string","enum":["opened","not_opened","clicked","not_clicked"]},"stepId":{"type":["string","null"],"description":"An earlier send step of this automation; any email of this run when omitted."}},"required":["kind","op"]},{"type":"object","properties":{"kind":{"type":"string","enum":["conversion"]},"op":{"type":"string","enum":["converted","not_converted"]},"goal":{"type":["string","null"]},"sinceEntry":{"type":"boolean","description":"Default true: only conversions since the contact entered."}},"required":["kind","op"]}]},"description":"Only contacts that match all of these enter."}},"required":["type"],"description":"Only through POST /v1/automations/{id}/enroll or the dashboard."}]},"steps":{"type":"array","items":{"type":"object","additionalProperties":{}}},"settings":{"type":"object","additionalProperties":{}},"goals":{"type":"array","items":{"type":"object","additionalProperties":{}}},"version":{"type":"number","description":"Latest published version; 0 for a draft that was never activated."},"stats":{"type":["object","null"],"properties":{"entered":{"type":"number"},"active":{"type":"number"},"completed":{"type":"number"},"exited":{"type":"number"},"failed":{"type":"number"}},"required":["entered","active","completed","exited","failed"]},"activatedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"webhookDisabledReason":{"type":["string","null"],"description":"OneSend turned this automation's webhook steps off (`key_revoked`, `key_leaked`): the API key that created the automation or added its webhook step was revoked or reported as leaked. The steps are skipped; the rest runs. An admin saving the steps again (PATCH with `steps`) turns them back on."}},"required":["id","object","name","description","status","trigger","steps","settings","goals","version","stats","activatedAt","createdAt","updatedAt"]},"runs":{"type":"object","properties":{"entered":{"type":"number"},"active":{"type":"number"},"completed":{"type":"number"},"exited":{"type":"number"},"failed":{"type":"number"}},"required":["entered","active","completed","exited","failed"]},"goalReached":{"type":"number"},"exitReasons":{"type":"object","additionalProperties":{"type":"number"}},"emails":{"type":"object","properties":{"sent":{"type":"number"},"delivered":{"type":"number"},"opened":{"type":"number"},"clicked":{"type":"number"},"converted":{"type":"number"},"revenue":{"type":"number"},"bounced":{"type":"number"},"unsubscribed":{"type":"number"},"complained":{"type":"number"},"total":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","conversion"]}},"required":["sent","delivered","opened","clicked","converted","revenue","bounced","unsubscribed","complained","total","rates"]},"steps":{"type":"array","items":{"type":"object","properties":{"stepId":{"type":"string"},"type":{"type":"string"},"name":{"type":["string","null"]},"inStep":{"type":"number","description":"Runs at this step now."},"completed":{"type":"number","description":"Runs that finished this step."},"outcomes":{"type":"object","additionalProperties":{"type":"number"},"description":"For example { sent, skipped } or { yes, no }."},"emails":{"type":["object","null"],"properties":{"sent":{"type":"number"},"delivered":{"type":"number"},"opened":{"type":"number"},"clicked":{"type":"number"},"converted":{"type":"number"},"revenue":{"type":"number"},"bounced":{"type":"number"},"unsubscribed":{"type":"number"},"complained":{"type":"number"},"total":{"type":"number"},"rates":{"type":"object","properties":{"delivery":{"type":"number"},"open":{"type":"number"},"click":{"type":"number"},"conversion":{"type":"number"}},"required":["delivery","open","click","conversion"]}},"required":["sent","delivered","opened","clicked","converted","revenue","bounced","unsubscribed","complained","total","rates"]}},"required":["stepId","type","name","inStep","completed","outcomes","emails"]}}},"required":["automation","runs","goalReached","exitReasons","emails","steps"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/runs":{"get":{"operationId":"listAutomationRuns","tags":["Automations"],"summary":"List runs","description":"One run per contact and entry, newest first.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Comma-separated run statuses."},"required":false,"description":"Comma-separated run statuses.","name":"status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"stepId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"contactId","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation_run"]},"automationId":{"type":"string"},"automationName":{"type":["string","null"]},"version":{"type":"number"},"contactId":{"type":"string"},"email":{"type":["string","null"]},"status":{"type":"string","enum":["active","waiting","completed","exited","failed","canceled"]},"stepId":{"type":["string","null"],"description":"The step the run is at (null when completed)."},"waitingFor":{"type":["string","null"],"enum":["wait","event","quiet_hours","frequency_cap",null]},"nextRunAt":{"type":["string","null"]},"exitReason":{"type":["string","null"],"description":"goal, exit_step, exit_condition, unsubscribed, bounced, complained, contact_deleted, stopped, removed, …"},"lastError":{"type":["string","null"]},"test":{"type":"boolean"},"emailsSent":{"type":"number"},"goalReachedAt":{"type":["string","null"]},"enteredAt":{"type":"string"},"completedAt":{"type":["string","null"]}},"required":["id","object","automationId","automationName","version","contactId","email","status","stepId","waitingFor","nextRunAt","exitReason","lastError","test","emailsSent","goalReachedAt","enteredAt","completedAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/runs/{runId}":{"get":{"operationId":"getAutomationRun","tags":["Automations"],"summary":"Get a run with its step history","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation_run"]},"automationId":{"type":"string"},"automationName":{"type":["string","null"]},"version":{"type":"number"},"contactId":{"type":"string"},"email":{"type":["string","null"]},"status":{"type":"string","enum":["active","waiting","completed","exited","failed","canceled"]},"stepId":{"type":["string","null"],"description":"The step the run is at (null when completed)."},"waitingFor":{"type":["string","null"],"enum":["wait","event","quiet_hours","frequency_cap",null]},"nextRunAt":{"type":["string","null"]},"exitReason":{"type":["string","null"],"description":"goal, exit_step, exit_condition, unsubscribed, bounced, complained, contact_deleted, stopped, removed, …"},"lastError":{"type":["string","null"]},"test":{"type":"boolean"},"emailsSent":{"type":"number"},"goalReachedAt":{"type":["string","null"]},"enteredAt":{"type":"string"},"completedAt":{"type":["string","null"]},"steps":{"type":"array","items":{"type":"object","properties":{"stepId":{"type":"string"},"type":{"type":"string"},"outcome":{"type":"string"},"detail":{"type":["object","null"],"additionalProperties":{}},"messageId":{"type":["string","null"]},"at":{"type":"string"}},"required":["stepId","type","outcome","detail","messageId","at"]}}},"required":["id","object","automationId","automationName","version","contactId","email","status","stepId","waitingFor","nextRunAt","exitReason","lastError","test","emailsSent","goalReachedAt","enteredAt","completedAt","steps"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/runs/{runId}/exit":{"post":{"operationId":"exitAutomationRun","tags":["Automations"],"summary":"Remove a contact from an automation","description":"Ends a run in progress (exit reason `removed`).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation_run"]},"automationId":{"type":"string"},"automationName":{"type":["string","null"]},"version":{"type":"number"},"contactId":{"type":"string"},"email":{"type":["string","null"]},"status":{"type":"string","enum":["active","waiting","completed","exited","failed","canceled"]},"stepId":{"type":["string","null"],"description":"The step the run is at (null when completed)."},"waitingFor":{"type":["string","null"],"enum":["wait","event","quiet_hours","frequency_cap",null]},"nextRunAt":{"type":["string","null"]},"exitReason":{"type":["string","null"],"description":"goal, exit_step, exit_condition, unsubscribed, bounced, complained, contact_deleted, stopped, removed, …"},"lastError":{"type":["string","null"]},"test":{"type":"boolean"},"emailsSent":{"type":"number"},"goalReachedAt":{"type":["string","null"]},"enteredAt":{"type":"string"},"completedAt":{"type":["string","null"]}},"required":["id","object","automationId","automationName","version","contactId","email","status","stepId","waitingFor","nextRunAt","exitReason","lastError","test","emailsSent","goalReachedAt","enteredAt","completedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/versions":{"get":{"operationId":"listAutomationVersions","tags":["Automations"],"summary":"Published versions","description":"Newest first, with the number of runs still in progress on each.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"version":{"type":"number"},"trigger":{"type":"object","additionalProperties":{}},"steps":{"type":"array","items":{"type":"object","additionalProperties":{}}},"settings":{"type":"object","additionalProperties":{}},"goals":{"type":"array","items":{"type":"object","additionalProperties":{}}},"createdAt":{"type":"string"},"runsInProgress":{"type":"number"}},"required":["version","trigger","steps","settings","goals","createdAt","runsInProgress"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/signing-secret":{"get":{"operationId":"getAutomationSigningSecret","tags":["Automations"],"summary":"Webhook step signing secret","description":"Webhook steps sign their requests with this secret: `x-onesend-signature: v1=<HMAC-SHA256 of \"<x-onesend-timestamp>.<body>\">`, as outgoing webhooks do.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"type":["string","null"]}},"required":["secret"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/automations/{id}/rotate-secret":{"post":{"operationId":"rotateAutomationSecret","tags":["Automations"],"summary":"Rotate the signing secret","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"type":"string"}},"required":["secret"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contacts/{id}/journeys":{"get":{"operationId":"listContactJourneys","tags":["Contacts"],"summary":"Automations a contact went through","description":"Runs (newest first) with each step the contact passed, and the contact's recent tracked events.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["automation_run"]},"automationId":{"type":"string"},"automationName":{"type":["string","null"]},"version":{"type":"number"},"contactId":{"type":"string"},"email":{"type":["string","null"]},"status":{"type":"string","enum":["active","waiting","completed","exited","failed","canceled"]},"stepId":{"type":["string","null"],"description":"The step the run is at (null when completed)."},"waitingFor":{"type":["string","null"],"enum":["wait","event","quiet_hours","frequency_cap",null]},"nextRunAt":{"type":["string","null"]},"exitReason":{"type":["string","null"],"description":"goal, exit_step, exit_condition, unsubscribed, bounced, complained, contact_deleted, stopped, removed, …"},"lastError":{"type":["string","null"]},"test":{"type":"boolean"},"emailsSent":{"type":"number"},"goalReachedAt":{"type":["string","null"]},"enteredAt":{"type":"string"},"completedAt":{"type":["string","null"]},"steps":{"type":"array","items":{"type":"object","properties":{"stepId":{"type":"string"},"type":{"type":"string"},"outcome":{"type":"string"},"detail":{"type":["object","null"],"additionalProperties":{}},"messageId":{"type":["string","null"]},"at":{"type":"string"}},"required":["stepId","type","outcome","detail","messageId","at"]}}},"required":["id","object","automationId","automationName","version","contactId","email","status","stepId","waitingFor","nextRunAt","exitReason","lastError","test","emailsSent","goalReachedAt","enteredAt","completedAt","steps"]}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"properties":{"type":"object","additionalProperties":{}},"occurredAt":{"type":"string"}},"required":["id","name","properties","occurredAt"]}}},"required":["data","events"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/events/track":{"post":{"operationId":"trackEvent","tags":["Events"],"summary":"Track a custom event","description":"Records something a contact did in your app, such as `cart_abandoned` or `order_completed`. Events start automations with an event trigger, end runs whose goal is the event, and continue runs waiting for it. Properties are available in automation emails as `{{event.<name>}}`. A Sending only key is enough. Identify the contact by `email` or `contactId`; unknown addresses return 404 unless `createContact` is true. Events sent with a test-mode key are stored but start no automation.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"contactId":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9_.:-]+$","description":"Event name, for example cart_abandoned or order_completed."},"properties":{"type":"object","additionalProperties":{},"description":"Up to 16 KB of JSON. Available in templates as {{event.<name>}}."},"occurredAt":{"type":"string"},"idempotencyKey":{"type":"string","maxLength":200,"description":"A retry with the same key is recorded once."},"createContact":{"type":"boolean","description":"Create the contact (status subscribed) when no contact has this email. Default false: unknown addresses return 404."}},"required":["name"],"example":{"email":"ada@example.com","name":"cart_abandoned","properties":{"cart_url":"https://shop.example/cart/123","total":49}}}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["event"]},"name":{"type":"string"},"contactId":{"type":"string"},"properties":{"type":"object","additionalProperties":{}},"occurredAt":{"type":"string"},"duplicate":{"type":"boolean"}},"required":["id","object","name","contactId","properties","occurredAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/events/tracked":{"get":{"operationId":"listTrackedEvents","tags":["Events"],"summary":"List tracked events","description":"Custom events, newest first. Filter by `contactId` and `name`.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"contactId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"name","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["event"]},"name":{"type":"string"},"contactId":{"type":"string"},"properties":{"type":"object","additionalProperties":{}},"occurredAt":{"type":"string"},"duplicate":{"type":"boolean"}},"required":["id","object","name","contactId","properties","occurredAt"]}},"nextCursor":{"type":["string","null"]}},"required":["data","nextCursor"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/workspace/export":{"post":{"operationId":"exportWorkspace","tags":["Workspace"],"summary":"Export all workspace data","description":"Owners and admins (or an admin-scoped live API key). Builds a ZIP in the background: one JSON file per table, CSV files for contacts, messages and events, and a README. Secrets are never included (provider credentials, API key hashes, webhook signing secrets, app password hashes). When it is ready, the person who asked gets an email with a signed download link; the file is kept for 7 days. Only one export runs at a time: while one is running, this returns it.","security":[{"bearer":[]}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["workspace_export"]},"status":{"type":"string","enum":["queued","running","ready","failed","expired"]},"size":{"type":["number","null"],"description":"Bytes, when ready"},"tables":{"type":"number"},"rows":{"type":"number"},"error":{"type":["string","null"]},"createdAt":{"type":"string"},"completedAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]},"downloadUrl":{"type":["string","null"],"description":"Signed link, valid until expiresAt. Anyone with the link can download the file."}},"required":["id","object","status","size","tables","rows","error","createdAt","completedAt","expiresAt","downloadUrl"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/workspace/exports":{"get":{"operationId":"listWorkspaceExports","tags":["Workspace"],"summary":"List data exports","description":"Owners and admins. Newest first, the last 20.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["workspace_export"]},"status":{"type":"string","enum":["queued","running","ready","failed","expired"]},"size":{"type":["number","null"],"description":"Bytes, when ready"},"tables":{"type":"number"},"rows":{"type":"number"},"error":{"type":["string","null"]},"createdAt":{"type":"string"},"completedAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]},"downloadUrl":{"type":["string","null"],"description":"Signed link, valid until expiresAt. Anyone with the link can download the file."}},"required":["id","object","status","size","tables","rows","error","createdAt","completedAt","expiresAt","downloadUrl"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/workspace/exports/{id}":{"get":{"operationId":"getWorkspaceExport","tags":["Workspace"],"summary":"Get a data export","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["workspace_export"]},"status":{"type":"string","enum":["queued","running","ready","failed","expired"]},"size":{"type":["number","null"],"description":"Bytes, when ready"},"tables":{"type":"number"},"rows":{"type":"number"},"error":{"type":["string","null"]},"createdAt":{"type":"string"},"completedAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]},"downloadUrl":{"type":["string","null"],"description":"Signed link, valid until expiresAt. Anyone with the link can download the file."}},"required":["id","object","status","size","tables","rows","error","createdAt","completedAt","expiresAt","downloadUrl"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/workspace/exports/{id}/download":{"get":{"operationId":"getWorkspaceExportDownload","tags":["Workspace"],"summary":"Download a data export","description":"With the signed `token` from the email (or from `downloadUrl`), or with an owner or admin session of the workspace. Answers 410 `export_expired` after the file was removed.","security":[],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":2048},"required":false,"name":"token","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/zip":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/workspace/deletion":{"get":{"operationId":"getWorkspaceDeletion","tags":["Workspace"],"summary":"Workspace deletion status","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active","pending_deletion"]},"requestedAt":{"type":["string","null"]},"purgeAt":{"type":["string","null"]},"requestedBy":{"type":["object","null"],"properties":{"id":{"type":"string"},"email":{"type":["string","null"]}},"required":["id","email"]}},"required":["status","requestedAt","purgeAt","requestedBy"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/workspace/deletion/cancel":{"post":{"operationId":"cancelWorkspaceDeletion","tags":["Workspace"],"summary":"Cancel the workspace deletion","description":"Owner only, before the grace period ends. Sending resumes and members are notified.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active","pending_deletion"]},"requestedAt":{"type":["string","null"]},"purgeAt":{"type":["string","null"]},"requestedBy":{"type":["object","null"],"properties":{"id":{"type":"string"},"email":{"type":["string","null"]}},"required":["id","email"]}},"required":["status","requestedAt","purgeAt","requestedBy"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/contacts/{id}/export":{"get":{"operationId":"getContactExport","tags":["Contacts"],"summary":"Export a contact's data (GDPR)","description":"Everything stored about one person in this workspace, as JSON: the contact, lists, suppression, campaign deliveries, messages, events, clicks, conversions, form submissions and mail received from the address. To erase the person, use DELETE /v1/contacts/{id}?erase=true.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/auth/delete-account":{"post":{"operationId":"deleteAccountAuth","tags":["Account"],"summary":"Delete an account without a workspace","description":"For accounts that can no longer sign in because they have no workspace left (for example after the workspace was deleted). Same checks as DELETE /v1/account: password, a two-factor code if it is on, and no owned workspaces.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string","maxLength":256,"description":"Your current password"},"code":{"type":"string","maxLength":40,"description":"Two-factor code or recovery code, when two-factor authentication is on for your account"},"email":{"type":"string","maxLength":320,"format":"email"}},"required":["password","email"]}}}},"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/admin/status-incidents":{"get":{"operationId":"listAdminStatusIncidents","tags":["Admin"],"summary":"List status page incidents","description":"Instance admins only (ONESEND_ADMIN_EMAILS).","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["investigating","identified","monitoring","resolved"]},"impact":{"type":"string","enum":["minor","major","critical"]},"components":{"type":"array","items":{"type":"string"}},"updates":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"status":{"type":"string"},"body":{"type":"string"}},"required":["at","status","body"]},"description":"Newest first"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"resolvedAt":{"type":["string","null"]}},"required":["id","title","status","impact","components","updates","createdAt","updatedAt","resolvedAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"post":{"operationId":"createAdminStatusIncident","tags":["Admin"],"summary":"Post a status page incident","description":"Instance admins only. Shown on /status while open, and under past incidents for 90 days after it is resolved. An open incident sets its components to degraded (minor impact) or down (major, critical).","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":5000,"description":"First update shown under the title"},"status":{"type":"string","enum":["investigating","identified","monitoring","resolved"],"default":"investigating"},"impact":{"type":"string","enum":["minor","major","critical"],"default":"minor"},"components":{"type":"array","items":{"type":"string","enum":["api","sending","inbound","dashboard"]},"maxItems":10,"default":[],"description":"Affected components (api, sending, inbound, dashboard); empty means all"}},"required":["title","body"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["investigating","identified","monitoring","resolved"]},"impact":{"type":"string","enum":["minor","major","critical"]},"components":{"type":"array","items":{"type":"string"}},"updates":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"status":{"type":"string"},"body":{"type":"string"}},"required":["at","status","body"]},"description":"Newest first"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"resolvedAt":{"type":["string","null"]}},"required":["id","title","status","impact","components","updates","createdAt","updatedAt","resolvedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/admin/status-incidents/{id}":{"patch":{"operationId":"updateAdminStatusIncident","tags":["Admin"],"summary":"Update a status page incident","description":"Instance admins only. Send `body` to add an update. Setting `status: \"resolved\"` closes the incident.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"status":{"type":"string","enum":["investigating","identified","monitoring","resolved"]},"impact":{"type":"string","enum":["minor","major","critical"]},"components":{"type":"array","items":{"type":"string","enum":["api","sending","inbound","dashboard"]},"maxItems":10},"body":{"type":"string","minLength":1,"maxLength":5000,"description":"Adds an update with this text (and the new or current status)"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["investigating","identified","monitoring","resolved"]},"impact":{"type":"string","enum":["minor","major","critical"]},"components":{"type":"array","items":{"type":"string"}},"updates":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"status":{"type":"string"},"body":{"type":"string"}},"required":["at","status","body"]},"description":"Newest first"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"resolvedAt":{"type":["string","null"]}},"required":["id","title","status","impact","components","updates","createdAt","updatedAt","resolvedAt"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"413":{"description":"The request body is larger than the limit for this endpoint (`payload_too_large`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"415":{"description":"The body is not sent as `Content-Type: application/json` (`unsupported_media_type`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}},"delete":{"operationId":"deleteAdminStatusIncident","tags":["Admin"],"summary":"Delete a status page incident","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/admin/status-checks/run":{"post":{"operationId":"runAdminStatusChecks","tags":["Admin"],"summary":"Run the status self-checks now","description":"Instance admins only. Records one round of checks (as the 5-minute job does) and returns the results.","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"component":{"type":"string"},"status":{"type":"string"},"detail":{"type":"string"}},"required":["component","status","detail"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/security/alerts":{"get":{"operationId":"listSecurityAlerts","tags":["Security"],"summary":"Security alerts not acknowledged yet","description":"Workspace owners, signed in. The security alerts of the last 30 days (API keys created, rotated, revoked or leaked, configuration changed or a new address used by a key, inbox rules sending mail outside the workspace, hourly digests) that this owner has not acknowledged. `delivery` says how each one reached the owners: `email` (the workspace's providers), `instance` (the server's alert mailer, ONESEND_ALERT_SMTP_URL) or `dashboard` (no email could be sent: only here).","security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"subject":{"type":"string"},"lines":{"type":"array","items":{"type":"string"}},"delivery":{"type":"string","enum":["email","instance","dashboard"]},"createdAt":{"type":"string"}},"required":["id","kind","subject","lines","delivery","createdAt"]}}},"required":["data"]}}}},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/security/alerts/acknowledge":{"post":{"operationId":"acknowledgeSecurityAlerts","tags":["Security"],"summary":"Acknowledge the security alerts","description":"Workspace owners, signed in (not API keys): hides the alerts listed by GET /v1/security/alerts until a new one arrives.","security":[{"bearer":[]}],"responses":{"204":{"description":"No content"},"400":{"description":"Invalid request: validation failed, a parameter is not allowed, the body is not valid JSON (`invalid_json`) or the pagination cursor is not valid (`invalid_cursor`). Type `invalid_request`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing credentials (`unauthorized`), an unknown or revoked API key (`invalid_api_key`) or an expired session (`invalid_session`). Type `unauthorized`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"403":{"description":"The API key's permission does not allow this operation (`insufficient_scope`; configuration needs an `admin` key), a test key was used outside its sandbox (`test_key_not_allowed`), a Conversion tracking key was used (`publishable_key`), or a cookie request is missing `X-OneSend-Client: dashboard` (`csrf_header_required`). Type `forbidden`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"The resource does not exist in this workspace (`not_found`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"The request conflicts with the current state, for example a duplicate name or a reused `Idempotency-Key` (`conflict`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Too many requests; retry after the time in the `Retry-After` header (`rate_limited`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Unexpected server error (`internal`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}}},"webhooks":{}}