{"openapi":"3.1.0","info":{"title":"Nitrosend API","version":"1.1.6","description":"Multi-channel marketing automation API. Send email campaigns, build\nautomation flows, manage contacts and segments, track events, and\nconfigure your Brand Kit — all via a single REST API.\n\n## Authentication\n\nAll `/v1/my/*` endpoints require authentication via **Bearer token**.\nAccepted token types:\n\n1. **API Key** — `Authorization: Bearer nskey_live_...`\n2. **JWT** — `Authorization: Bearer \u003cjwt\u003e` (obtained from `POST /v1/login`)\n3. **Shopify ID token** — supplied by App Bridge for an installed embedded app\n4. **Management credential** — `Authorization: Bearer nsmc_live_...`, pinned\n   to one managed account and brand under the existing `operator_v1` policy.\n   Domain receiving setup and dashboard webhooks use `domain.read/manage`\n   and `integration.read/manage` respectively. Inbox capability, domain\n   ownership, consent/payment eligibility and live revocation still apply.\n   Management credentials cannot mint API keys, provision sibling accounts,\n   buy capacity or manage billing; they can read a client's plan, plan list\n   and features (`billing.plan_purchase`). MCP event subscriptions remain\n   unavailable to delegated operators.\n\nAn agency's owners and admins work in a client account it manages with\ntheir own JWT and `X-Account-ID` under the same `operator_v1` policy. The\none billing action that policy allows is buying the client's first plan\nby card while the account is in Setup mode (`POST /v1/my/subscription`);\nplan changes, checkout, settings, cancel, coupons, payment methods and\ninvoices stay with the client's owner and admins.\n\n## Pagination\n\nPaginated endpoints return these headers:\n- `X-Total-Count` — total records\n- `X-Total-Pages` — total pages\n- `X-Page-Number` — current page\n- `X-Next-Page` — next page (omitted on last page)\n- `X-Prev-Page` — previous page (omitted on first page)\n\nUse `page` and `limit` (or `per`) query params to control pagination.\nMaximum `limit` is 100, default is 30.\n\n## Error Responses\n\nAll errors return a consistent JSON shape:\n```json\n{\n  \"code\": 422,\n  \"message\": \"Description of error\",\n  \"error\": true,\n  \"validation_errors\": { \"field\": [\"error message\"] }\n}\n```\nThe `validation_errors` key is only present on 422 responses.\n\nA signed-in user who has no account is given one on their first\nauthenticated request. If their email domain is not eligible for signup,\nno account is created and the request returns 403 with\n`\"message\": \"Email domain is not eligible for signup\"`.\n","contact":{"name":"Nitrosend","url":"https://nitrosend.com"},"license":{"name":"Proprietary","url":"https://nitrosend.com/terms"}},"servers":[{"url":"https://api.nitrosend.com","description":"Production"},{"url":"http://localhost:8000","description":"Local development"}],"security":[{"BearerAuth":[]}],"tags":[{"name":"Auth","description":"Login, logout, and registration"},{"name":"User","description":"Current user profile"},{"name":"Account","description":"Account settings and configuration"},{"name":"Affiliate Center","description":"Entitled affiliate link, standing, and lifetime performance"},{"name":"Managed Clients","description":"Explicitly enabled client provisioning, consent, and portfolio operations"},{"name":"Partner","description":"Provisioning-credential authenticated managed-client operations"},{"name":"Billing","description":"Subscription billing and checkout"},{"name":"Delivery","description":"Read-only plan/cohort sending allowance and pacing state"},{"name":"Email Validation","description":"Explicit prepaid email validation quotes and operations"},{"name":"Contacts","description":"Contact management"},{"name":"Imports","description":"Bulk CSV import jobs"},{"name":"Exports","description":"Contact CSV export jobs"},{"name":"Lists","description":"Contact lists"},{"name":"Segments","description":"Dynamic contact segments"},{"name":"Campaigns","description":"Email and SMS campaigns"},{"name":"Workspace","description":"Read-only next actions, agent activity and bounded workspace search"},{"name":"Messages","description":"Transactional email and SMS messages"},{"name":"Suppressions","description":"Account suppression list and deliverability diagnostics"},{"name":"Webhooks","description":"Signed delivery-event webhooks for transactional email"},{"name":"Templates","description":"Email templates, preview, and component schema"},{"name":"Flows","description":"Automation flows and step schema"},{"name":"Mail Action Protocol","description":"The account owner's review and decision of an agent's campaign send, described with MAP 0.3 Campaign Send Approval"},{"name":"Events","description":"Contact event tracking"},{"name":"Domains","description":"Sending domain verification"},{"name":"Integrations","description":"BYO provider integration management"},{"name":"Brands","description":"Brand context plus Brand Kit identity, theme, and per-brand configuration"},{"name":"SavedViews","description":"Saved table presets (filters + sort + columns) per surface"},{"name":"Public","description":"Unauthenticated public endpoints"},{"name":"MCP","description":"Model Context Protocol JSON-RPC endpoint and discovery"},{"name":"Operator","description":"Internal production support operations; requires an admin or staff API key"}],"paths":{"/mcp":{"get":{"tags":["MCP"],"operationId":"probeMcp","summary":"Probe the MCP OAuth endpoint","description":"Unauthenticated probes receive the RFC 9728 protected-resource metadata\nURL in `WWW-Authenticate` so OAuth clients can continue discovery.\nAuthenticated requests receive `405 Method Not Allowed` because this\nserver does not offer a server-initiated event stream over GET. Use\n`POST /mcp` for MCP Streamable HTTP requests.\n","responses":{"401":{"description":"MCP authentication required","headers":{"WWW-Authenticate":{"description":"Bearer challenge with the RFC 9728 protected-resource metadata URL","schema":{"type":"string","example":"Bearer resource_metadata=\"https://api.nitrosend.com/.well-known/oauth-protected-resource/mcp\""}}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"405":{"description":"Authenticated GET is not supported by the MCP transport","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"post":{"tags":["MCP"],"operationId":"callMcp","summary":"MCP JSON-RPC endpoint","description":"JSON-RPC endpoint for the Nitrosend MCP server. Read `nitro://account`,\n`nitro://config`, or call `nitro_get_status` for bound account identity;\nthere is no per-tool account override argument.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"JSON-RPC response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/.well-known/poppy.json":{"get":{"tags":["MCP"],"operationId":"getPoppyDocument","summary":"Personal Agent Protocol discovery document","security":[],"description":"Personal Agent Protocol (Poppy) 1.0 discovery\n(https://personalagentprotocol.org/docs/1.0/spec#3-discovery). Names the\nMCP server, describes the `mcp` and `send-approvals` scopes, and lists\nthe Operations (version 3) and `mailschema.org/map` (version 1)\nextensions. The MAP extension, defined at\nhttps://mailschema.org/specification/poppy, maps Campaign Send Approval\n0.1 to the `nitro_send_approval` MCP tool; it is listed only when the\nserving origin is the MAP service origin. Poppy clients sign in through\nthe OAuth issuer named by `/.well-known/oauth-protected-resource`,\nauthenticating with private_key_jwt. Served only on the canonical API\norigin and only while `POPPY_ENABLED` is on; otherwise 404.\n","responses":{"404":{"description":"Poppy is off, or the request is not for the canonical API origin"},"200":{"description":"The discovery document","content":{"application/json":{"schema":{"type":"object","required":["protocol_version","organization","apis"],"properties":{"protocol_version":{"type":"string","example":"1.0"},"organization":{"type":"object","required":["name","domain"],"properties":{"name":{"type":"string","example":"Nitrosend"},"domain":{"type":"string","example":"api.nitrosend.com"}}},"auth":{"type":"object","properties":{"scopes":{"type":"object","additionalProperties":{"type":"string"}},"scope_hints":{"type":"object","additionalProperties":{"type":"object","properties":{"changes":{"type":"string","enum":["none","reversible","irreversible"]},"personal_data":{"type":"boolean"}}}}}},"apis":{"type":"array","items":{"type":"object","required":["type","url"],"properties":{"type":{"type":"string","example":"mcp"},"url":{"type":"string","format":"uri"},"description":{"type":"string"}}}},"extensions":{"type":"object","additionalProperties":{"type":"array","items":{"type":"object","required":["version"],"properties":{"version":{"type":"string"}},"additionalProperties":true}}}}}}}}}}},"/v1/signup":{"post":{"tags":["Auth"],"operationId":"signup","summary":"Begin email-verified signup","security":[],"parameters":[{"$ref":"#/components/parameters/SignupDeviceType"},{"$ref":"#/components/parameters/SignupInAppBrowser"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["user"],"properties":{"user":{"type":"object","required":["email"],"properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email"},"mobile":{"type":"string"},"invite_token":{"type":"string","nullable":true},"referral_code":{"type":"string","nullable":true,"description":"Partner or referral code. The signup succeeds even when the code is invalid; the outcome is reported in `meta.promo`."},"rewardful_referral_id":{"type":"string","nullable":true},"signup_intent":{"$ref":"#/components/schemas/SignupIntent"},"password":{"type":"string","format":"password","minLength":6,"description":"Optional initiation password, validated when supplied. The mailbox owner must choose the final password when verifying; this password never grants a session or survives verification by itself."},"password_confirmation":{"type":"string","format":"password"},"attribution_context":{"$ref":"#/components/schemas/FirstTouchAttributionContext"}}}}}}}},"responses":{"409":{"description":"Verification required. No account, membership, API key or session has been created. The same response covers existing addresses; sign in if already registered.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupVerificationRequired"}}}},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/SignupCapacityReached"},"503":{"description":"Signup paused or mail could not be queued. Retry later."}}}},"/v1/signup/resend":{"post":{"tags":["Auth"],"operationId":"resendSignupVerification","summary":"Request an email verification link","description":"A sign-up's link lasts 24 hours and a changed address's 30 minutes. Resending does not invalidate an unexpired link. Limited to three requests per address per UTC day, at least one minute apart, and a global daily mail budget. Unknown and established addresses get the same response and limits.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}}}}},"responses":{"202":{"description":"If eligible, verification mail is queued. No credential is returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupVerificationRequired"}}}},"429":{"$ref":"#/components/responses/SignupCapacityReached"},"503":{"description":"Mail could not be queued. Retry later."}}}},"/v1/signup/verify":{"post":{"tags":["Auth"],"operationId":"verifySignupEmail","summary":"Prove email ownership and complete signup","description":"Explicitly POST the one-use token from the verification email and a\nfinal password to complete a pending signup. It replaces any initiation\npassword. A GET of the link alone does not consume proof. No CAPTCHA or\nbrowser is required.\n\nWithout a nonempty string password, a pending signup returns 422 with\nerror_code password_required and next_action enter_password. This is a\nnon-consuming check: no proof, account or session is created. The same\ntoken with a valid final password completes signup once.\n\nAfter proof commits, a temporary activation failure can be\nretried through /v1/signup/activate without another email. A token for an\nestablished user's email change needs no password, returns email_verified\nwithout a JWT, and leaves their password and session unchanged.\n","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string","format":"password","writeOnly":true},"password":{"type":"string","format":"password","minLength":6,"writeOnly":true,"description":"The final password for a new signup. Required for every pending signup."}}}}}},"responses":{"200":{"description":"Signup complete, or an established email change confirmed.","headers":{"Authorization":{"schema":{"type":"string"},"description":"Bearer JWT only after successful signup activation. Absent for email changes."}},"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/SignupSession"},{"type":"object","required":["status","next_action"],"properties":{"status":{"type":"string","enum":["email_verified"]},"next_action":{"type":"string","enum":["sign_in"]}}}]}}}},"422":{"description":"The token cannot complete signup as sent. password_required means the\ntoken is still good and unspent: send it again with a password.\nverification_required means the link is invalid, expired or already\nused: request another, or sign in.\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"error_code":{"type":"string","enum":["password_required","verification_required"]},"next_action":{"type":"string","enum":["enter_password","resend_verification"]},"email":{"type":"string","format":"email","description":"Only with password_required. The address the link was sent to."}}}]}}}},"429":{"$ref":"#/components/responses/SignupCapacityReached"},"503":{"description":"Proof may already be saved. Retry activation with email and final password."}}}},"/v1/signup/activate":{"post":{"tags":["Auth"],"operationId":"resumeSignupActivation","summary":"Resume an already verified signup","description":"Requires email ownership already proved and the final password. Returns the existing account/session if activation already succeeded. Does not create another account. Use this after a lost verification response, capacity deferral, or a client failure creating or saving its API key.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","format":"password","writeOnly":true}}}}}},"responses":{"200":{"description":"Active session","headers":{"Authorization":{"schema":{"type":"string"},"description":"Bearer JWT for the session"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupSession"}}}},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/SignupCapacityReached"},"503":{"description":"Activation could not finish. Retry with the same email and final password."}}}},"/v1/login":{"post":{"tags":["Auth"],"operationId":"login","summary":"Sign in and receive a JWT","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["user"],"properties":{"user":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","format":"password"}}}}}}}},"responses":{"200":{"description":"Signed in","headers":{"Authorization":{"schema":{"type":"string"},"description":"JWT token"}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/User"},{"type":"object","properties":{"meta":{"type":"object","description":"Present when the user has an account.","properties":{"account_id":{"type":"integer","description":"The account this sign-in opens on. Send it as X-Account-ID to act on that account."}}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The user has no account yet and their email domain is not eligible for signup. No account is created, and no session or token is issued.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/logout":{"delete":{"tags":["Auth"],"operationId":"logout","summary":"Sign out and revoke JWT","responses":{"204":{"description":"Signed out"}}}},"/v1/oauth/me":{"get":{"tags":["Auth"],"operationId":"getOauthPopupContext","summary":"Get OAuth popup context","parameters":[{"name":"client_id","in":"query","schema":{"type":"string"},"description":"OAuth application ID, used to name the connection being authorized."}],"description":"Returns the account-selection and subscription context used by the\n`/oauth/connect` popup. This endpoint accepts the normal Bearer JWT\nand, for popup resume flows, the authenticated browser session cookie\nestablished by Devise/OmniAuth.\n","responses":{"200":{"description":"Popup context","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthPopupContext"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The user has no account yet and their email domain is not eligible for signup, so none is created.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}}}}},"/v1/oauth/subscribe":{"post":{"tags":["Auth"],"operationId":"subscribeOauthPopupAccount","summary":"Subscribe the selected OAuth popup account","description":"Finalizes plan selection for the `/oauth/connect` popup before the\nbrowser returns to the Doorkeeper consent screen. This endpoint accepts\nthe normal Bearer JWT and, for popup resume flows, the authenticated\nbrowser session cookie established by Devise/OmniAuth.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthPopupSubscribeRequest"}}}},"responses":{"200":{"description":"Popup can continue to consent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthPopupSubscribeResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The user cannot manage the selected account, the account must buy through another billing provider (`billing_route` says which), or the user has no account yet and their email domain is not eligible for signup.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"billing_route":{"type":"object","description":"Present when the account bills through another provider."}}}}}},"422":{"description":"Account or plan selection failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}}}}},"/v1/oauth/launch":{"post":{"tags":["Auth"],"operationId":"createOauthLaunch","summary":"Create a CSRF-safe OAuth provider launch URL","security":[],"parameters":[{"$ref":"#/components/parameters/SignupDeviceType"},{"$ref":"#/components/parameters/SignupInAppBrowser"}],"description":"Mints a short-lived launch URL for Google or GitHub sign-in. The\nfrontend follows the returned API-origin launch page, which renders the\nreal POST form to `/auth/:provider` with a valid Rails authenticity\ntoken. This preserves OmniAuth's POST-only request phase and CSRF\nprotection for both the app popup flow and the `/oauth/connect` agent\npopup flow.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthLaunchRequest"}}}},"responses":{"200":{"description":"Launch URL created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthLaunchResponse"}}}},"400":{"description":"Invalid provider or resume URL","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}}}}},"/v1/my/user":{"get":{"tags":["User"],"operationId":"getUser","summary":"Get current user profile","responses":{"200":{"description":"User profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"patch":{"tags":["User"],"operationId":"updateUser","summary":"Update current user profile","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"oneOf":[{"type":"string","format":"email"},{"type":"array","items":{"type":"string","format":"email"}}]},"mobile":{"type":"string"},"time_zone":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"Updated user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/impersonation":{"get":{"tags":["User"],"operationId":"getImpersonation","summary":"Get current impersonation status","responses":{"200":{"description":"Current impersonation state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonationStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"delete":{"tags":["User"],"operationId":"exitImpersonation","summary":"Revoke the active impersonation session","responses":{"200":{"description":"Impersonation session revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonationExit"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/my/affiliate":{"get":{"tags":["Affiliate Center"],"operationId":"getMyAffiliate","summary":"Get the current account's Affiliate Center","description":"Session/JWT only. API keys are rejected. For an entitled account that is not linked locally, the first read starts one background reconciliation. That reconciliation links an existing Rewardful affiliate by the account owner's email or creates one when absent.","responses":{"200":{"description":"Affiliate Center payload or temporary setup state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateCenterPayload"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"tags":["Affiliate Center"],"operationId":"reconcileMyAffiliate","summary":"Reconcile the current account's affiliate immediately","description":"Session/JWT-only repair path. This is idempotent and uses the same existing-or-create behavior as background reconciliation.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"}}}}}},"responses":{"200":{"description":"Existing or already-linked affiliate","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateCenterPayload"}}}},"201":{"description":"Affiliate identity linked to the account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateCenterPayload"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v1/my/account":{"get":{"tags":["Account"],"operationId":"getAccount","summary":"Get account details","responses":{"200":{"description":"Account with billing. Brands are listed by GET /v1/my/brands.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}}}},"patch":{"tags":["Account"],"operationId":"updateAccount","summary":"Update account settings","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["if_version"],"properties":{"name":{"type":"string"},"avatar":{"type":"string","description":"Signed blob ID"},"banner":{"type":"string","description":"Signed blob ID"}}}}}},"responses":{"200":{"description":"Updated account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/delivery/status":{"get":{"tags":["Delivery"],"operationId":"getDeliveryStatus","summary":"Inspect the email sending allowance and pacing","description":"Returns a read-only projection of the persisted delivery controls for\nthe selected Brand. This endpoint does not authorize or reserve a send;\nevery send still passes through the canonical admission authority.\nPacing describes when admitted work can dispatch and is not itself an\nadmission decision.\n","responses":{"200":{"description":"Current email sender-capacity and pacing projection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/validation_operations/quote":{"post":{"tags":["Email Validation"],"operationId":"quoteEmailValidation","summary":"Quote explicit prepaid email validation","description":"Classifies one exact current-Brand audience, applies current cached and\neligibility evidence, and returns the maximum prepaid charge. It does\nnot hold funds, call a provider, create an operation, or mutate Contacts.\nValidation has no plan-included allowance.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationAudience"}}}},"responses":{"200":{"description":"Non-mutating validation quote","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationOperationQuote"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/validation_operations":{"get":{"tags":["Email Validation"],"operationId":"listEmailValidationOperations","summary":"The brand's latest contact list verifications","description":"Newest first, contact audiences only. Use the operation_id with the show endpoint for results and the sending choice.","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":20,"default":5}}],"responses":{"200":{"description":"Latest verifications","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["operations"],"properties":{"operations":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["operation_id","status","terminal","source_kind","candidate_count","created_at"],"properties":{"operation_id":{"type":"string"},"status":{"type":"string"},"terminal":{"type":"boolean","description":"The run has finished."},"source_kind":{"type":"string"},"candidate_count":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"},"completed_at":{"type":"string","format":"date-time"},"failure_code":{"type":"string","description":"Present when the run stopped or expired before every check finished."}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Email Validation"],"operationId":"createEmailValidationOperation","summary":"Start or resume explicit prepaid email validation","description":"Creates one durable operation and holds at most the quoted amount from\ndirect prepaid funds. Reusing the same Idempotency-Key with the same\naudience returns the same operation; after funding, the same request\nresumes a needs_funding operation. A changed audience conflicts.\n","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationAudience"}}}},"responses":{"202":{"description":"Durable validation operation accepted or replayed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationOperation"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/validation_operations/{id}":{"get":{"tags":["Email Validation"],"operationId":"getEmailValidationOperation","summary":"Get an email validation operation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":64},"description":"Opaque operation_id returned by the create endpoint."}],"responses":{"200":{"description":"Current durable operation state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationOperation"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/validation_operations/{id}/keep_unconfirmed":{"post":{"tags":["Email Validation"],"operationId":"keepUnconfirmedValidationAddresses","summary":"Keep a finished run's unknown and catch-all addresses in sends","description":"A finished list verification leaves unknown and catch-all addresses out of sends by default. This keeps sending to the ones this run left out. Addresses stopped for another reason (a bounce, an unsubscribe, an invalid result) stay stopped.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":64}}],"responses":{"200":{"description":"Updated operation state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationOperation"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The run is still finishing or its addresses are still being left out (error_code validation_in_progress), or sending resumed automatically on the condition unconfirmed addresses stay out (error_code unconfirmed_include_blocked; contact support to include them)."}}}},"/v1/my/validation_operations/{id}/exclude_unconfirmed":{"post":{"tags":["Email Validation"],"operationId":"excludeUnconfirmedValidationAddresses","summary":"Leave a finished run's unknown and catch-all addresses out of sends","description":"Applies the default to a run that predates it, or after its addresses were kept. Runs in the background; poll the operation until unconfirmed.pending is false.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":64}}],"responses":{"200":{"description":"Updated operation state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationOperation"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The run is still finishing or its addresses are still being left out."}}}},"/v1/my/validation_operations/{id}/items":{"get":{"tags":["Email Validation"],"operationId":"listEmailValidationOperationItems","summary":"List per-candidate email validation results","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":64},"description":"Opaque operation_id returned by the create endpoint."},{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/PerParam"}],"responses":{"200":{"description":"Paginated operation items","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ValidationOperationItem"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/accounts":{"get":{"tags":["Account"],"operationId":"listAccounts","summary":"List accessible accounts (paginated)","parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"per","in":"query","schema":{"type":"integer","default":100,"maximum":100}}],"responses":{"200":{"description":"Accessible accounts","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Account"}}}}}}}},"/v1/my/managed_accounts":{"get":{"tags":["Managed Clients"],"operationId":"listManagedAccounts","summary":"List the selected manager account's client portfolio","parameters":[{"$ref":"#/components/parameters/PageParam"},{"name":"per","in":"query","schema":{"type":"integer","default":25,"maximum":100}},{"name":"q","in":"query","schema":{"type":"string","maxLength":120}},{"name":"status","in":"query","schema":{"allOf":[{"$ref":"#/components/schemas/ManagedAccountLifecycleStatusFilter"}]},"description":"Use needs_setup to group preparing, awaiting owner, payment required, and payment issue rows."},{"name":"sort","in":"query","schema":{"type":"string","enum":["created_at","name","owner_email","status"],"default":"created_at"}},{"name":"direction","in":"query","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Bounded managed-client portfolio","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ManagedAccountProvisioning"}}}}},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Managed Clients"],"operationId":"createManagedAccount","summary":"Provision a paid-required, client-owned account","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardManagedAccountCreateRequest"}}}},"responses":{"201":{"description":"Client provisioned in preparing state; no owner invitation has been sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountProvisioningCreated"}}}},"200":{"description":"Exact idempotent replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountProvisioningCreated"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/managed_accounts/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Managed Clients"],"operationId":"getManagedAccount","summary":"Get one managed-client portfolio row","responses":{"200":{"description":"Managed-client portfolio row","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountProvisioning"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/managed_accounts/{id}/resend_invitation":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Managed Clients"],"operationId":"resendManagedAccountInvitation","summary":"Invalidate the prior invitation and queue a bounded replacement for owner-only delivery","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardPaymentHandoffRequest"}}}},"responses":{"200":{"description":"Updated portfolio row; no invitation capability is returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountProvisioning"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/v1/my/managed_accounts/{id}/send_invitation":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Managed Clients"],"operationId":"sendManagedAccountInvitation","summary":"Queue the first bounded owner invitation after client setup is ready","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardPaymentHandoffRequest"}}}},"responses":{"200":{"description":"Updated portfolio row; no invitation capability is returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountProvisioning"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/v1/my/managed_accounts/{id}/payment_reminder":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Managed Clients"],"operationId":"remindManagedAccountPayment","summary":"Queue a cooldown-bound payment reminder to the owner","responses":{"204":{"description":"Reminder accepted for delivery"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/v1/my/managed_accounts/{id}/release":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Managed Clients"],"operationId":"releaseManagedAccount","summary":"End the selected manager's relationship with the client","responses":{"200":{"description":"Ended managed-client relationship","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountProvisioning"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/v1/my/account/provisioning_credentials":{"get":{"tags":["Managed Clients"],"operationId":"listAccountProvisioningCredentials","summary":"List non-secret provisioning credential metadata","responses":{"200":{"description":"Provisioning credential metadata","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccountProvisioningCredential"}}}}},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Managed Clients"],"operationId":"createAccountProvisioningCredential","summary":"Issue a provisioning credential and reveal its secret once","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountProvisioningCredentialCreateRequest"}}}},"responses":{"201":{"description":"One-time credential result","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"Always includes no-store"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountProvisioningCredentialIssued"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/account/provisioning_credentials/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"delete":{"tags":["Managed Clients"],"operationId":"revokeAccountProvisioningCredential","summary":"Revoke one manager-bound provisioning credential","responses":{"200":{"description":"Revoked credential metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountProvisioningCredential"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/managed_account_claims/inspect":{"post":{"tags":["Managed Clients"],"operationId":"inspectManagedAccountClaim","summary":"Inspect a bounded owner consent capability","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountClaimRequest"}}}},"responses":{"200":{"description":"Bounded claim projection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountClaimInspection"}}}},"410":{"$ref":"#/components/responses/Gone"}}}},"/v1/managed_account_claims/complete":{"post":{"tags":["Managed Clients"],"operationId":"completeManagedAccountClaim","summary":"Record one-time consent for the exact authenticated owner","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountClaimCompletionRequest"}}}},"responses":{"200":{"description":"Consent recorded. A client on Setup mode is active at once (the agency keeps building) with payment_required true, since live email waits for a plan; a client with a paid plan already active is active with payment_required false; otherwise status remains payment_required until paid activation","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"Always includes no-store"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountClaimCompletion"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"410":{"$ref":"#/components/responses/Gone"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/partner/managed_accounts":{"get":{"tags":["Partner"],"operationId":"listPartnerManagedAccounts","summary":"List managed clients using a manager-bound credential","security":[{"PartnerProvisioningCredential":[]}],"responses":{"200":{"description":"Managed-client portfolio","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ManagedAccountProvisioning"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Partner"],"operationId":"createPartnerManagedAccount","summary":"Provision a paid-required client-owned account","security":[{"PartnerProvisioningCredential":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerManagedAccountCreateRequest"}}}},"responses":{"201":{"description":"Client provisioned in preparing state; no owner invitation has been sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountProvisioningCreated"}}}},"200":{"description":"Exact idempotent replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountProvisioningCreated"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/partner/managed_accounts/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Partner"],"operationId":"getPartnerManagedAccount","security":[{"PartnerProvisioningCredential":[]}],"summary":"Get one manager-scoped portfolio row","responses":{"200":{"description":"Managed-client portfolio row","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountProvisioning"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/partner/managed_accounts/{id}/resend_invitation":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Partner"],"operationId":"resendPartnerManagedAccountInvitation","security":[{"PartnerProvisioningCredential":[]}],"summary":"Invalidate the prior invitation and queue a bounded replacement for owner-only delivery","responses":{"200":{"description":"Updated portfolio row; no invitation capability is returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountProvisioning"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/v1/partner/managed_accounts/{id}/send_invitation":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Partner"],"operationId":"sendPartnerManagedAccountInvitation","security":[{"PartnerProvisioningCredential":[]}],"summary":"Queue the first bounded owner invitation after client setup is ready","responses":{"200":{"description":"Updated portfolio row; no invitation capability is returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedAccountProvisioning"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/v1/partner/managed_accounts/{provisioning_id}/credentials":{"parameters":[{"name":"provisioning_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Manager-scoped provisioning row id."}],"get":{"tags":["Partner"],"operationId":"listPartnerManagedAccountCredentials","security":[{"PartnerProvisioningCredential":[]}],"summary":"List non-secret agent credential metadata for one managed client","responses":{"200":{"description":"Agent credential metadata; plaintext secrets are never listed","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccountManagementCredential"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"tags":["Partner"],"operationId":"createPartnerManagedAccountCredential","security":[{"PartnerProvisioningCredential":[]}],"summary":"Issue one grant- and Brand-pinned agent credential","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountManagementCredentialCreateRequest"}}}},"responses":{"201":{"description":"One-time credential result; the secret cannot be recovered","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"Always includes no-store"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountManagementCredentialIssued"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/partner/managed_accounts/{provisioning_id}/credentials/{id}":{"parameters":[{"name":"provisioning_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Manager-scoped provisioning row id."},{"$ref":"#/components/parameters/ResourceId"}],"delete":{"tags":["Partner"],"operationId":"revokePartnerManagedAccountCredential","security":[{"PartnerProvisioningCredential":[]}],"summary":"Revoke one agent credential immediately","responses":{"200":{"description":"Revoked credential metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountManagementCredential"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/account/management_grant":{"get":{"tags":["Account"],"operationId":"getCurrentAccountManagementGrant","summary":"Get the current account's pending or active management grant","description":"Only the canonical owner of the selected managed account may use this endpoint.","responses":{"200":{"description":"Current management grant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountManagementGrant"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/account/management_grant/confirm":{"post":{"tags":["Account"],"operationId":"confirmAccountManagementGrant","summary":"Reconcile a consented, paid managed-account grant","description":"This endpoint cannot record owner consent or bypass paid activation.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountManagementGrantCommand"}}}},"responses":{"200":{"description":"Active management grant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountManagementGrant"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The grant cannot transition from its current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/account/management_grant/revoke":{"post":{"tags":["Account"],"operationId":"revokeAccountManagementGrant","summary":"Revoke an exact pending or active management grant","description":"Revocation takes effect on the next REST or MCP request and is idempotent for the exact grant.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountManagementGrantCommand"}}}},"responses":{"200":{"description":"Revoked management grant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountManagementGrant"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The grant cannot transition from its current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/account/team":{"get":{"tags":["Account"],"operationId":"getAccountTeam","summary":"Get team metadata for the current account","responses":{"200":{"description":"Team metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountTeam"}}}}}}},"/v1/my/account/reach":{"get":{"tags":["Account"],"operationId":"getAccountReach","summary":"How far one send to an audience gets on the current plan","description":"Read-only. Reports the recipients per day at the account's sending standing and the emails left this month on the current plan, whether they cover a full send to the audience, and the cheapest listed plan whose first month would. The numbers come from the plan catalog and this month's usage; the summary sentence is the one every surface shows. Silent (no summary, no recommendation) when the current plan covers the audience.","parameters":[{"name":"audience","in":"query","required":true,"schema":{"type":"integer","minimum":1},"description":"Number of recipients of one full send"}],"responses":{"200":{"description":"Reach on the current plan and the recommended plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceReach"}}}},"422":{"description":"audience is not a positive whole number (error_code audience_invalid)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/account/memberships":{"get":{"tags":["Account"],"operationId":"listAccountMemberships","summary":"List account memberships (paginated)","parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"per","in":"query","schema":{"type":"integer","default":100,"maximum":100}}],"responses":{"200":{"description":"Memberships","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccountMembership"}}}}}}}},"/v1/my/account/memberships/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"patch":{"tags":["Account"],"operationId":"updateAccountMembership","summary":"Update a membership role","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["member","admin"]}}}}}},"responses":{"200":{"description":"Updated membership","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountMembership"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}},"delete":{"tags":["Account"],"operationId":"removeAccountMembership","summary":"Remove a membership","responses":{"200":{"description":"Removed membership","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountMembership"}}}}}}},"/v1/my/invoices/{id}/download":{"get":{"tags":["Billing"],"operationId":"downloadInvoice","summary":"Download an account invoice","description":"Returns the original Stripe invoice PDF for an invoice in the current\naccount. Requires account owner or admin access. The response is inline\napplication/pdf with Cache-Control private, no-store. The existing\ntrailing-slash and .pdf URL forms return the same document.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Original invoice PDF","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"Invoice not found in the current account, ownership cannot be verified, or no Stripe PDF is available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"The invoice document could not be retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/enterprise_requests":{"post":{"tags":["Billing"],"operationId":"createEnterpriseRequest","summary":"Ask the Nitrosend team about Enterprise","description":"Sends the signed-in member's Enterprise request, with the account's context, to the Nitrosend team. Each member can send one request per UTC day; a repeat answers with their first request (replayed true). Agency (delegated) sessions are refused.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnterpriseRequestInput"}}}},"responses":{"201":{"description":"Request received","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnterpriseRequestReceipt"}}}},"200":{"description":"This member already sent a request today; the receipt is for that request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnterpriseRequestReceipt"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError","description":"A field has the wrong shape or is out of range (error_code enterprise_request_invalid, with validation_errors per field)."},"503":{"description":"The request could not be sent to the team, so it was not kept (error_code enterprise_request_unrecorded); email contact@nitrosend.com instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/subscription":{"get":{"tags":["Billing"],"operationId":"getSubscription","summary":"Read the current subscription","description":"Owners and admins read the full subscription; other members are\nrefused. An agency operator working in a client account it manages\n(delegated access holding `billing.plan_purchase`) reads the delegated\nprojection instead: the plan, its status and the billing route, which\nis what buying the client's first plan from Setup mode needs, with no\npayment, invoice, discount, spend cap or renewal details. A management\ncredential reads the same projection.\n","responses":{"200":{"description":"The current subscription, or null when the account has none","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Subscription"},{"$ref":"#/components/schemas/DelegatedSubscription"},{"type":"null"}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Billing"],"operationId":"createSubscription","summary":"Create a subscription","description":"Buys a paid base plan by card (`stripe_token`), always as a new\nsubscription. Owners and admins can buy any plan the account is\noffered, with an optional coupon.\n\nAn agency operator working in a client account it manages (delegated\naccess holding `billing.plan_purchase`) can buy only the client's\nfirst plan: Starter or above, by card, while the account is in Setup\nmode, sending `plan_id` and `stripe_token` and nothing else. Any other\nfield, a coupon included, is refused before Stripe is called. The\nsubscription stays on the client account, the card is saved to the\naccount owner's Stripe customer and invoices go to the owner's email.\nOnly a person signed in to Nitrosend can buy this way: a management\ncredential cannot. The response is the delegated subscription\nprojection.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionCreateRequest"}}}},"responses":{"201":{"description":"Subscription created","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Subscription"},{"$ref":"#/components/schemas/DelegatedSubscription"}]}}}},"403":{"description":"Not allowed for this caller: billing is managed by another provider (error_code manage_on_shopify or billing_provider_unavailable), the caller is not an owner or admin, or an agency purchase is outside its limits (error_code delegated_purchase_refused, with a message written for the customer: the account is not in Setup mode, the plan is not Starter or above, the request sent more than plan_id and stripe_token or no card token, or the caller is an agent credential).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound","description":"The plan is not available to this account, including Free for an agency or a client account an agency created."},"409":{"$ref":"#/components/responses/Conflict","description":"Another upgrade for this account is still being processed, or the account already pays for a plan through Stripe (error_code plan_checkout_pending, with a message written for the customer)."},"422":{"$ref":"#/components/responses/ValidationError","description":"Validation failed, or the card was declined (error_code payment_declined, with a message written for the customer). When the customer's bank asked to verify the payment (3D Secure) and the caller is the account's own owner or admin (not an agency operator, who can't open hosted checkout), the error also has recovery_action (StartHostedCheckoutAction) naming the plan; start POST /v1/my/subscription/checkout for that plan with new_subscription and the same coupon_code to finish on Stripe's hosted checkout, which runs the bank's check."}}},"delete":{"tags":["Billing"],"operationId":"cancelSubscription","summary":"Cancel the current paid plan at its period end","description":"Schedules the current paid plan to end at its period end, using the\naccount's Free plan as the cancellation marker. An agency, or a client\naccount an agency created, is never sold Free: when its canceled plan\nends it returns to its Setup subscription. The Setup subscription itself\ncannot be canceled.\n","responses":{"200":{"description":"Cancellation scheduled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"403":{"description":"Billing for this account is managed by another provider (error_code manage_on_shopify or billing_provider_unavailable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound","description":"There is no paid plan this account can cancel here."},"409":{"$ref":"#/components/responses/Conflict","description":"A plan change for this account is still being processed (error_code plan_checkout_pending, with a message written for the customer)."},"422":{"description":"The account is on Setup mode, which has no subscription to cancel (error_code setup_mode_not_cancellable, message \"Setup mode has no subscription to cancel.\").","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/subscription/change":{"put":{"tags":["Billing"],"operationId":"changeSubscriptionPlan","summary":"Change the current subscription plan","description":"Changes an existing plan. Free is not available to an agency or a client\naccount an agency created. A Setup subscription is never changed: leave\nSetup by buying a plan with POST /v1/my/subscription or\n/v1/my/subscription/checkout, which create a new subscription.\nA subscription with no Stripe subscription (a comped or other unpaid\nplan) moves to a paid plan with `stripe_token`: the paid plan starts on\nthe same subscription with that card, and any comp ends.\nA 200 returns the resulting subscription. Confirm the requested plan\n(or its scheduled change) from it: a change the account can't make\nright now returns the subscription unchanged.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionChangeRequest"}}}},"responses":{"200":{"description":"Subscription updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"400":{"$ref":"#/components/responses/BadRequest","description":"The change cannot be applied, including any change from Setup mode (message \"Choose a plan to leave Setup mode.\"), and a `stripe_token` for a plan this account can change to when the change doesn't start a Stripe subscription (a subscription Stripe already bills, its current plan, or Free). A plan the account can't change to answers 404 first, with or without a token."},"404":{"$ref":"#/components/responses/NotFound","description":"The plan is not available to this account, including Free for an agency or a client account an agency created."},"409":{"$ref":"#/components/responses/Conflict","description":"Another upgrade or plan change for this account is still being processed (error_code plan_checkout_pending, with a message written for the customer)."},"422":{"$ref":"#/components/responses/ValidationError","description":"Validation failed, or the card was declined (error_code payment_declined, with a message written for the customer)."}}}},"/v1/my/subscription/checkout":{"post":{"tags":["Billing"],"operationId":"checkoutSubscription","summary":"Start a subscription checkout","description":"Creates or replays one account-scoped plan purchase through the\nauthoritative billing provider. A Stripe-backed active subscription is\nchanged in place within the same product. Optional account features\nhave independent recurring subscriptions and never replace the base plan.\nOmitted product_key selects the base plan. Use an available product key\nreturned for this account. A feature is saleable only through\na rail that explicitly supports it.\nShopify-managed accounts receive a Shopify-hosted approval URL and\nnever receive a Stripe checkout URL.\n","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional stable retry key. The server also reuses an open same-plan checkout.","schema":{"type":"string","maxLength":128}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["plan_id"],"properties":{"plan_id":{"type":"integer"},"product_key":{"type":"string","enum":["base_plan","brand_capacity","domain_capacity","seat_capacity","footer_removal"],"default":"base_plan"},"quantity":{"type":"integer","minimum":1,"maximum":10000,"default":1,"description":"Units for a quantity-based offer returned by features. Other offers require one. Bound to the idempotency key."},"idempotency_key":{"type":"string","maxLength":128,"description":"Optional body form of Idempotency-Key for compatibility."},"new_subscription":{"type":"boolean","default":false,"description":"The caller is buying this product's first paid plan, such as a bank check the card form couldn't run (StartHostedCheckoutAction). A purchase that would change or cancel the account's current plan is refused with 409 instead of made, and a hosted checkout left open by an earlier attempt is closed first."},"coupon_code":{"type":"string","description":"A coupon for the base plan's hosted checkout, applied as the card form would have applied it. Needs new_subscription; an invalid coupon, or one on any other purchase, is refused with 422. Bound to the idempotency key exactly as sent."}}}}}},"responses":{"200":{"description":"Subscription changed without external approval","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"201":{"description":"Provider-hosted checkout created","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"403":{"description":"Billing provider is not ready for checkout, or an account feature needs an active paid base plan first (error_code base_plan_required; on Setup mode every feature waits for a paid base plan)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Requested plan is not available, including Free for an agency or a client account an agency created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Another checkout is pending, the idempotency key conflicts, or (with new_subscription) the account already has another paid plan (error_code plan_checkout_pending)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Shopify rejected the requested billing terms, or the coupon is invalid or can't apply (validation_errors.coupon_code)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The billing provider could not be reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/subscription/checkout_status":{"get":{"tags":["Billing"],"operationId":"getSubscriptionCheckoutStatus","summary":"Reconcile and read a plan purchase","description":"Reads the requested plan while approval is pending. Stripe and Shopify\nare read back before the local state is returned. Omit purchase_id to\ninspect the latest pending checkout or current subscription for that product.\n","parameters":[{"name":"product_key","in":"query","schema":{"type":"string","enum":["base_plan"],"default":"base_plan"}},{"name":"purchase_id","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Reconciled plan purchase status","content":{"application/json":{"schema":{"type":"object","required":["has_subscription","activated","billing_provider","billing_route"],"properties":{"purchase_id":{"type":["integer","null"]},"subscription_id":{"type":["integer","null"]},"has_subscription":{"type":"boolean"},"status":{"type":["string","null"]},"activated":{"type":"boolean"},"plan_name":{"type":["string","null"]},"provider_status":{"type":["string","null"]},"checkout_url":{"type":["string","null"],"format":"uri"},"approval":{"type":["object","null"],"additionalProperties":true},"billing_provider":{"type":"string"},"billing_route":{"type":"object","additionalProperties":true},"manage_url":{"type":["string","null"],"format":"uri"},"entitlements":{"type":["object","null"],"additionalProperties":true},"next_action":{"type":"string"}}}}}},"404":{"description":"Requested plan purchase was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Provider state could not be verified","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/billing/funding":{"get":{"tags":["Billing"],"operationId":"getFundingStatus","summary":"Read the current prepaid funding projection and available instruments","responses":{"200":{"description":"Current prepaid funding status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundingStatus"}}}}}}},"/v1/my/billing/funding/purchases":{"post":{"tags":["Billing"],"operationId":"createFundingPurchase","summary":"Start an add-funds purchase with an optional hosted instrument","description":"Creates or replays one local funding purchase. Current public\ninstruments return a provider-hosted approval URL. No request-side\ncredential field is exposed by this endpoint.\n","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":128}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundingPurchaseCreateRequest"}}}},"responses":{"200":{"description":"Existing idempotent funding purchase","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundingPurchaseResponse"}}}},"201":{"description":"Funding purchase created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundingPurchaseResponse"}}}},"409":{"description":"Idempotency key was used for different funding input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Amount or selected funding instrument is unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/billing/funding/purchases/{id}":{"get":{"tags":["Billing"],"operationId":"getFundingPurchase","summary":"Read an account-scoped funding purchase","parameters":[{"name":"id","in":"path","required":true,"description":"Local purchase ID or opaque Stripe Checkout Session ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Funding purchase status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundingPurchaseResponse"}}}},"404":{"description":"Funding purchase not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/subscription/coupon_preview":{"post":{"tags":["Billing"],"operationId":"previewSubscriptionCoupon","summary":"Preview a promotion code or coupon for a subscription plan","description":"Validates a customer-entered Stripe promotion code or coupon ID against\na paid plan and returns display totals for the checkout summary. The\nfinal subscription create/change request must still send `coupon_code`;\npreview data is not trusted as payment input.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionCouponPreviewRequest"}}}},"responses":{"200":{"description":"Coupon preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionCouponPreview"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/account/invites":{"get":{"tags":["Account"],"operationId":"listAccountInvites","summary":"List account invites (paginated)","parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"per","in":"query","schema":{"type":"integer","default":100,"maximum":100}}],"responses":{"200":{"description":"Invites","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccountInvite"}}}}}}},"post":{"tags":["Account"],"operationId":"createAccountInvite","summary":"Create an account invite","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["member","admin"]}}}}}},"responses":{"201":{"description":"Created invite","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountInvite"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/account/invites/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"delete":{"tags":["Account"],"operationId":"revokeAccountInvite","summary":"Revoke an invite","responses":{"200":{"description":"Revoked invite","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountInvite"}}}}}}},"/v1/my/account/invites/{id}/accept":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"tags":["Account"],"operationId":"acceptAccountInvite","summary":"Accept an invite token","responses":{"200":{"description":"Accepted invite","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountInvite"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/join_request":{"get":{"tags":["Account"],"operationId":"getJoinRequest","summary":"Whether there is a workspace you can ask to join","description":"About the signed-in person, not the current account. A workspace is offered when it holds the domain of your sign-in email, someone who runs it has an address at that domain too, and either the domain is verified or that person's mailbox is proven. Only a login that verified its email at signup can ask. Nothing about the workspace is returned until a request has been approved. Requires your own signed-in session: API keys and delegated or embedded sessions get 403.","parameters":[{"name":"domain","in":"query","required":false,"schema":{"type":"string"},"description":"The `domain` from a `domain_ownership_conflict` error. When it is under your email domain, the workspace holding that exact name is the only one considered. `request` is your latest request of that workspace, through whichever of its domains you made it."}],"responses":{"200":{"description":"Availability and your latest request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JoinRequestAvailability"}}}},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Account"],"operationId":"createJoinRequest","summary":"Ask to join the workspace that holds your email domain","description":"Records the request and emails a confirm link to your sign-in address. The workspace hears nothing until you confirm. Asking again while a link is outstanding sends it again; one request per workspace is open at a time, whichever of its domains you ask through, and a declined request cannot be repeated for 30 days. An open request is returned as it stands, with the `domain` it was first made for.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string","description":"The `domain` from a `domain_ownership_conflict` error."}}}}}},"responses":{"201":{"description":"Confirm link sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JoinRequestReceipt"}}}},"200":{"description":"Already confirmed and waiting on the workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JoinRequestReceipt"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"description":"No workspace to ask (`error_code` `join_request_unavailable`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/my/join_request/confirm":{"post":{"tags":["Account"],"operationId":"confirmJoinRequest","summary":"Confirm a request to join with the emailed token","description":"Proves both the login and the mailbox: it must be called from the session of the person who asked, with the token from the confirm email. Only then are the workspace's owner and admins told. Confirming twice returns the same state.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string"}}}}}},"responses":{"200":{"description":"Confirmed and waiting on the workspace","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["pending"]},"domain":{"type":"string"}}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"410":{"description":"The link is invalid, expired or not yours (`error_code` `join_request_link_invalid`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/my/account/join_requests/{id}/approve":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Account"],"operationId":"approveAccountJoinRequest","summary":"Approve a request to join this workspace","description":"Adds the person as a member. An invite already out to them is taken up, for its seat only. For a direct owner or admin in their own signed-in session. Seats apply as they do to invites.","responses":{"200":{"description":"Approved request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountJoinRequest"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"Not approved. `error_code` is `seat_limit_reached`, `not_pending`, `not_eligible` or `not_allowed`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/account/join_requests/{id}/decline":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Account"],"operationId":"declineAccountJoinRequest","summary":"Decline a request to join this workspace","description":"The person is not told. They cannot ask this workspace again for 30 days.","responses":{"200":{"description":"Declined request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountJoinRequest"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"Not declined (`error_code` `not_pending` or `not_allowed`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/contacts":{"get":{"tags":["Contacts"],"operationId":"listContacts","summary":"List contacts (paginated)","parameters":[{"$ref":"#/components/parameters/PageParam"},{"name":"limit","in":"query","schema":{"type":"integer","default":50,"maximum":100}},{"name":"search","in":"query","schema":{"type":"string"},"description":"Full-text search across name, email, phone"},{"name":"filters","in":"query","style":"deepObject","explode":true,"schema":{"$ref":"#/components/schemas/SegmentFilterExpression"},"description":"Canonical structured audience filters from the registry exposed by\n`/v1/my/flows/spec` and `nitro://schema`. `search` remains a separate\nfull-text lookup; filters are applied through the same fail-closed\nvalidator used for segments.\n"},{"name":"list_id","in":"query","schema":{"type":"integer"},"description":"Legacy shortcut for a `contact_list in [id]` filter."},{"name":"tag","in":"query","schema":{"type":"string"},"description":"Legacy shortcut for a `contact_tag eq tag` filter. Tags are stored\nas an array of strings under `data.tags`. For richer tag targeting,\nuse canonical `filters`.\n"},{"name":"sort","in":"query","schema":{"type":"string","enum":["created_at","emails_sent","unique_opens","clicks","open_rate","click_rate","last_opened_at","last_clicked_at","rating"]},"description":"Column to sort by. `created_at` orders by the contact's creation date;\nthe rest are the per-contact engagement rollup fields (see\n`Contact.engagement`). Contacts with no rollup row always sort last.\nAny unrecognized value falls back to the default newest-first order.\n"},{"name":"direction","in":"query","schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"description":"Sort direction. Only applies when `sort` is set."}],"responses":{"200":{"description":"Paginated contacts","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}}}}},"503":{"$ref":"#/components/responses/QueryTimeout"}}},"post":{"tags":["Contacts"],"operationId":"createContact","summary":"Create a contact","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email","description":"Normalized to lowercase. Email is what identifies a contact in a brand: if a contact in this brand already has this email, that contact is updated (200) instead of duplicated, whatever phone is submitted. Creates/updates the email channel with opt_in."},"phone":{"type":"string","description":"E.164 format. Creates/updates the phone channel with opt_in. A phone is not an identity: several contacts in a brand may share one (a household, a reception line), so submitting a phone another contact holds never conflicts. With no email, the phone updates an existing contact only when exactly one contact in the brand holds it; when several do, the request is rejected (422, validation_errors.phone) and must include an email, or update a specific contact with PATCH /v1/my/contacts/{id}."},"source":{"type":"string"},"country_code":{"type":"string"},"opt_in":{"type":"boolean","nullable":true,"description":"Consent for supplied email/phone channels. Omitted or null preserves existing subscription state; a new email keeps the collection default and a new phone needs opt-in. True explicitly opts in without removing suppression. False opts an existing channel out; a new channel starts without consent."},"list_ids":{"type":"array","items":{"type":"integer"}},"data":{"type":"object","additionalProperties":true,"description":"Custom key-value data. The reserved key `tags` holds an\narray of string labels used for segmentation, e.g.\n`{\"tags\": [\"vip\", \"newsletter\"]}`.\n\n**Merge-on-resolve behavior (create path only):** when the\nsubmitted email (or, with no email, a phone held by exactly\none contact) resolves to an existing contact, `data` is merged into the contact's existing data\nrather than replaced. Blank incoming values are ignored;\ncaller-supplied non-reserved keys overwrite their\ncounterparts; the reserved enrichment keys `apollo`, `pdl`,\n`attio`, `hubspot`, `stripe`, `shopify`, and `nitro` are\npreserved from the stored contact;\nand `tags` from both sides are unioned. The update endpoint\n(`PATCH /v1/my/contacts/{id}`) uses the same merge, except\nthat a supplied `tags` array replaces the tag set.\n","example":{"tags":["vip","newsletter"],"plan":"pro"}},"channels_attributes":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["email","phone"]},"value":{"type":"string"},"subscribed":{"type":"boolean"}}}}}}}}},"responses":{"200":{"description":"Existing contact updated in place. Returned when the submitted email\nbelongs to a contact in this brand or, with no email, when exactly\none contact in this brand holds the submitted phone.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"201":{"description":"Contact created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/contacts/bulk":{"post":{"tags":["Contacts"],"operationId":"bulkContacts","summary":"Apply an action to selected contacts","description":"Applies only to contacts in the current brand. Unsubscribe email stops that brand's marketing and retains the choice after contact deletion. SMS subscriptions and other brands are unchanged. Delete can target `match` (the contacts index's own filter params) instead of `ids`, and `dry_run` previews the count and wording. A `match` delete is confirmed with the preview's `selection_digest` and deletes exactly the contacts that preview counted; if they changed, it returns 422 `selection_changed` and deletes nothing. A delete selects at most 100,000 contacts (422 `too_many`). Deleting keeps unsubscribes, bounces and complaints. A delete of more than 100 contacts runs in the background (202) and emails the account owner when it's done. Contacts still in use, such as in email conversations or an email verification that is still running, are kept and counted in `kept`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["action_type"],"properties":{"action_type":{"type":"string","enum":["add_to_list","remove_from_list","delete","unsubscribe_email"]},"ids":{"type":"array","items":{"type":"integer"},"description":"Required unless `match` is sent. Send one of `ids` or `match`."},"list_id":{"type":"integer","description":"Required for add_to_list and remove_from_list."},"match":{"type":"object","additionalProperties":false,"description":"Delete only. Selects the contacts `GET /v1/my/contacts` returns for the same params. `{}` selects every contact in the brand. Any other key is rejected with 422.","properties":{"search":{"type":"string"},"filters":{"$ref":"#/components/schemas/SegmentFilterExpression"},"list_id":{"type":"integer"},"tag":{"type":"string"},"source":{"type":"string"}}},"dry_run":{"type":"boolean","description":"Delete only. Returns the count and confirmation wording without deleting."},"selection_digest":{"type":"string","description":"Delete with `match` only, and required there. The `selection_digest` from the dry run being confirmed."}}}}}},"responses":{"200":{"description":"Action completed, or a delete dry run","content":{"application/json":{"schema":{"type":"object","required":["action"],"properties":{"affected":{"type":"integer"},"action":{"type":"string"},"list_id":{"type":"integer"},"status":{"type":"string","enum":["done"]},"dry_run":{"type":"boolean"},"kept":{"type":"integer","description":"Delete only. Contacts kept because they are still in use, such as in email conversations or an email verification that is still running."},"contact_count":{"type":"integer","description":"Delete only. Contacts selected."},"selection_digest":{"type":"string","description":"Delete dry run only. Send it back to confirm a `match` delete."},"message":{"type":"string","description":"Delete only. What happened or will happen","for display.":null}}}}}},"202":{"description":"Delete of more than 100 contacts queued to run in the background","content":{"application/json":{"schema":{"type":"object","required":["action","status","contact_count","message"],"properties":{"action":{"type":"string","enum":["delete"]},"status":{"type":"string","enum":["queued"]},"contact_count":{"type":"integer"},"message":{"type":"string"}}}}}},"422":{"description":"Invalid action, invalid match or filters, or no matching contacts. For delete, `code` is also `selection_required` (a `match` confirm without a digest), `selection_changed` (the contacts changed since the preview) or `too_many` (over 100,000)."}}}},"/v1/my/contacts/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Contacts"],"operationId":"getContact","summary":"Get a contact","responses":{"200":{"description":"Contact with channels","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Contacts"],"operationId":"updateContact","summary":"Update a contact","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email","description":"Adds or updates a channel for this address; it does not replace another email channel. Use channels_attributes with an existing id and value to correct that channel in place. An address owned by a different contact in the brand is rejected (422)."},"phone":{"type":"string","description":"E.164 format. Several contacts in a brand may share a phone, so a phone another contact holds is accepted."},"source":{"type":"string"},"country_code":{"type":"string"},"opt_in":{"type":"boolean","nullable":true,"description":"Consent for supplied email/phone channels. Omitted or null preserves existing subscription state. True explicitly opts in without removing suppression; false explicitly opts out."},"list_ids":{"type":"array","items":{"type":"integer"}},"data":{"type":"object","additionalProperties":true,"description":"Custom key-value data. The reserved key `tags` holds an\narray of string labels used for segmentation — e.g.\n`{\"tags\": [\"vip\", \"newsletter\"]}`.\n\nCustom keys merge into current data; omitted or blank\nvalues preserve existing data. Existing reserved enrichment\nnamespaces, including `apollo`, `pdl`, `attio`, `hubspot`,\n`stripe`, `shopify`, and derived `nitro`, are protected.\nA supplied `tags` array replaces the editable tag set;\n`[]` clears tags, and omitting `tags` preserves them.\nSend only intended changes. For add/remove tag semantics across\nmany contacts, use the `nitro_manage_audience` MCP tool\nwith `operation: \"bulk_tag\"`.\n","example":{"tags":["vip","newsletter"],"plan":"pro"}},"channels_attributes":{"type":"array","description":"Supply an existing channel id and value to correct its address in place. Email correction preserves current consent without a new opt-in event, retains old-address stops, applies new-address stops, and clears old-address verification and delivery-failure state.","items":{"type":"object","properties":{"id":{"type":"integer"},"kind":{"type":"string","enum":["email","phone"]},"value":{"type":"string"},"subscribed":{"type":"boolean","description":"Explicit consent change for this channel. Omission preserves state. A replacement phone number requires a fresh opt-in; suppression cannot be removed by opting in."},"_destroy":{"type":"boolean"}}}}}}}}},"responses":{"200":{"description":"Updated contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}},"delete":{"tags":["Contacts"],"operationId":"deleteContact","summary":"Delete a contact","responses":{"200":{"description":"Deleted contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}}}}},"/v1/my/contacts/enrichment/quote":{"post":{"tags":["Contacts"],"operationId":"quoteContactProfileEnrichment","summary":"Quote profile enrichment for Contacts or supplied Leads","description":"Resolves already-current and same-Brand reusable profile evidence before\nprovider work. This endpoint never calls a provider or reserves money.\nProfile enrichment is priced per successful outcome and has no\nplan-included allowance.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileEnrichmentAudience"}}}},"responses":{"200":{"description":"Exact maximum-charge quote and work classification","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactEnrichmentQuote"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/contacts/enrichment":{"post":{"tags":["Contacts"],"operationId":"enrichContactProfiles","summary":"Queue profile enrichment for Contacts or supplied Leads","description":"Holds the quoted maximum, then queues bounded profile work. Current\nevidence is skipped without charge. Fresh same-Brand evidence and usable\nprovider results each commit one outcome; no-match and failures void the\nhold. This operation does not verify, subscribe, suppress, or qualify an\nemail channel.\n","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1,"maxLength":128}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileEnrichmentAudience"}}}},"responses":{"200":{"description":"Exact idempotent replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactEnrichmentDispatch"}}}},"202":{"description":"Enrichment queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactEnrichmentDispatch"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"Account funding changed before the enrichment hold was created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactEnrichmentFundingRequired"}}}},"409":{"description":"Idempotency-Key reused with different Contact IDs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/contacts/{id}/timeline":{"get":{"tags":["Contacts"],"operationId":"getContactTimeline","summary":"Unified activity timeline for a contact","description":"Read-only, keyset-paginated feed merging the contact's lifecycle\n`events` and email `activities` into one chronological stream (newest\nfirst). Entries are normalized and whitelisted — raw rows are never\nexposed. Page using the `cursor` returned as `next_cursor`.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"description":"Opaque keyset cursor from a prior `next_cursor`.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":25,"maximum":100}}],"responses":{"200":{"description":"A page of timeline entries, newest first","headers":{"X-Next-Cursor":{"description":"Present when more entries remain.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/TimelineEntry"}},"next_cursor":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/my/contacts/{id}/enrichment":{"get":{"tags":["Contacts"],"operationId":"getContactEnrichment","summary":"Enrichment facts for a contact","description":"Read-only enrichment facts resolved into display rows. Facts sourced from\nan integration you have connected are attributed with that integration's\nname; facts from other sources are returned unattributed.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"The contact's resolved enrichment rows","content":{"application/json":{"schema":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"value":{},"group":{"type":"string","enum":["professional","company","location","contact_intelligence","other"]},"display_value":{"type":"string","description":"Human-readable value using the field catalog's shared presentation contract."},"value_type":{"type":"string"},"confidence":{"type":"number","nullable":true},"stale":{"type":"boolean"},"synced_at":{"type":"string","format":"date-time","nullable":true},"integration_label":{"type":"string","nullable":true,"description":"Present only for facts from a connected integration."}}}},"field_count":{"type":"integer"},"summary":{"type":"object","properties":{"field_count":{"type":"integer"},"stale_count":{"type":"integer"},"latest_synced_at":{"type":"string","format":"date-time","nullable":true},"groups":{"type":"object","additionalProperties":{"type":"integer"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/my/contacts/fields":{"get":{"tags":["Contacts"],"operationId":"listContactFields","summary":"List the field catalog for this account","description":"Returns the structured field catalog: one row per known field for this account,\nwith key, category, type, label, promotion state, and async fill-rate.\nFields are lazily registered the first time a key is seen (import, API write,\nor enrichment). Use `PATCH /v1/my/contacts/fields/:id` to update `promoted`\nor `label`.\n","responses":{"200":{"description":"Field catalog rows ordered by category and label","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FieldCatalog"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/my/contacts/fields/{id}":{"patch":{"tags":["Contacts"],"operationId":"updateContactField","summary":"Update a field catalog row (owner/admin only)","description":"Updates the `promoted` flag and/or the human-readable `label` for a field\ncatalog row. Restricted to account owners and admins. The `key`, `category`,\nand `field_type` of a row are immutable.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"promoted":{"type":"boolean","description":"Pin this field as a default column in the contacts grid."},"label":{"type":"string","description":"Override the human-readable label for this field."}}}}}},"responses":{"200":{"description":"Updated field catalog row","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FieldCatalog"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/images":{"post":{"tags":["Templates"],"operationId":"ingestImage","summary":"Ingest an image media asset","description":"REST adapter over the same image ingest capability used by MCP. Send\nexactly one source: `image_data`, `image_url`, multipart `file`, or a\ndirect-upload `signed_id` created with purpose `image` or `media_asset`.\nThe v1 media contract supports `media_kind: image` only.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"image_data":{"type":"string","description":"Raw base64 image bytes or a data URL. PNG, JPEG, GIF, or WebP only; decoded size must be under 10MB."},"image_url":{"type":"string","format":"uri","description":"Public PNG, JPEG, GIF, or WebP URL to ingest when Nitro-hosted permanence is desired."},"signed_id":{"type":"string","description":"Active Storage blob signed ID returned by `/v1/direct_uploads` after uploading bytes with purpose `image` or `media_asset`."},"filename":{"type":"string","description":"Original filename for image_data uploads, or optional filename override for image_url/signed_id sources."},"content_type":{"type":"string","nullable":true,"description":"Optional MIME type hint when image_data is raw base64 rather than a data URL."}}}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"PNG, JPEG, GIF, or WebP file upload. Must be under 10MB."},"filename":{"type":"string","description":"Optional filename override."},"content_type":{"type":"string","nullable":true,"description":"Optional MIME type override."}}}}}},"responses":{"201":{"description":"Ingested image asset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageAsset"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/direct_uploads":{"post":{"tags":["Imports"],"operationId":"createDirectUpload","summary":"Reserve a direct-upload blob","description":"Creates an Active Storage direct-upload reservation and returns a\n`signed_id`, presigned upload URL, and required upload headers. For CSV\nimports, send `purpose: import`, PUT the file bytes to\n`direct_upload.url`, then submit the returned `signed_id` to\n`POST /v1/my/imports`. For image media assets, send `purpose: image`\nor `purpose: media_asset`, PUT the image bytes to `direct_upload.url`,\nthen submit the returned `signed_id` to `POST /v1/my/images`. For a\nfile in an in-app NitroLLM prompt, send `purpose: source` with\na PDF, Word (.docx), TXT or Markdown file of up to 10 MB (10,000,000\nbytes); its type comes from its extension.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DirectUploadCreateRequest"}}}},"responses":{"200":{"description":"Direct-upload reservation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DirectUpload"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/imports":{"get":{"tags":["Imports"],"operationId":"listImports","summary":"List import jobs","parameters":[{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Paginated import jobs","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Import"}}}}}}},"post":{"tags":["Imports"],"operationId":"createImport","summary":"Start a CSV import","description":"Enqueues an import job from an Active Storage direct-upload `signed_id`.\nCreate the blob through `POST /v1/direct_uploads` with `purpose=import`,\nPUT the file to the returned direct-upload URL, then submit the returned\n`signed_id` here. Poll `GET\n/v1/my/imports/{id}` for status, row counts, and row-level errors.\n\nFor contact imports, pass `options` as a JSON object or JSON string\nwith `list_ids` to assign imported contacts to one or more lists,\ne.g. `{\"list_ids\":[88]}`.\n\nImports start no flows unless `options.start_flows` is `true`. Then\neach committed batch starts live New contact flows for the contacts\nthe import creates and live Add to list flows for its new list\nmembers. Without it, the import's `flows_not_started` names the live\nflows it would have started.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["signed_id"],"properties":{"signed_id":{"type":"string","description":"Active Storage blob signed ID returned by `/v1/direct_uploads`."},"resource":{"type":"string","enum":["contacts","leads"],"default":"contacts"},"parser":{"type":"string","enum":["default"],"default":"default"},"dry_run":{"type":"boolean","default":false},"columns":{"description":"CSV target-to-source-header mapping as a JSON object or JSON string. A null or blank target explicitly skips that field.\nDefault contacts CSV supports `email_status`, `email_opt_out` and\nhistorical `opt_in_at` in addition to profile/custom fields.\nRecognizable unsubscribe values are honored even when their column is\nskipped, mapped as custom data or omitted by an older client. Unmapped\npositive values do not assert consent. Dates require an explicit\nmapping when any mapping exists. With no mapping, aliases are read automatically.\n\nStatus cells are trimmed and case-insensitive; values are finite:\n`email_status`: subscribed/true/yes/1 = source-positive;\nunsubscribed/false/no/0/opted out = source-negative.\n`email_opt_out` is inverse: true/yes/1/unsubscribed/opted out = negative;\nfalse/no/0/subscribed = positive. Blank cells mean unspecified.\nAgreeing declarations resolve together. A valid negative wins over\nother conflicting or unknown declarations in the same row with a\nwarning. Otherwise unknown status rejects only that row with\n`invalid_consent`. Mapping the same source to both inverse targets\nrejects rows with a nonblank value rather than inventing an opt-out.\n\nAn explicit negative unsubscribes the named brand/account email\nchannel for new or existing contacts. Email remains the contact identity;\nphone sharing and list resolution are unchanged.\nPositive status and dates are source information, never re-consent.\nOmitted/positive status preserves existing consent. Existing channel\nhistory, including a missing opt-in date, stays unchanged. Delivery suppression remains independently authoritative and is never\ncleared. Imported opt-outs are retained in the existing address stop store.\n\noptions.email_action can unsubscribe all email addresses from\nmarketing, or block all delivery with a manual brand-specific stop.\nNeither mode changes SMS consent or another brand.\n\n`opt_in_at` accepts YYYY-MM-DD (00:00 UTC, day precision) or\nYYYY-MM-DDTHH:MM:SS[.fraction] with Z or a numeric offset (+/-HH:MM or\n+/-HHMM). Invalid calendar/time values, future dates, missing timezone,\nnon-ISO or disagreeing date sources are ignored with a warning; they\nnever discard a valid negative or reject the row. Historical dates\ninitialize new email channels only. A negative-first new email has\nno opt-in date unless supplied; otherwise the existing new-email\ndefault uses supplied history or observation time. Later negatives\npreserve that history and the first opt-out time. Later positives or\ndates cannot undo negatives, within or across flushes. Phone defaults\nare unchanged. With usable phone but no usable email, email consent\nand date facts are ignored with a warning; neither usable still fails\nnormal channel validation.\n","oneOf":[{"type":"object","additionalProperties":{"type":["string","null"]}},{"type":"string"},{"type":"null"}],"example":{"email":"Email","first_name":"First Name","email_status":"Subscribed","email_opt_out":"Unsubscribed","opt_in_at":"Opt In Date"}},"options":{"description":"Import options as a JSON object or JSON string.","oneOf":[{"type":"object","properties":{"email_action":{"type":"string","enum":["unsubscribe","block"],"description":"Optional whole-file action for email in this brand. Omit to preserve subscription choices; recognizable file unsubscribes are always honored."},"list_ids":{"type":"array","items":{"type":"integer"}},"start_flows":{"type":"boolean","default":false,"description":"Start live flows for the contacts this import creates (New contact) and its new list members (Add to list), including existing contacts it adds to a list. Contacts that already existed never enter New contact flows, and contacts already on a list never re-enter its Add to list flows. Only true or false; lead imports and imports with email_action reject it."}}},{"type":"string"}],"example":{"list_ids":[88]}}}}}}},"responses":{"201":{"description":"Import queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Import"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/imports/spec":{"get":{"tags":["Imports"],"operationId":"getImportSpec","summary":"Get import schema metadata","parameters":[{"name":"resource","in":"query","schema":{"type":"string","enum":["contacts","leads"]},"description":"Optional resource name. Omit to list all schemas."}],"responses":{"200":{"description":"Import schema metadata","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ImportSpec"},{"type":"object","additionalProperties":{"$ref":"#/components/schemas/ImportSpec"}}]}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/imports/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Imports"],"operationId":"getImport","summary":"Get import job status","responses":{"200":{"description":"Import job with status, counts, and row errors","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Import"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Imports"],"operationId":"deleteImport","summary":"Delete an import record","responses":{"200":{"description":"Deleted import","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Import"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/imports/{id}/cancel":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Imports"],"operationId":"cancelImport","summary":"Cancel a pending or processing import","responses":{"200":{"description":"Canceled import","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Import"}}}},"422":{"$ref":"#/components/responses/ValidationError"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/exports":{"get":{"tags":["Exports"],"operationId":"listExports","summary":"List export jobs","parameters":[{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Paginated export jobs","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Export"}}}}}}},"post":{"tags":["Exports"],"operationId":"createExport","summary":"Start a contact export","description":"Enqueues an export job that builds a CSV of the brand's contacts and\nattaches it to the export record. The same filters as `GET\n/v1/my/contacts` are supported (`search`, `list_id`, `tag`). Custom\nfields stored on contacts are emitted as additional CSV columns.\n\nPoll `GET /v1/my/exports/{id}` until `ready` is `true`, then download\nthe file from the returned `download_path`.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"resource":{"type":"string","enum":["contacts","leads"],"default":"contacts"},"search":{"type":"string","description":"Free-text filter, matching the contacts list search."},"list_id":{"type":"integer","description":"Restrict the export to contacts in this list."},"tag":{"type":"string","description":"Restrict the export to contacts with this tag."}}}}}},"responses":{"201":{"description":"Export queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Export"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/exports/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Exports"],"operationId":"getExport","summary":"Get an export job","responses":{"200":{"description":"Export job","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Export"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/exports/{id}/download":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Exports"],"operationId":"downloadExport","summary":"Download a completed export file","description":"Returns the CSV file once the export status is `complete`.","responses":{"200":{"description":"CSV file","content":{"text/csv":{"schema":{"type":"string","format":"binary"}}}},"422":{"description":"Export is not ready","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/lists":{"get":{"tags":["Lists"],"operationId":"listLists","summary":"List contact lists (paginated)","parameters":[{"name":"name","in":"query","schema":{"type":"string"},"description":"Exact case-insensitive list name filter"},{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Paginated contact lists","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ContactList"}}}}}}},"post":{"tags":["Lists"],"operationId":"createList","summary":"Create a contact list","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"segment_id":{"type":"integer","nullable":true},"contact_ids":{"type":"array","items":{"type":"integer"}}}}}}},"responses":{"201":{"description":"List created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactList"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/lists/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Lists"],"operationId":"getList","summary":"Get a contact list","responses":{"200":{"description":"Contact list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactList"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Lists"],"operationId":"updateList","summary":"Update a contact list","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"segment_id":{"type":"integer","nullable":true},"contact_ids":{"type":"array","items":{"type":"integer"}}}}}}},"responses":{"200":{"description":"Updated list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactList"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}},"delete":{"tags":["Lists"],"operationId":"deleteList","summary":"Delete a contact list","responses":{"200":{"description":"Deleted list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactList"}}}}}}},"/v1/my/lists/{id}/delete_warning":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Lists"],"operationId":"getListDeleteWarning","summary":"Get delete warning metadata for a contact list","responses":{"200":{"description":"Flows connected to this list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDeleteWarning"}}}}}}},"/v1/my/lists/{id}/contacts/bulk":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Lists"],"operationId":"bulkListContacts","summary":"Add or remove existing contacts from a list by email","description":"Public REST equivalent of the list membership batch primitive. The\nendpoint resolves existing contacts by email within the current brand\nand adds or removes memberships idempotently. It does not create\ncontacts; emails with no current-brand contact are returned in\n`not_found`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkListContactsRequest"}}}},"responses":{"200":{"description":"Bulk list membership result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkListContactsResponse"}}}},"422":{"$ref":"#/components/responses/ValidationError"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/segments":{"get":{"tags":["Segments"],"operationId":"listSegments","summary":"List all segments (paginated)","parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"per","in":"query","schema":{"type":"integer","default":100,"maximum":100}}],"responses":{"200":{"description":"Segments","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Segment"}}}}}}},"post":{"tags":["Segments"],"operationId":"createSegment","summary":"Create a segment","description":"`filters` must contain at least one condition. Empty filters (`[]`,\n`{}` or a group with no conditions) would match every contact, so they\nare rejected with a 422 and `validation_errors.filters`. To reach\nevery contact, target the All contacts audience instead of a segment.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","filters"],"properties":{"name":{"type":"string"},"filters":{"$ref":"#/components/schemas/SegmentFilterExpression"}}}}}},"responses":{"201":{"description":"Segment created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Segment"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/segments/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Segments"],"operationId":"getSegment","summary":"Get a segment","responses":{"200":{"description":"Segment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Segment"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Segments"],"operationId":"updateSegment","summary":"Update a segment","description":"An update cannot remove every filter condition from a segment that has\nconditions; that returns a 422 with `validation_errors.filters`.\nSegments stored without conditions before this rule can still be\nrenamed or re-saved with empty filters.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"filters":{"$ref":"#/components/schemas/SegmentFilterExpression"}}}}}},"responses":{"200":{"description":"Updated segment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Segment"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}},"delete":{"tags":["Segments"],"operationId":"deleteSegment","summary":"Delete a segment","responses":{"200":{"description":"Deleted segment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Segment"}}}}}}},"/v1/my/segments/count":{"post":{"tags":["Segments"],"operationId":"countSegment","summary":"Count contacts matching filters","description":"Preview how many contacts match a set of segment filters\nwithout creating or saving a segment.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"filters":{"$ref":"#/components/schemas/SegmentFilterExpression"}}}}}},"responses":{"200":{"description":"Contact count","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"}}}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/segments/preview":{"post":{"tags":["Segments"],"operationId":"previewSegment","summary":"Preview contacts matching filters","description":"Preview a prospective segment without saving it. Returns a live count,\na bounded contact sample, and bounded overlap with existing segments.\nInvalid filters fail closed with `invalid_filter`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"filters":{"$ref":"#/components/schemas/SegmentFilterExpression"}}}}}},"responses":{"200":{"description":"Segment preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentPreview"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/saved_views":{"get":{"tags":["SavedViews"],"operationId":"listSavedViews","summary":"List saved views visible to the current user","description":"Returns all shared views in the current account plus the caller's own\nprivate views. Optionally filtered by surface.\n","parameters":[{"name":"surface","in":"query","required":false,"schema":{"type":"string","enum":["contacts","sending","activity"]},"description":"Filter views by surface"},{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Saved views","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SavedView"}}}}}}},"post":{"tags":["SavedViews"],"operationId":"createSavedView","summary":"Create a saved view","description":"Creates a new saved view owned by the current user. Defaults to private\nvisibility if not specified.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["surface","name"],"properties":{"surface":{"type":"string","enum":["contacts","sending","activity"]},"name":{"type":"string","maxLength":100},"visibility":{"type":"string","enum":["private","shared"],"default":"private"},"filters":{"$ref":"#/components/schemas/SegmentFilterExpression"},"layout":{"$ref":"#/components/schemas/SavedViewLayout"}}}}}},"responses":{"201":{"description":"Saved view created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedView"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/saved_views/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"patch":{"tags":["SavedViews"],"operationId":"updateSavedView","summary":"Update a saved view","description":"Updates a saved view. Allowed only for the creator or the account owner.\nOther members receive 403.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"visibility":{"type":"string","enum":["private","shared"]},"filters":{"$ref":"#/components/schemas/SegmentFilterExpression"},"layout":{"$ref":"#/components/schemas/SavedViewLayout"}}}}}},"responses":{"200":{"description":"Updated saved view","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedView"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}},"delete":{"tags":["SavedViews"],"operationId":"deleteSavedView","summary":"Delete a saved view","description":"Deletes a saved view. Allowed only for the creator or the account owner.\nOther members receive 403.\n","responses":{"200":{"description":"Deleted saved view","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedView"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/saved_views/{id}/fork":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["SavedViews"],"operationId":"forkSavedView","summary":"Fork a saved view into a new private view","description":"Clones an existing view (typically a shared view) into a new private\nview owned by the caller. The original is not modified.\n","responses":{"201":{"description":"Forked saved view","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedView"}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/workspace/attention":{"get":{"tags":["Workspace"],"operationId":"getWorkspaceAttention","summary":"Read the current brand's next actions and work in progress","description":"Projects existing operational records, actionable items first. Does not\ncreate tasks, count audiences, approve actions or initiate sending.\nChat confirmations are restricted to the authenticated user. Completed\nwork leaves this projection. Each page contains at most 20 items.\n","parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1,"minimum":1,"maximum":100}},{"name":"through","in":"query","description":"Return the prefix through this page to refresh an expanded queue in one read.","schema":{"type":"boolean","default":false}}],"responses":{"200":{"description":"Current actions and next-page pointer (not a total count)","content":{"application/json":{"schema":{"type":"object","required":["items","next_page"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceAttentionItem"}},"next_page":{"type":["integer","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/my/workspace/activity":{"get":{"tags":["Workspace"],"operationId":"getWorkspaceActivity","summary":"Read agent and API control-plane activity for the current brand","description":"Reuses recorded MCP and in-app tool calls plus supported REST mutations.\nReturns up to 25 entries in descending ID order. Prompts, arguments,\nresults and secrets are excluded. Outcome describes the requested\naction, never email delivery. Individual deliveries remain in the\nSending log. Unrecorded historical API operations cannot be reconstructed.\n","parameters":[{"name":"source","in":"query","schema":{"type":"string","enum":["mcp","nitrollm","api"]}},{"name":"outcome","in":"query","schema":{"type":"string","enum":["ok","error","unknown"]}},{"name":"before","in":"query","description":"Read older entries using the previous response's next_cursor.","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Recorded activity and continuation cursor","content":{"application/json":{"schema":{"type":"object","required":["items","next_cursor"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceActivityItem"}},"next_cursor":{"type":["integer","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/my/workspace/search":{"get":{"tags":["Workspace"],"operationId":"searchWorkspace","summary":"Search the current brand beyond locally loaded pages","description":"Returns at most five matches each for campaigns, flows, contact lists\nand contacts. No total counts or audience calculation. A database\nstatement exceeding one second returns a retryable timeout, not a\nmisleading empty result. Queries shorter than two characters return no items.\n","parameters":[{"name":"q","in":"query","schema":{"type":"string","maxLength":100}}],"responses":{"200":{"description":"Bounded matches with application navigation targets","content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"type":"object","required":["id","label","group","type","to"],"properties":{"id":{"type":"string"},"label":{"type":"string"},"group":{"type":"string"},"type":{"type":"string","enum":["campaign","flow","list","contact"]},"to":{"$ref":"#/components/schemas/WorkspaceRoute"}}}}}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"description":"Search timed out; retry without treating this as an empty result."}}}},"/v1/my/campaigns":{"get":{"tags":["Campaigns"],"operationId":"listCampaigns","summary":"List campaigns (paginated)","parameters":[{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Paginated campaigns","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Campaign"}}}}}}},"post":{"tags":["Campaigns"],"operationId":"createCampaign","summary":"Create a campaign","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"channel":{"type":"string","enum":["email","sms"],"default":"email"}}}}}},"responses":{"201":{"description":"Campaign created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/campaigns/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Campaigns"],"operationId":"getCampaign","summary":"Get a campaign","responses":{"200":{"description":"Campaign with trigger, template, and templates","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Campaigns"],"operationId":"updateCampaign","summary":"Update a campaign","description":"Updates the campaign. When the campaign is no longer editable (see the\n`editable` field on the Campaign schema — false for live/paused/\ncompleted/cancelled/archived, and for scheduled campaigns within 5\nminutes of their send time), only name-only payloads and status\ntransitions (Resume, Cancel) are accepted. Any other attribute returns\n422 with `error_code: \"campaign_locked\"`. Use the `/duplicate` endpoint\nto fork a sent campaign into a new draft. In Setup mode a move to\n`live` or `scheduled`, including a resume, returns 402 `plan_required`\nbefore anything changes. Resuming a send the bounce guard stopped\nreturns 422 with `error_code: \"verification_required\"` until every\ncontact it still has to email has a valid verdict from a list\nverification in the last 30 days; the message gives the count.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string"},"status":{"type":"string"},"channel":{"type":"string","enum":["email","sms"]},"scheduled_at":{"type":"string","format":"date-time","nullable":true},"trigger_attributes":{"type":"object","properties":{"event":{"type":"string"},"audience_type":{"type":"string","nullable":true,"enum":["lists","segment","all_contacts"],"description":"Explicit campaign audience target. Use all_contacts only for deliberate all-subscribed-contact sends."},"contact_list_id":{"type":"integer","nullable":true,"deprecated":true},"contact_list_ids":{"type":"array","items":{"type":"integer"}},"segment_id":{"type":"integer","nullable":true},"exclude_segment_ids":{"type":"array","items":{"type":"integer"},"description":"Segment IDs whose matching contacts are excluded; pass [] to clear"},"exclude_contact_list_ids":{"type":"array","items":{"type":"integer"},"description":"Contact list IDs whose members are excluded; pass [] to clear"},"data":{"type":"object","additionalProperties":true}}},"template_attributes":{"type":"object","required":["if_version"],"properties":{"if_version":{"type":"integer","description":"Required optimistic concurrency token for template content writes. Use the current template.version. A stale value returns 409 with current_version and expected_version."},"subject":{"type":"string"},"body":{"type":"string"},"content_format":{"$ref":"#/components/schemas/EmailContentFormat"},"plain_text_mode":{"type":"string","enum":["derived","custom"]},"preheader":{"type":"string"},"from_name":{"type":"string"},"from_email":{"type":"string","format":"email"},"reply_to":{"type":"string","format":"email"},"generation_provenance":{"$ref":"#/components/schemas/GenerationProvenance"},"design":{"oneOf":[{"$ref":"#/components/schemas/EmailDesign"},{"$ref":"#/components/schemas/HtmlEmailSource"}]}}}}}}}},"responses":{"200":{"description":"Updated campaign","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"402":{"$ref":"#/components/responses/PlanRequired"},"422":{"$ref":"#/components/responses/ValidationError"},"409":{"description":"Template version conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Campaigns"],"operationId":"deleteCampaign","summary":"Delete a campaign","responses":{"200":{"description":"Deleted campaign","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}}}}},"/v1/my/campaigns/{id}/duplicate":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Campaigns"],"operationId":"duplicateCampaign","summary":"Duplicate a campaign","description":"Creates a new draft campaign that copies the source's audience\n(trigger.audience_type, contact_list_ids, segment_id,\nexclude_segment_ids, exclude_contact_list_ids) and template\ncontent (design, subject, preheader, body, from_name, from_email,\nreply_to). Resets status to draft, approval_state to pending_review,\nscheduled_at to null, and trigger.event to manual. Works on any\nstatus — this is how clients fork a sent campaign into a new draft.\nSessions, activities, approvals, and metrics are not copied.\n\nPass `cancel_source: true` to atomically cancel the source campaign\nin the same transaction as the duplicate — useful for 'cancel and\nduplicate' flows on paused campaigns.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"cancel_source":{"type":"boolean","default":false,"description":"When true, cancels the source campaign in the same DB transaction as the duplicate creation."}}}}}},"responses":{"201":{"description":"New draft campaign","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/campaigns/{id}/render":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Campaigns"],"operationId":"renderCampaign","summary":"Render a campaign email to HTML","description":"Renders the campaign's current template through the shared preview renderer.","responses":{"200":{"description":"Rendered HTML","content":{"application/json":{"schema":{"type":"object","properties":{"html":{"type":"string"}}}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/campaigns/{id}/readiness":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Campaigns"],"operationId":"getCampaignReadiness","summary":"Read saved campaign readiness and capacity guidance","description":"Read-only structural checks and the deduplicated saved audience count. Capacity warnings are informational, not approval or admission gates. Email drafts also include an informational allowance for new content reviews; previously reviewed content and exempt workloads may remain eligible. Save pending draft changes before requesting this projection.","responses":{"200":{"description":"Structural readiness with optional capacity guidance","content":{"application/json":{"schema":{"type":"object","required":["ready","checks","blocking_issues","authority","note"],"properties":{"ready":{"type":"boolean"},"authority":{"type":"string","const":"structural_readiness_only"},"note":{"type":"string"},"checks":{"type":"array","items":{"type":"object","required":["name","passed","message"],"properties":{"name":{"type":"string"},"passed":{"type":"boolean"},"message":{"type":"string"},"audience_count":{"type":["integer","null"],"minimum":0},"from_email":{"type":"string","description":"Exact From address resolved by the canonical sender resolver."},"recovery_actions":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"label":{"type":"string"},"url":{"type":"string"}}}},"agent_prompt":{"type":"string","description":"For held or blocked flow emails, each one's fix to paste to an agent, joined."},"disclosures":{"type":"array","description":"Each held flow email and its case.","items":{"type":"object","properties":{"action":{"type":"string"},"review_id":{"type":"integer"},"category":{"type":"string"},"agent_prompt":{"type":"string"}}}}}}},"blocking_issues":{"type":"array","items":{"type":"string"}},"capacity_recovery":{"oneOf":[{"$ref":"#/components/schemas/DeliveryCapacityRecovery"},{"type":"null"}]},"review_budget":{"$ref":"#/components/schemas/DeliveryReviewBudgetStatus"},"versions":{"$ref":"#/components/schemas/SubjectVersionOffer"}}}}}},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/QueryTimeout"}}}},"/v1/my/campaigns/{id}/subject_versions":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Campaigns"],"operationId":"requestCampaignSubjectVersions","summary":"Ask for suggested alternatives to the subject line","description":"Asks NitroLLM for suggested alternatives to the campaign's subject line, for its current content. Saving content already asks, so call this only when readiness `versions.status` is `none`. Asking again for the same content changes nothing. Poll readiness for the lines.","responses":{"200":{"description":"The request's state for the current content","content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["none","writing","ready","unavailable"]},"reason":{"type":"string"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/campaigns/{id}/delivery":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Campaigns"],"operationId":"getCampaignDeliveryProgress","summary":"Get current campaign delivery progress","description":"Polls the current campaign send using the same `Campaign::SendProgress`\npayload exposed on the campaign serializer. Active sends return\n`status: \"sending\"` with `poll_after_seconds`; a send waiting for a\nperson's approval returns `status: \"awaiting_approval\"`. Terminal sends\nreturn `status: \"completed\"` or `status: \"failed\"` once the attempt has\nfinished, even if it was stopped first, `status: \"cancelled\"` for a\ncancelled or archived campaign, and `status: \"paused\"` while a stopped\nattempt is retained unfinished (a manual pause or a deliverability\nguard). Campaigns that have not started delivery return\n`status: \"not_started\"`. Polling also refreshes server-side progress:\nqueued reservations older than 15 minutes are marked failed before the\nresponse is returned, so `failed`/`pending` can change on a poll even\nwhen no provider webhook has arrived.\n","responses":{"200":{"description":"Current campaign delivery progress","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDeliveryProgress"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/campaigns/{id}/send_test":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Campaigns"],"operationId":"sendCampaignTestEmail","summary":"Send a test email for a campaign","description":"Thin adapter over the same test-send service used by template tests.\nUse `contact_id` to send directly to a contact, or\n`sample_contact_id` to personalize explicit test recipients without\nsending to that contact. The two contact parameters are mutually\nexclusive.\nTest emails go to the account's own people (owner, members, an active\nmanaging account's people) and to addresses at the account's verified\ndomains. Up to 10 other addresses per 30 days are allowed; past that,\neach refused recipient is reported in `results` with `status: failed`\nand the reason in `error`, and the other recipients still receive the\ntest.\nSupply one fresh `Idempotency-Key` for each user-initiated send and\nreuse that exact key for transport retries.\n","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":128}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"emails":{"type":"array","items":{"type":"string","format":"email"}},"send_test_to":{"type":"array","items":{"type":"string","format":"email"}},"contact_id":{"type":"integer"},"sample_contact_id":{"type":"integer","description":"Contact whose projected data personalizes the test without changing the test recipient."},"event_data":{"type":"object","additionalProperties":true,"description":"Sample data for event fields in this test (max 32KB); never records an Event or Order. Campaign products remain fixed, not event-bound."}}}}}},"responses":{"200":{"description":"Test email sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestSendResult"}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/campaigns/{id}/send":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Campaigns"],"operationId":"sendCampaign","summary":"Send a campaign","description":"Delivers the exact persisted campaign snapshot. Save content, audience,\nand other authoring changes through the campaign update endpoint first.\nThis endpoint rejects authoring fields rather than merging them during\ndelivery. Pass `deliver_at` (RFC 3339) to schedule; omit it to send now.\nBoth `expected_campaign_updated_at` and `template_if_version` are\nrequired so a stale caller cannot send a newer draft accidentally.\nReturns 422 `campaign_locked` if the campaign is not editable\n(live, paused, completed, cancelled, archived, or scheduled within\n5 minutes of send). Returns 409 `duplicate_campaign_schedule` or\n`duplicate_campaign_send` when a repeat attempt would create another\nschedule or overlap an active send; poll `/delivery`, cancel, or edit\nthe existing scheduled campaign instead. In Setup mode a send or a\nschedule returns 402 `plan_required` before anything is approved or\nqueued.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["expected_campaign_updated_at","template_if_version"],"properties":{"expected_campaign_updated_at":{"type":"string","format":"date-time","description":"Exact campaign.updated_at value from the persisted draft being approved for delivery."},"template_if_version":{"type":"integer","description":"Exact persisted campaign template version being approved for delivery."},"deliver_at":{"type":"string","format":"date-time","description":"Future delivery time. Omit for immediate delivery."},"confirm_send_to_all":{"type":"boolean","description":"Required when the persisted audience is all_contacts."},"versions":{"type":"array","minItems":1,"maxItems":5,"description":"Other subject lines to test against the campaign's own (version A, never listed). Two versions need 1,000 recipients, three 2,500, five 5,000 and six 20,000. Returns 422 `invalid_campaign_versions` when they don't fit.","items":{"$ref":"#/components/schemas/CampaignVersionInput"}},"winner":{"$ref":"#/components/schemas/CampaignWinnerInput"}}}}}},"responses":{"200":{"description":"Campaign sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"402":{"$ref":"#/components/responses/PlanRequired"},"422":{"$ref":"#/components/responses/ValidationError"},"409":{"description":"Template version conflict or duplicate send attempt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/templates":{"get":{"tags":["Templates"],"operationId":"listTemplates","summary":"List all templates (paginated)","description":"Returns a summary view with section counts (not full design).","parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"per","in":"query","schema":{"type":"integer","default":100,"maximum":100}},{"name":"scope","in":"query","description":"Use `standalone` for reusable library templates. Omit or use `all` to retain the complete designed-template result.","schema":{"type":"string","enum":["all","standalone"],"default":"all"}},{"name":"include_previews","in":"query","description":"When set, each summary includes rendered preview_html (cached per template version)","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Template summaries","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TemplateSummary"}}}}}}},"post":{"tags":["Templates"],"operationId":"createTemplate","summary":"Create a standalone template","description":"Creates one standalone template. Idempotency-Key is required; an exact\nretry returns the original template, while reuse with changed input\nreturns 409.\n","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1,"maxLength":128}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string","description":"Author text in plain format; custom text alternative in designed format."},"content_format":{"$ref":"#/components/schemas/EmailContentFormat"},"plain_text_mode":{"type":"string","enum":["derived","custom"]},"preheader":{"type":"string"},"from_name":{"type":"string"},"from_email":{"type":"string","format":"email"},"reply_to":{"type":"string","format":"email","description":"One email address; blank uses the brand's. Checked when it changes: a malformed value returns 422."},"generation_provenance":{"$ref":"#/components/schemas/GenerationProvenance"},"if_version":{"type":"integer","description":"Required optimistic concurrency token. Use the current template.version."},"design":{"oneOf":[{"$ref":"#/components/schemas/EmailDesign"},{"$ref":"#/components/schemas/HtmlEmailSource"}]},"catalog_id":{"type":"string","description":"The gallery template a saved guest draft started from. Not\nstored; a known catalog id is recorded once for the first\ncreation under this Idempotency-Key, and an unknown or\nabsent one never fails the save.\n"}}}}}},"responses":{"201":{"description":"Created template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"200":{"description":"Exact idempotent replay of an existing template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"422":{"$ref":"#/components/responses/ValidationError"},"409":{"description":"Idempotency-Key reused with changed input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/templates/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Templates"],"operationId":"getTemplate","summary":"Get a template with full design","responses":{"200":{"description":"Full template including design","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Templates"],"operationId":"updateTemplate","summary":"Update a template","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["if_version"],"properties":{"name":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"},"content_format":{"$ref":"#/components/schemas/EmailContentFormat"},"plain_text_mode":{"type":"string","enum":["derived","custom"]},"preheader":{"type":"string"},"if_version":{"type":"integer","description":"Required optimistic concurrency token. Use the current template.version. A stale value returns 409 with current_version and expected_version."},"from_name":{"type":"string"},"from_email":{"type":"string","format":"email"},"reply_to":{"type":"string","format":"email","description":"One email address; blank uses the brand's. Checked when it changes: a malformed value returns 422."},"generation_provenance":{"$ref":"#/components/schemas/GenerationProvenance"},"design":{"oneOf":[{"$ref":"#/components/schemas/EmailDesign"},{"$ref":"#/components/schemas/HtmlEmailSource"}]}}}}}},"responses":{"200":{"description":"Updated template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"422":{"$ref":"#/components/responses/ValidationError"},"409":{"description":"Template version conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Templates"],"operationId":"deleteTemplate","summary":"Delete an unused standalone template","parameters":[{"name":"if_version","in":"query","required":true,"schema":{"type":"integer"},"description":"Required optimistic concurrency token. Use the current template.version."}],"responses":{"200":{"description":"Template deleted","content":{"application/json":{"schema":{"type":"object","required":["deleted","template_id"],"properties":{"deleted":{"type":"boolean","example":true},"template_id":{"type":"integer"}}}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Template version conflict or deletion blocked by message/flow history","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/templates/{id}/render":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Templates"],"operationId":"renderTemplate","summary":"Render an existing template to HTML","description":"Renders the template through the shared preview renderer.","responses":{"200":{"description":"Rendered HTML","content":{"application/json":{"schema":{"type":"object","required":["html","accessibility"],"properties":{"html":{"type":"string"},"accessibility":{"$ref":"#/components/schemas/EmailAccessibilityLint"}}}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/templates/{id}/send_test":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Templates"],"operationId":"sendTestEmail","summary":"Send a test email","description":"Send a test email for the given template. Provide `email` for an\nexplicit recipient, `contact_id` to use a contact's email (with\nmerge-tag personalization), or `sample_contact_id` to personalize an\nexplicit test recipient without sending to the contact. `contact_id`\nand `sample_contact_id` are mutually exclusive. Omit all recipient\ninputs to use the brand's saved test recipients, falling back to the\naccount owner.\nTest emails go to the account's own people (owner, members, an active\nmanaging account's people) and to addresses at the account's verified\ndomains. Up to 10 other addresses per 30 days are allowed; past that,\neach refused recipient is reported in `results` with `status: failed`\nand the reason in `error`, and the other recipients still receive the\ntest.\nSupply one fresh `Idempotency-Key` for each user-initiated send and\nreuse that exact key for transport retries.\n","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":128}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"oneOf":[{"type":"string","format":"email"},{"type":"array","items":{"type":"string","format":"email"}}]},"emails":{"type":"array","items":{"type":"string","format":"email"}},"send_test_to":{"type":"array","items":{"type":"string","format":"email"}},"contact_id":{"type":"integer"},"sample_contact_id":{"type":"integer","description":"Contact whose projected data personalizes the test without changing the test recipient."}}}}}},"responses":{"200":{"description":"Test email sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestSendResult"}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/templates/preview":{"post":{"tags":["Templates"],"operationId":"previewEmail","summary":"Render an email document to HTML","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["document"],"properties":{"event_data":{"type":"object","additionalProperties":true,"description":"Original trigger data used only for this preview (max 32KB)."},"document":{"description":"Source-free preview preserves the designed default; selecting plain is not accepted.","type":"object","additionalProperties":false,"properties":{"version":{"$ref":"#/components/schemas/EmailDesign/properties/version"},"sections":{"$ref":"#/components/schemas/EmailDesign/properties/sections"},"theme":{"$ref":"#/components/schemas/EmailDesign/properties/theme"},"content_format":{"type":"string","const":"designed"}}}}}}}},"responses":{"200":{"description":"Rendered HTML","content":{"application/json":{"schema":{"type":"object","required":["html","accessibility"],"properties":{"html":{"type":"string"},"accessibility":{"$ref":"#/components/schemas/EmailAccessibilityLint"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"}}}},"/v1/my/templates/spec":{"get":{"tags":["Templates"],"operationId":"getEmailComponentSpec","summary":"Get the email component schema","description":"Returns the full schema for email design sections including all\ncomponent types, their props, required fields, and defaults.\nSourced from `config/email_components.yml`.\n","responses":{"200":{"description":"Email component schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailComponentSpec"}}}}}}},"/v1/my/templates/library":{"get":{"tags":["Templates"],"operationId":"listEmailTemplateLibrary","summary":"List the system template library","description":"Returns the curated system template catalog. Each template ships two\nfaces: its original art direction (design/preview_html) and a\nbrand-matched variant with the palette overrides stripped so the\naccount's colors flow in (branded_design/branded_preview_html).\nSourced from the canonical catalog in `config/email_templates/`,\nordered by `config/email_templates/index.yml`.\n","responses":{"200":{"description":"Library templates with original and brand-matched variants","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EmailLibraryTemplate"}}}}}}}},"/v1/my/templates/generate":{"post":{"tags":["Templates"],"operationId":"generateEmailTemplate","summary":"AI-generate an email draft","description":"Generate, regenerate, or refine a complete template, campaign-email, or\nselected flow-email draft through the same authoring spine. This never\npersists or sends. A flow target addresses exactly one existing email\naction, never the whole flow. Reusing an idempotency key with changed\nauthoring input returns a conflict.\n","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1},"description":"Retry-stable identity for this generation request."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["goal","operation","current_draft","authoring_target"],"properties":{"goal":{"type":"string","description":"What the email should accomplish","example":"Welcome new subscribers and introduce the brand"},"operation":{"type":"string","enum":["generate","regenerate","refine"]},"edit_scope":{"type":"string","enum":["copy","design","both"],"description":"Defaults to copy for refine and both otherwise."},"user_instruction":{"type":"string"},"category":{"type":"string","description":"Optional category hint (welcome, newsletter, promotion, etc.)"},"tone":{"type":"string","description":"Optional tone override (formal, casual, etc.)"},"current_draft":{"description":"Complete unsaved editor state to generate or refine. Supplied format must match the scoped stored/source format; unbound new content defaults to designed.","oneOf":[{"type":"object","required":["plain_text_mode","design"],"properties":{"subject":{"type":"string"},"preheader":{"type":"string"},"body":{"type":"string"},"content_format":{"type":"string","const":"designed"},"plain_text_mode":{"type":"string","enum":["derived","custom"]},"from_name":{"type":"string"},"from_email":{"type":"string"},"reply_to":{"type":"string"},"design":{"type":"object","required":["sections"],"properties":{"version":{"type":"integer"},"theme":{"type":"object","additionalProperties":true},"sections":{"type":"array","items":{"type":"object","additionalProperties":true}}},"additionalProperties":true}}},{"type":"object","required":["content_format","body","plain_text_mode"],"properties":{"content_format":{"type":"string","const":"plain"},"plain_text_mode":{"type":"string","const":"custom"},"subject":{"type":"string"},"preheader":{"type":"string"},"body":{"type":"string"},"from_name":{"type":"string"},"from_email":{"type":"string"},"reply_to":{"type":"string"},"design":{"type":"object","description":"Dormant designed content, preserved during plain authoring.","additionalProperties":true}}},{"type":"object","required":["trigger","steps"],"properties":{"name":{"type":"string"},"trigger":{"$ref":"#/components/schemas/FlowTriggerInput"},"steps":{"type":"array","items":{"$ref":"#/components/schemas/FlowStepInput"}}}}]},"authoring_target":{"oneOf":[{"type":"object","required":["surface"],"properties":{"surface":{"type":"string","const":"template"},"template_id":{"type":"integer","minimum":1},"if_version":{"type":"integer","minimum":1,"description":"Required when template_id is present."}}},{"type":"object","required":["surface","campaign_id","if_version"],"properties":{"surface":{"type":"string","const":"campaign"},"campaign_id":{"type":"integer","minimum":1},"template_id":{"type":"integer","minimum":1},"if_version":{"type":"integer","minimum":1}}},{"type":"object","required":["surface","flow_id","action_name","if_version"],"properties":{"surface":{"type":"string","const":"flow"},"flow_id":{"type":"integer","minimum":1},"action_name":{"type":"string","minLength":1},"if_version":{"type":"integer","minimum":1}}}]}}}}}},"responses":{"200":{"description":"Generated email design","content":{"application/json":{"schema":{"type":"object","properties":{"design":{"type":"object","description":"{ version, theme, sections[] } — ready for GrapesJS"},"subject":{"type":"string"},"preheader":{"type":"string"},"body":{"type":"string"},"content_format":{"$ref":"#/components/schemas/EmailContentFormat"},"plain_text_mode":{"type":"string","enum":["derived","custom"]},"category":{"type":"string","description":"Inferred or provided category"},"prompt_version":{"type":"string"},"generation_provenance":{"$ref":"#/components/schemas/GenerationProvenance"},"knowledge_used":{"type":"array","items":{"type":"string"}}}}}}},"400":{"description":"Invalid authoring request","content":{"application/json":{"schema":{"type":"object","required":["code","error_code","message","error"],"properties":{"code":{"type":"string","enum":["idempotency_key_required","invalid_authoring_request"]},"error_code":{"type":"string","enum":["idempotency_key_required","invalid_authoring_request"]},"message":{"type":"string"},"error":{"type":"boolean","const":true}}}}}},"409":{"description":"Generation or template version conflict","content":{"application/json":{"schema":{"type":"object","required":["code","error_code","message","error"],"properties":{"code":{"type":"string","enum":["template_version_conflict","idempotency_conflict","generation_in_progress","generation_replay_invalid"]},"error_code":{"type":"string","enum":["template_version_conflict","idempotency_conflict","generation_in_progress","generation_replay_invalid"]},"message":{"type":"string"},"error":{"type":"boolean","const":true}}}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"ai_limit_reached":{"value":{"error":true,"code":"ai_limit_reached","message":"Generation limit reached."}},"brand_incomplete":{"value":{"error":true,"code":"brand_incomplete","message":"Complete brand setup first."}}}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Generation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"generation_failed":{"value":{"error":true,"code":"generation_failed","message":"Generation failed. Try again."}}}}}}}}},"/v1/my/flow_demo/claim":{"post":{"tags":["Flows"],"operationId":"claimGuestFlowDemo","summary":"Save an edited guest flow after sign-in","description":"Copies an anonymous demo draft and its scanned Brand Kit into the\nauthenticated account. Only the ready draft of the demo's current\nrevision can be claimed. The guest token is scoped to one 24-hour demo;\nexact retries return the same flow. The copied flow remains a draft\nand does not send until separately approved and activated.\n","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":128}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["token","graph"],"properties":{"token":{"type":"string","pattern":"^[0-9a-f]{64}$"},"name":{"type":"string"},"send_tests":{"type":"boolean","default":false,"description":"Send every email step of the claimed flow as a test to the\nsigned-in user's own address, in flow order. Queued after\nthe claim; each step is sent at most once per flow.\n"},"graph":{"type":"object","required":["trigger","steps"],"properties":{"trigger":{"type":"object","additionalProperties":true},"steps":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}}}},"responses":{"201":{"description":"Claimed draft flow and target Brand","content":{"application/json":{"schema":{"type":"object","required":["flow_id","brand_sid"],"properties":{"flow_id":{"type":"integer"},"brand_sid":{"type":"string"},"inbox_tests":{"type":"string","enum":["queued"],"description":"Present when send_tests was true and the test sends were queued."}}}}}},"409":{"description":"The same demo was claimed with different input or by another account"},"422":{"description":"Expired demo, no ready draft for the current revision, invalid graph, or Brand limit reached"}}}},"/v1/my/user/payment_method":{"get":{"tags":["Billing"],"operationId":"getAccountPaymentMethods","summary":"Read the selected account's recurring subscription cards","description":"Account administrator required. Reads actual provider subscription defaults; never returns payer profile details or changes a shared customer default.","responses":{"200":{"description":"Masked cards by subscription, product_key and plan_name","content":{"application/json":{"schema":{"type":"object","properties":{"payment_methods":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"403":{"$ref":"#/components/responses/Forbidden"}}},"put":{"tags":["Billing"],"operationId":"updateAccountPaymentMethods","summary":"Replace the card on this account's current plan and paid features","description":"Account administrator required. Provider ownership is checked before changing any term. Success means every subscription the save updated, and that is still live, was read back from the provider on the new card; `payment_methods` lists those. A subscription that ends during the request may be left out, and one that starts during the request is not updated and not listed. This never changes another account's subscriptions.\n\nWithout all three of `pay_invoice_id`, `pay_amount_cents` and `pay_currency`, outstanding invoices are not paid. With all three, once the card is confirmed Stripe is asked at once to pay that one failed invoice on this account with the new card. It must be the account's current unpaid invoice (`billing.outstanding_invoice.id` on the account), on the account's current plan and in US dollars, and its live amount and currency must match the values sent. A subscription that starts or ends before the invoice payment request is sent to Stripe stops that payment (`not_attempted`). The card stays saved whatever the payment result, which is returned in `invoice_retry`. The invoice and the account update when Stripe confirms the payment, usually within seconds.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["stripe_token"],"properties":{"stripe_token":{"type":"string","writeOnly":true},"pay_invoice_id":{"type":"integer","minimum":1,"description":"Id of the account's current unpaid invoice, as `billing.outstanding_invoice.id` on the account shows it. No other invoice is paid this way. Ignored unless `pay_amount_cents` and `pay_currency` are also valid."},"pay_amount_cents":{"type":"integer","minimum":1,"description":"The invoice amount the customer was shown, in the currency's smallest unit. No payment is started if the invoice's live remaining amount differs."},"pay_currency":{"type":"string","pattern":"^[A-Za-z]{3}$","description":"The three-letter currency code the customer was shown. Only USD invoices are paid this way, and no payment is started if the invoice's live currency differs."}}}}}},"responses":{"200":{"description":"Confirmed masked cards by account subscription, with the payment result when an invoice was named","content":{"application/json":{"schema":{"type":"object","properties":{"payment_methods":{"type":"array","items":{"type":"object","additionalProperties":true}},"invoice_retry":{"type":"object","description":"Present only when the request named an invoice to pay. The card is saved in every case.","properties":{"invoice_id":{"type":"integer"},"status":{"type":"string","enum":["paid","declined","action_required","unconfirmed","not_attempted"],"description":"`paid`: Stripe reports the invoice paid. `declined`: the card was declined, and `message` carries the reason. `action_required`: the bank needs to verify the payment, so finish on the invoice payment page (`GET /v1/my/invoices/{id}/payment`). `unconfirmed`: the result could not be confirmed, so check the invoice again shortly. `not_attempted`: no payment was started, for example because the invoice is not the account's current unpaid invoice, is not in US dollars, or its amount changed.\n"},"message":{"type":"string","description":"A sentence written for the customer."}}}}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError","description":"Validation failed, or the card was declined (error_code payment_declined, with a message written for the customer)."}}},"delete":{"tags":["Billing"],"operationId":"removeAccountPaymentMethod","summary":"Refuse removal while current recurring terms require payment","responses":{"200":{"description":"No recurring account payment method exists"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/invoices/{id}/payment":{"get":{"tags":["Billing"],"operationId":"getInvoicePaymentPage","summary":"Open the provider-hosted payment page for an owned unpaid invoice","description":"Account administrator required. Performs fresh provider ownership and open-status checks. Payment and authentication happen on Stripe. Access resumes through the existing paid invoice receipt path.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Ownership-verified HTTPS Stripe invoice payment URL","content":{"application/json":{"schema":{"type":"object","properties":{"payment_url":{"type":"string","format":"uri"}}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"Invoice does not belong to this account or cannot be paid"}}}},"/v1/my/flows":{"get":{"tags":["Flows"],"operationId":"listFlows","summary":"List automation flows (paginated)","description":"Returns standalone flows only (excludes campaign-attached flows).","parameters":[{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Paginated flows","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Flow"}}}}}}},"post":{"tags":["Flows"],"operationId":"createFlow","summary":"Create a flow","description":"Creates a draft flow without delivery authority. Idempotency-Key is\nrequired; an exact retry returns the original flow, while reuse with\nchanged input returns 409. Approve or activate in a separate request.\n","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1,"maxLength":128}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"trigger":{"$ref":"#/components/schemas/FlowTriggerInput"},"steps":{"type":"array","items":{"$ref":"#/components/schemas/FlowStepInput"}}}}}}},"responses":{"201":{"description":"Flow created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flow"}}}},"200":{"description":"Exact idempotent replay of an existing flow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flow"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"422":{"$ref":"#/components/responses/ValidationError"},"409":{"description":"Idempotency-Key reused with changed input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/flows/generate":{"post":{"tags":["Flows"],"operationId":"generateFlow","summary":"Write a draft flow for the brand from a goal or a template","description":"Send a goal or a template_id. A goal is planned into the flow's trigger,\nwaits, checks and emails; a template (one whose `brand_writable` is true\nin GET /v1/my/flow_templates) keeps its own. Every email is then written\nfor the current brand and the flow is saved as a pending-review draft,\nusing one AI generation. A template that starts on `list_add` needs\n`contact_list_id`. Idempotency-Key is required: an exact retry returns\nthe original flow, a duplicate sent while the first is still writing\nreturns 409 generation_in_progress, and reuse with a changed request\nreturns 409 idempotency_conflict.\n","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1,"maxLength":128}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"goal":{"type":"string","minLength":1,"maxLength":1000},"template_id":{"type":"string","description":"A flow template id, sent instead of goal."},"contact_list_id":{"type":"integer","description":"The brand list a list_add template starts on."}}}}}},"responses":{"201":{"description":"Flow written and saved as a draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flow"}}}},"200":{"description":"Exact idempotent replay of an existing flow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flow"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"409":{"description":"The first request with this key is still writing, or the key was reused with a changed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"AI generation limit reached (ai_limit_reached), a template that cannot be written\nfor the brand (invalid_template), a list template without its list\n(trigger_binding_required), or a goal that could not become a flow\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Planning or writing failed; retry with the same key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/flows/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Flows"],"operationId":"getFlow","summary":"Get a flow","parameters":[{"name":"include_blockers","in":"query","required":false,"description":"Pass `false` to leave `blockers` out of `unpublished_change`, as\nthe flow list does, which skips the publish checks. Defaults to\n`true`.\n","schema":{"type":"boolean","default":true}}],"responses":{"200":{"description":"Flow with full graph","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flow"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Flows"],"operationId":"updateFlow","summary":"Update a flow","description":"Authoring (`name`, `trigger`, `steps`, `generation_provenance`) and\ndelivery control (`status`, `approval_state`) are separate requests and\nmust not be mixed. For graph writes, pass `expected_draft_revision_id`\nfrom the latest flow read to reject stale authored changes.\n\nAn authoring save to a live or paused flow with `publish: true`\npublishes the saved revision after the same checks as approval, and\nSafe Mode for API keys. Without it, the save waits as a draft and\n`unpublished_change` reports it. A live flow stays\nlive and a paused flow stays paused; contacts already in the flow keep\nthe version they started on. If a check refuses the publish, the save\nis kept, the flow keeps running its last version, and the response's\n`unpublished_change` says why. On a live or paused flow, approving the\ncurrent draft (`approval_state: approved` with its `revision_id`)\npublishes it. A draft flow still goes live with `status: live`. Flow\napproval/rejection and `status: live` publication from a draft flow\nderive the current draft when `revision_id` is omitted. When supplied,\n`revision_id` asserts that the named revision is still the current\ndraft; a stale assertion returns 409. On an already-live flow,\n`status: live` without `revision_id` is a status no-op and does not\npublish pending changes. Restarting a paused flow with contacts already\nin progress requires `resume_mode`. A plain restart is refused when the\nflow has unpublished changes; supply the current draft revision to\npublish those changes as part of the restart.\n\nIn Setup mode, `status: live`, a restart and an approval that would\npublish a live or paused flow return 402 `plan_required` before\nanything changes. A save with `publish: true` is still kept: the flow\nkeeps running its last version and `unpublished_change.blockers`\nincludes `plan_required`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"status":{"type":"string","enum":["draft","live","paused","archived","cancelled"]},"approval_state":{"type":"string","enum":["approved","rejected"]},"revision_id":{"type":"integer","nullable":true,"description":"Optional current-draft assertion for approval_state and status=live publication. Omission derives the current draft for approval_state and for publication from draft status. On an already-live flow, status=live without revision_id is a no-op. Supply the current draft revision to publish pending changes while restarting a paused flow."},"resume_mode":{"type":"string","enum":["new_contacts_only","continue_existing"],"description":"Required when resuming eligible journeys. new_contacts_only stops them; continue_existing retains their schedule and existing sending limits. Live flows select only explicitly resumable blocked journeys."},"expected_draft_revision_id":{"type":"integer","nullable":true,"description":"Exact optimistic concurrency token for authored graph changes."},"updated_at":{"type":"string","format":"date-time","description":"Optimistic concurrency check"},"trigger":{"$ref":"#/components/schemas/FlowTriggerInput"},"steps":{"type":"array","items":{"$ref":"#/components/schemas/FlowStepInput"}},"generation_provenance":{"$ref":"#/components/schemas/GenerationProvenance"},"publish":{"type":"boolean","default":false,"description":"With an authoring save to a live or paused flow, publish the saved revision. Ignored without authoring fields."}}}}}},"responses":{"200":{"description":"Updated flow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flow"}}}},"402":{"$ref":"#/components/responses/PlanRequired"},"409":{"description":"Conflict — the authored draft or requested publication revision is stale","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed, or going live, resuming or publishing was refused. A refusal names the fix; when the safety check held or blocked a flow email, it can also say how to recover.\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"validation_errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"how_to_fix":{"type":"string"},"recovery_actions":{"type":"array","items":{"$ref":"#/components/schemas/SafetyRecoveryAction"}},"agent_prompt":{"type":"string","description":"For held or blocked flow emails, each one's fix to paste to an agent, joined."},"disclosures":{"type":"array","description":"Each held flow email and its case.","items":{"type":"object","properties":{"action":{"type":"string"},"review_id":{"type":"integer"},"category":{"type":"string"},"agent_prompt":{"type":"string"}}}}}}]}}}}}},"delete":{"tags":["Flows"],"operationId":"deleteFlow","summary":"Delete a flow","responses":{"200":{"description":"Deleted flow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flow"}}}}}}},"/v1/my/flows/{id}/resume_plan":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Flows"],"operationId":"getFlowResumePlan","summary":"Preview the choices for restarting a paused flow","responses":{"200":{"description":"Current restart impact and available choices","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowResumePlan"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/flows/spec":{"get":{"tags":["Flows"],"operationId":"getFlowSpec","summary":"Get the flow step type schema","description":"Returns the schema for flow step types, trigger events, and\naudience filters. Flow steps and triggers are sourced from\n`config/flows.yml`; filters are sourced from the audience filter\nregistry.\n","responses":{"200":{"description":"Flow specification","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowSpec"}}}}}}},"/v1/my/map/approvals/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"get":{"tags":["Mail Action Protocol"],"operationId":"getSendApproval","summary":"Review a campaign send that waits for the account owner's approval","description":"Under Safe Mode, an email campaign send requested by an agent, by sign-in or API key, waits for the account owner's approval. This is the current proposal: its state, the content it sends, and the MAP 0.3 Campaign Send Approval description of its exact terms. A MAP connector reads it before any decision. It takes a signed-in person's credential; an API key is refused.\n","responses":{"200":{"description":"The send approval","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendApproval"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"tags":["Mail Action Protocol"],"operationId":"decideSendApproval","summary":"Approve or decline a held campaign send at its terms version","description":"The account owner or a direct account admin decides, naming the terms version the decision was made on (`mail_action.terms.version`). The service checks that version, the decider, the deadline, the plan, the sender's authorization and included email usage under the same locks that record the decision. Approval releases the send, now or at its scheduled time; decline cancels it. In Setup mode an approval returns 402 `plan_required` and the send stays pending, so it can still be declined. Repeating a recorded approval with its version returns it without sending again. A decision takes the person's own bearer sign-in: a browser cookie session, an impersonated session and an API key are refused.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["decision","version"],"properties":{"decision":{"type":"string","enum":["approve","decline"]},"version":{"type":"string","description":"The terms version the decision was made on."}}}}}},"responses":{"200":{"description":"The send approval after the decision","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendApproval"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"description":"The caller cannot decide this send, or Nitrosend refuses the approval (`error_code: approval_refused`): the sender is no longer authorized, or the audience needs more email than the plan includes, since an approval never authorizes a charge. The send stays pending and can still be declined.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The send was already decided, changed since the given version, expired or was withdrawn. Nothing is applied.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/flow_templates":{"get":{"tags":["Flows"],"operationId":"listFlowTemplates","summary":"List flow templates","description":"Returns the gallery templates available to the current account's enabled\ncapabilities. Filter the available templates with `category`.\n","parameters":[{"name":"category","in":"query","required":false,"schema":{"type":"string"},"description":"Return only this category's available templates, such as `ecommerce`."}],"responses":{"200":{"description":"List of flow templates","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FlowTemplate"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/my/flow_templates/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Flow template slug (e.g. `welcome`)"}],"get":{"tags":["Flows"],"operationId":"getFlowTemplate","summary":"Get a flow template","description":"Returns a single flow template including the full `trigger` and `steps`\ngraph with its sample copy, ready to pass to `POST /v1/my/flows`. A template\nwhose `needs_list` is true also needs `trigger.contact_list_id` there.\n","responses":{"200":{"description":"Flow template with full graph","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowTemplateDetail"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/events":{"get":{"tags":["Events"],"operationId":"listEvents","summary":"List events (paginated)","parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":50,"maximum":100}},{"name":"event","in":"query","schema":{"type":"string"},"description":"Filter by event type"},{"name":"contact_id","in":"query","schema":{"type":"integer"}},{"name":"created_after","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"created_before","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"resource_uid","in":"query","schema":{"type":"string"}},{"name":"resource_name","in":"query","schema":{"type":"string"}},{"name":"test","in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Paginated events","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Event"}}}}}}},"post":{"tags":["Events"],"operationId":"createEvent","summary":"Track a contact event","description":"Requires an idempotency key via the `Idempotency-Key` header or\n`idempotency_key` body param. Duplicate events (same account +\nevent type + idempotency key) return the existing event. When\n`contact_email` names an email no contact in the brand holds, the\ncontact is created first and its \"New contact\" flows start before\nthe event's own flows.\n`order_placed` and `purchase` also record an API Order when `data.order_id`\n(or resource_uid) and `data.total` (or amount) are supplied. Amounts are\nmajor units with at most two decimals, including zero; currency is a\nthree-letter code. Event and Order commit together. Missing identity or\ntotal keeps event-only behavior; test events never write financial data.\n`order_canceled` needs data.order_id. `order_refunded` additionally needs\ndata.refund_id and a positive incremental data.refund_amount; a refund id\napplies once per order, and supplied currency must match. Use one\nauthoritative order feed per store: API, Shopify and Stripe ids are not\nautomatically matched across sources.\n","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","maxLength":128},"description":"Idempotency key (alternative to body param)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event"],"properties":{"event":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$","description":"Event type name (lowercase, underscores)"},"contact_id":{"type":"integer"},"contact_email":{"type":"string","format":"email","description":"Alternative to contact_id, and used instead of it when both are sent.\nResolves the brand's contact by email. When no contact holds the\nemail, creates one subscribed by the collection default, or\nsuppressed if the address is on the account's suppression list.\nAn event never changes an existing contact's subscription.\n"},"idempotency_key":{"type":"string","maxLength":128,"description":"Idempotency key (alternative to header)"},"amount":{"type":"number","format":"double"},"resource_uid":{"type":"string"},"resource_name":{"type":"string"},"resource_url":{"type":"string","format":"uri"},"test":{"type":"boolean","default":false},"data":{"type":"object","additionalProperties":true,"description":"Custom event payload (max 32KB). Commerce may include order_id, total, currency, order_number, order_type, subtotal, tax, shipping and items. Use order_type=subscription_renewal for proven renewals (history/LTV, not attributed conversions). Product items use product_name/title, product_url, optional image_url and item_price in major units; original event data remains the flow context. Orders store at most 50 items with truncation metadata. An event named like a built-in flow trigger has the typed fields that trigger declares checked, and a field of the wrong type returns 422; a request that repeats an earlier event's name and idempotency key returns that event without checking the new payload."},"utm_source":{"type":"string"},"utm_medium":{"type":"string"},"utm_term":{"type":"string"},"utm_content":{"type":"string"},"utm_campaign":{"type":"string"}}}}}},"responses":{"201":{"description":"Event created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"200":{"description":"Duplicate event (idempotent — returns existing)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"409":{"description":"The correction's order has not arrived. Retry after recording the purchase, using the same idempotency key; no event or phantom order is created.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","const":409},"error":{"type":"boolean","const":true},"error_code":{"type":"string","const":"order_not_recorded"},"retryable":{"type":"boolean","const":true},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/events/names":{"get":{"tags":["Events"],"operationId":"listEventNames","summary":"List event names for filter autocomplete","description":"Returns known platform event names plus observed event names for the current brand.","responses":{"200":{"description":"Event name suggestions","content":{"application/json":{"schema":{"type":"object","properties":{"names":{"type":"array","items":{"type":"string"}}}}}}}}}},"/v1/my/events/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Events"],"operationId":"getEvent","summary":"Get an event","responses":{"200":{"description":"Event","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Events"],"operationId":"deleteEvent","summary":"Delete an event","responses":{"200":{"description":"Deleted event","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}}}}},"/v1/my/domains":{"get":{"tags":["Domains"],"operationId":"listDomains","summary":"List sending domains (paginated)","parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"per","in":"query","schema":{"type":"integer","default":30,"maximum":100}}],"responses":{"200":{"description":"Paginated domains","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Domain"}}}}}}},"post":{"tags":["Domains"],"operationId":"createDomain","summary":"Add a sending domain","description":"Initiates domain verification. Returns DNS records that must be\nadded at your domain registrar before calling `POST /verify`.\nRetrying an already configured domain reconciles its stored DNS records\nand preserves its DKIM key and verification state.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"e.g. send.example.com"}}}}}}}},"responses":{"201":{"description":"Domain registered with DNS records to configure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Domain"}}}},"422":{"description":"Validation failed. `error_code: domain_ownership_conflict` means the name in `domain` is already held: by another brand of this account when `owner_brand_sid` is present, otherwise by another workspace.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"validation_errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"domain":{"type":"string","description":"The domain that conflicted. It can be the From domain of the name submitted."},"owner_brand_sid":{"type":"string","description":"The brand of this account that holds the domain. Absent for another workspace."}}}]}}}},"503":{"description":"Domain setup is temporarily unavailable on Nitrosend's side. `error_code: domain_setup_unavailable` with `retryable: true` means Nitrosend's managed DNS cannot take the domain's records right now; Nitrosend has been alerted, and the same request can be retried later. Other 503s report a DNS delegation or email provider outage.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/domains/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Domains"],"operationId":"getDomain","summary":"Get a domain with DNS records and status","parameters":[{"name":"inbox_id","in":"query","schema":{"type":"integer"},"description":"Select one of this domain's inboxes for receiving setup and forwarding status."}],"responses":{"200":{"description":"Domain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Domain"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Domains"],"operationId":"deleteDomain","summary":"Remove a sending domain","description":"A paired domain first returns `422` with the exact counterpart impact.\nRepeat with `unpair=true` only after the user confirms that outcome.\n","parameters":[{"name":"unpair","in":"query","required":false,"description":"Confirm teardown of an identity pair after reviewing the paired-domain 422 response.","schema":{"type":"boolean","default":false}}],"responses":{"204":{"description":"Domain deleted"},"422":{"description":"Domain is paired, still has dependent inboxes, or a flow (live, draft, or with contacts part-way through it) still sends from it. reason domain_in_use names the flows, or asks to try again while one is being saved.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"reason":{"type":"string","enum":["domain_paired","domain_in_use"]},"domain_id":{"type":"integer"},"paired_with":{"type":"string"},"counterpart_removed":{"type":"boolean"}}}]}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v1/my/domains/{domain_id}/subdomains":{"parameters":[{"name":"domain_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Verified apex or paired sending domain owned by the current brand."}],"get":{"tags":["Domains"],"operationId":"listSharedSubdomains","summary":"List shared subdomains and eligible destination brands","description":"Requires the domain account owner or administrator. Brand-pinned API keys receive no destination directory. Sharing grants no access to the destination account's mail.","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"q","in":"query","schema":{"type":"string","maxLength":120},"description":"Filter the destination directory by brand or account name."}],"responses":{"200":{"description":"Subdomains (25 per page) and up to 100 eligible destinations.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubdomainSharingSummary"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"tags":["Domains"],"operationId":"shareSubdomain","summary":"Share an exact subdomain with a brand or managed client","description":"Only the verified apex account owner or administrator can authorize sharing. Creates the recipient's own sending and visible-From identities and DKIM key; complete DNS verification through that brand's existing domain setup. The recipient uses its own domain and inbox allowances. Client ownership, payment, claim and management access requirements remain unchanged. Retrying the same subdomain and destination reuses its claim. Sharing again explicitly restores permission and binds the current managed relationship. Configured identities keep their existing DNS records, key and verification.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["subdomain"],"properties":{"subdomain":{"type":"object","required":["subdomain","brand_sid"],"properties":{"subdomain":{"type":"string","minLength":1,"maxLength":63,"pattern":"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$","description":"One DNS label below the apex."},"brand_sid":{"type":"string","description":"Exact destination brand in this account or an eligible managed client."}}}}}}}},"responses":{"201":{"description":"Shared child claim; use the destination brand's domain setup to configure DNS.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SharedSubdomain"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"description":"Too many subdomain creation attempts. Retry later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v1/my/domains/{domain_id}/subdomains/{id}":{"parameters":[{"name":"domain_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/ResourceId"}],"delete":{"tags":["Domains"],"operationId":"revokeSharedSubdomain","summary":"Stop sharing a subdomain","description":"Stops later sends and receiving, including work queued before revocation. Keeps historical mail and other subdomains intact. Requires the apex account owner or administrator.","responses":{"200":{"description":"Child claim with sharing stopped.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SharedSubdomain"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/domains/{id}/verify":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Domains"],"operationId":"verifyDomain","summary":"Verify a domain","description":"Reads the domain's DNS records and returns the domain with what is\nstill outstanding, naming any required record that is missing. It is\nread-only and safe to repeat: once the required records are in place,\nNitrosend asks the email provider and verifies the domain on its own.\nA call that finds the records newly in place makes that automatic\ncheck due at once, and repeating it never delays that check.\n","responses":{"200":{"description":"The domain, its DNS health and what is outstanding","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Domain"}}}}}}},"/v1/my/domains/{id}/entri_session":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Domains"],"operationId":"createEntriSession","summary":"Create an Entri bootstrap session for domain DNS setup","description":"Returns a short-lived Entri JWT plus the DNS record payload needed to\nlaunch the Entri modal for a domain owned by the current brand. An\nalready-verified apex may request the prepared company-inbox MX cutover\nonly with explicit approval and an exact domain-name confirmation.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntriSessionRequest"}}}},"responses":{"200":{"description":"Entri bootstrap payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntriSessionResponse"}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"Domain setup or apex mail cutover is not ready","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntriSessionValidationError"}}}},"429":{"$ref":"#/components/responses/TooManyRequests"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/v1/my/domains/{id}/inbound_setup":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"put":{"tags":["Domains"],"operationId":"updateDomainInboundSetup","summary":"Configure inbound delivery for a verified domain","description":"Selects exactly one inbound method for the current brand's verified\ndomain. Shared subdomains require current permission from the domain owner.\nProvider forwarding keeps Google Workspace or Microsoft 365 as\nthe primary receiver and allocates one opaque Nitrosend forwarding\naddress. MX mode requires the domain to be ready for Nitrosend receiving;\napex domains additionally require a verified forward-all route.\nSelect an existing mailbox with `inbox_id` or its exact `local_part`.\nWith several inboxes, omitting a target is rejected. Creation continues\nto enforce the current account policy; this endpoint does not buy capacity.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainInboundSetupRequest"}}}},"responses":{"200":{"description":"Updated domain and inbound setup state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Domain"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/domains/{id}/inbound_setup/probe":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Domains"],"operationId":"sendDomainInboundForwardingProbe","summary":"Verify provider forwarding for a domain inbox","description":"Shared subdomains require current permission from the domain owner.\nSends a challenge to the configured customer-facing inbox address. The\nprovider-forwarded copy must return through its bound opaque Nitrosend\naddress before the setup becomes active.\n`inbox_id` is required when the domain has several inboxes.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"inbox_id":{"type":"integer","description":"An inbox belonging to this domain and brand."}}}}}},"responses":{"200":{"description":"Domain with refreshed forwarding probe state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Domain"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/integrations":{"get":{"tags":["Integrations"],"operationId":"listIntegrations","summary":"List integrations (paginated)","parameters":[{"name":"category","in":"query","schema":{"type":"string","enum":["email","sms","crm"]}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"per","in":"query","schema":{"type":"integer","default":30,"maximum":100}}],"responses":{"200":{"description":"Paginated integrations","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Integration"}}}}},"400":{"$ref":"#/components/responses/BadRequest"}}},"post":{"tags":["Integrations"],"operationId":"createIntegration","summary":"Create or connect an email provider integration","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationWriteRequest"}}}},"responses":{"201":{"description":"Integration created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Integration"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/integrations/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Integrations"],"operationId":"getIntegration","summary":"Get an integration","responses":{"200":{"description":"Integration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Integration"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Integrations"],"operationId":"updateIntegration","summary":"Update an email provider integration","description":"Updates credentials or operational fields for an existing email provider.\nThe provider cannot be changed once the integration exists.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationWriteRequest"}}}},"responses":{"200":{"description":"Integration updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Integration"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"422":{"$ref":"#/components/responses/ValidationError"}}},"delete":{"tags":["Integrations"],"operationId":"deleteIntegration","summary":"Disconnect an integration","description":"Mailbox connections stop their exact sender route and retain the source\nfor audit and reconnect. Disconnect never switches a mailbox to SES.\nAn active campaign, flow binding or unsettled selected-sender admission\nmust be stopped or settled before its connection can be disconnected.\n","parameters":[{"name":"confirm","in":"query","required":true,"schema":{"type":"boolean"},"description":"Must be true to confirm the destructive action."}],"responses":{"204":{"description":"Integration disconnected"},"400":{"$ref":"#/components/responses/BadRequest"},"409":{"description":"The selected sender still has active or unsettled work, or a flow (live, draft, or with contacts part-way through it) still sends from the mailbox.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/integrations/{id}/test":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Integrations"],"operationId":"testIntegration","summary":"Test integration connectivity","description":"A passing first test of a contact-sync integration that has never\nsynced (ActiveCampaign) also starts its first sync.\n","responses":{"200":{"description":"Tested integration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Integration"}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"The provider refused the connection, for example \"ActiveCampaign rejected the API key\".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/integrations/{id}/primary":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"patch":{"tags":["Integrations"],"operationId":"setPrimaryIntegration","summary":"Set an integration as the primary provider for its category","responses":{"200":{"description":"Integration marked primary","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Integration"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/integrations/{integration_id}/sync_configuration":{"parameters":[{"name":"integration_id","in":"path","required":true,"schema":{"type":"integer"}}],"get":{"tags":["Integrations"],"operationId":"getIntegrationSyncConfiguration","summary":"Get an integration's versioned profile sync contract","responses":{"200":{"description":"Safe sync configuration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationSyncConfiguration"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Integrations"],"operationId":"updateIntegrationSyncConfiguration","summary":"Validate and update an integration's profile sync contract","parameters":[{"name":"confirm_deselection","in":"query","schema":{"type":"boolean","default":false}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationSyncConfigurationWriteRequest"}}}},"responses":{"200":{"description":"Updated safe sync configuration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationSyncConfiguration"}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/integrations/{integration_id}/sync_configuration/discovery":{"parameters":[{"name":"integration_id","in":"path","required":true,"schema":{"type":"integer"}}],"get":{"tags":["Integrations"],"operationId":"discoverIntegrationSyncConfiguration","summary":"Discover safe provider objects and attributes for profile sync","responses":{"200":{"description":"Sync configuration and bounded provider discovery metadata","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/IntegrationSyncConfiguration"},{"type":"object","required":["discovery"],"properties":{"discovery":{"$ref":"#/components/schemas/IntegrationSyncDiscovery"}}}]}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/integrations/attio/connect":{"post":{"tags":["Integrations"],"operationId":"connectAttioIntegration","summary":"Start Attio OAuth connect flow","description":"Returns an Attio OAuth authorize URL for the authenticated account/brand.\nThe response URL includes a signed state payload and the API callback URI.\n","responses":{"200":{"description":"OAuth authorize URL","content":{"application/json":{"schema":{"type":"object","required":["authorize_url"],"properties":{"authorize_url":{"type":"string","format":"uri"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/integrations/hubspot/connect":{"post":{"tags":["Integrations"],"operationId":"connectHubspotIntegration","summary":"Start HubSpot OAuth connect flow","description":"Returns a HubSpot OAuth authorize URL for the authenticated account/brand.\nThe response URL includes a signed state payload and the API callback URI.\n","responses":{"200":{"description":"OAuth authorize URL","content":{"application/json":{"schema":{"type":"object","required":["authorize_url"],"properties":{"authorize_url":{"type":"string","format":"uri"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/integrations/{provider}/connect":{"post":{"tags":["Integrations"],"operationId":"connectMailboxIntegration","summary":"Connect a Gmail, Google Workspace or Microsoft 365 sending mailbox","description":"Returns the provider's authorization URL. Access belongs to one exact\nmailbox. A connection proves that exact address, including on a shared\ncustom domain; it never claims the apex or provisions SES/DNS. Connecting does not change\nthe selected sender or its existing provider.\n","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","enum":["gmail","microsoft365"]}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"sending_domain_id":{"type":"integer","description":"Optional existing brand domain to bind explicitly. A new connection without it is exact-address only."},"return_to":{"type":"string","maxLength":2048,"description":"Signed allowlisted app-relative return path. External origins and traversal are rejected."},"integration_id":{"type":"integer","description":"Existing connection to reconnect without changing its mailbox."}}}}}},"responses":{"200":{"description":"Provider authorization URL","content":{"application/json":{"schema":{"type":"object","required":["authorize_url"],"properties":{"authorize_url":{"type":"string","format":"uri"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/integrations/smtp/connect":{"post":{"tags":["Integrations"],"operationId":"connectSmtpMailboxIntegration","summary":"Test SMTP and IMAP credentials and send an address verification code","description":"Both connections must use verified TLS to public hosts. This creates a\npending exact-address mailbox; it cannot send until verification succeeds.\nA pending connection may be retried with the same address and integration ID.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["mailbox"],"properties":{"integration_id":{"type":"integer","description":"Existing pending SMTP connection."},"mailbox":{"type":"object","required":["mailbox_address","smtp_host","smtp_port","smtp_username","smtp_password","imap_host","imap_port","imap_username"],"properties":{"mailbox_address":{"type":"string","format":"email"},"smtp_host":{"type":"string"},"smtp_port":{"type":"integer","enum":[465,587,2525]},"smtp_username":{"type":"string"},"smtp_password":{"type":"string","format":"password","writeOnly":true},"imap_host":{"type":"string"},"imap_port":{"type":"integer","enum":[993]},"imap_username":{"type":"string"},"imap_password":{"type":"string","format":"password","writeOnly":true,"description":"Defaults to SMTP password."},"sent_folder":{"type":"string"},"junk_folder":{"type":"string"}}}}}}}},"responses":{"200":{"description":"Pending mailbox connection; code sent to its address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Integration"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/integrations/{id}/verify_mailbox":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Integrations"],"operationId":"verifySmtpMailboxIntegration","summary":"Activate a pending SMTP mailbox using its address verification code","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["code"],"properties":{"code":{"type":"string"}}}}}},"responses":{"200":{"description":"Connected exact-address mailbox.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Integration"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/integrations/{id}/reply_sync":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"put":{"tags":["Integrations"],"operationId":"updateMailboxReplySync","summary":"Turn Gmail reply sync on or off for a connected Gmail mailbox","description":"Reply sync reads only replies in threads this mailbox sent into through\nNitrosend, and only mail that arrives after it was last turned on.\nAttachments are not stored. Turning it on starts from now, and only\nworks when the mailbox can read replies: Gmail reading is available for\nthe account and the mailbox's Google grant includes it. Otherwise the\nrequest is refused with 422 and nothing changes. Turning it off stops\nall reading and the mailbox keeps sending. It is on by default when\nthe owner first grants reading. Turning it on again when it is already on\nkeeps its start.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"The mailbox connection, with `config_summary.reply_sync_enabled_at` and `config_summary.event_capabilities.replies`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Integration"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/integrations/{id}/smtp_feedback":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Integrations"],"operationId":"getSmtpFeedbackSetup","summary":"Read this SMTP connection's feedback endpoint, signing secret, and recent receipts","description":"Scoped to the current brand and SMTP connection. Secrets are encrypted at\nrest and returned only by this authenticated setup surface, with no-store\ncaching. Existing connections receive a secret on first setup access.\nA received test confirms callback setup, not the provider's event coverage.\n","responses":{"200":{"description":"SMTP feedback setup and the 20 most recent receipts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmtpFeedbackSetup"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/integrations/{id}/smtp_feedback/rotate":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Integrations"],"operationId":"rotateSmtpFeedbackSecret","summary":"Replace this SMTP connection's feedback signing secret","description":"The old secret is invalid immediately. Previously authenticated receipts still process.","responses":{"200":{"description":"Setup with the replacement secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmtpFeedbackSetup"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/hooks/smtp/{id}/events":{"post":{"tags":["Integrations"],"operationId":"receiveSmtpFeedback","summary":"Receive signed delivery feedback for one SMTP connection","security":[],"description":"Sign the exact body using Standard Webhooks: HMAC-SHA256 of\nwebhook-id + '.' + webhook-timestamp + '.' + body, using the base64-decoded\nwhsec_ signing key. Send webhook-signature as 'v1,\u003cbase64 digest\u003e'.\nTimestamps must be within 300 seconds. Use the same webhook-id for retries,\nwith a fresh signature/timestamp; reusing an ID for different content is 409.\nMaximum body size is 16 KiB. A 200 acknowledges durable receipt; processing\nuses the existing integration event queue. Retry non-2xx responses with backoff.\nOnly an exact dispatched message, recipient, and connection can be updated.\nLate reports for existing sends remain accepted after sending is disconnected.\n","parameters":[{"$ref":"#/components/parameters/ResourceId"},{"name":"webhook-id","in":"header","required":true,"schema":{"type":"string","maxLength":128,"pattern":"^[A-Za-z0-9_.-]+$"},"description":"Unique event ID, stable across retries."},{"name":"webhook-timestamp","in":"header","required":true,"schema":{"type":"string","pattern":"^\\d{1,12}$"},"description":"Unix seconds at the time this attempt is signed."},{"name":"webhook-signature","in":"header","required":true,"schema":{"type":"string","maxLength":1024}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmtpFeedbackPayload"}}}},"responses":{"200":{"description":"Durable receipt accepted, including identical retries."},"400":{"description":"Invalid JSON, fields, timestamp, event type, or event data."},"403":{"description":"Unknown connection or invalid, missing, or stale signing credentials."},"409":{"description":"Event ID was previously used for different content."},"413":{"description":"Body exceeds 16 KiB."},"429":{"description":"Callback rate exceeded; retry with backoff."},"500":{"description":"Receipt or enqueue failed; retry the same event ID."}}}},"/integrations/{provider}/callback":{"get":{"tags":["Integrations"],"operationId":"mailboxIntegrationCallback","summary":"Complete a sending mailbox connection","security":[],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","enum":["gmail","microsoft365"]}},{"name":"state","in":"query","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"303":{"description":"Redirect to the configured app connection-result page. It carries provider, status and a stable error_code on failure; signed authorized account/brand/return context only. The app confirms the saved Integration before returning. No raw provider error, OAuth code or token is exposed."}}}},"/v1/my/integrations/shopify/connect":{"post":{"tags":["Integrations"],"operationId":"connectShopifyIntegration","summary":"Start Shopify OAuth connect flow","description":"Returns a Shopify OAuth authorize URL for the authenticated account/brand.\nThe request accepts a `myshopify.com` shop domain or shop slug. The\nresponse URL includes a signed state payload and the API callback URI.\nPublic App Store connections require a direct account administrator and\nalways use Shopify billing. Custom app registrations remain bound to\ntheir registered account, brand and shop.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["shopify"],"properties":{"shopify":{"type":"object","required":["shop"],"properties":{"shop":{"type":"string","example":"test-shop.myshopify.com"},"app_key":{"type":"string","description":"Explicit registered app identity; omitted requests resolve the existing shop registration.","example":"appstore"}}}}}}}},"responses":{"200":{"description":"OAuth authorize URL","content":{"application/json":{"schema":{"type":"object","required":["authorize_url"],"properties":{"authorize_url":{"type":"string","format":"uri"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/integrations/shopify/credentials":{"post":{"tags":["Integrations"],"operationId":"connectShopifyMerchantCredentials","summary":"Connect a merchant-owned Shopify app","description":"Connects an API-only Shopify app owned by the same Shopify organization\nas its store. Nitrosend exchanges the client credentials server-side,\nverifies the authenticated shop and granted Admin API scopes, then stores\nthe access token and client secret encrypted. Repeating the request for\nthe same brand and shop verifies the new credentials before replacing the\ncurrent connection. The response never includes client credentials or an\naccess token.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShopifyMerchantCredentialRequest"}}}},"responses":{"200":{"description":"Existing merchant-managed Shopify connection replaced","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Integration"}}}},"201":{"description":"Merchant-managed Shopify connection created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Integration"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"description":"Missing fields, invalid credentials, missing scopes, or a shop ownership conflict","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"missing_scopes":{"type":"array","items":{"type":"string","enum":["read_customers","read_orders","read_products"]}},"validation_errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}}]}}}}}}},"/v1/my/integrations/stripe/connect":{"post":{"tags":["Integrations"],"operationId":"connectStripeIntegration","summary":"Start Stripe App OAuth connect flow","description":"Returns the Nitrosend Stripe App install link for the authenticated\naccount and brand. The link carries a signed state and the API callback\nURI; installing the app grants Nitrosend read access to customers,\nsubscriptions, invoices, charges, refunds and events. Pass `mode: test`\nfor the app's test-mode install link. No keys are pasted; tokens are\nrefreshed server-side. Events for connected accounts arrive on\n`/hooks/stripe_apps`, isolated from Nitrosend billing webhooks at\n`/hooks/stripe`.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"stripe":{"type":"object","properties":{"mode":{"type":"string","enum":["live","test"],"default":"live"}}}}}}}},"responses":{"200":{"description":"OAuth authorize URL","content":{"application/json":{"schema":{"type":"object","required":["authorize_url"],"properties":{"authorize_url":{"type":"string","format":"uri"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/integrations/stripe/install":{"get":{"tags":["Integrations"],"operationId":"stripeAppInstall","summary":"Public Stripe App install entry","description":"The Stripe App Marketplace install URL. Sets a nonce cookie and redirects\nto the Stripe App install link for the requested mode. The callback\nprovisions a Nitrosend account for a new email, or asks an existing\nuser to sign in and connect from the integrations page.\n","parameters":[{"name":"mode","in":"query","schema":{"type":"string","enum":["live","test"],"default":"live"}}],"responses":{"302":{"description":"Redirect to the Stripe App install link"},"404":{"description":"The Stripe App is not configured"}}}},"/integrations/stripe/callback":{"get":{"tags":["Integrations"],"operationId":"stripeOauthCallback","summary":"Stripe App OAuth callback endpoint","description":"Public callback endpoint used by Stripe after the app is installed.\nVerifies signed state, exchanges the auth code with the mode-matched\ndeveloper key, persists the integration and enqueues initial sync. A\nsigned-in connect redirects to the app connection-result page; the public install door\nredirects into the app (new account) or to sign in (existing account).\n","parameters":[{"name":"code","in":"query","schema":{"type":"string"}},{"name":"state","in":"query","schema":{"type":"string"}},{"name":"error","in":"query","schema":{"type":"string"}},{"name":"error_description","in":"query","schema":{"type":"string"}}],"responses":{"303":{"description":"Redirect to the app connection-result page with safe result codes and authorized context."},"302":{"description":"Public install redirect into the app or to sign in."}}}},"/integrations/attio/callback":{"get":{"tags":["Integrations"],"operationId":"attioOauthCallback","summary":"Attio OAuth callback endpoint","description":"Public callback endpoint used by Attio after user authorization.\nVerifies signed state, exchanges auth code, and finalizes Attio integration connection.\n","parameters":[{"name":"code","in":"query","schema":{"type":"string"}},{"name":"state","in":"query","schema":{"type":"string"}},{"name":"error","in":"query","schema":{"type":"string"}},{"name":"error_description","in":"query","schema":{"type":"string"}}],"responses":{"303":{"description":"Redirect to the app connection-result page with safe result codes and authorized context."}}}},"/integrations/hubspot/callback":{"get":{"tags":["Integrations"],"operationId":"hubspotOauthCallback","summary":"HubSpot OAuth callback endpoint","description":"Public callback endpoint used by HubSpot after user authorization.\nVerifies signed state, exchanges auth code, persists the integration, and enqueues initial sync.\n","parameters":[{"name":"code","in":"query","schema":{"type":"string"}},{"name":"state","in":"query","schema":{"type":"string"}},{"name":"error","in":"query","schema":{"type":"string"}},{"name":"error_description","in":"query","schema":{"type":"string"}}],"responses":{"303":{"description":"Redirect to the app connection-result page with safe result codes and authorized context."}}}},"/integrations/shopify/callback":{"get":{"tags":["Integrations"],"operationId":"shopifyOauthCallback","summary":"Shopify OAuth callback endpoint","description":"Public callback endpoint used by Shopify after user authorization.\nVerifies signed state, resolves the Shopify app from that signed state,\nverifies the app-specific OAuth HMAC, exchanges the auth code, persists\nthe integration and app key, and enqueues initial sync.\n","parameters":[{"name":"code","in":"query","schema":{"type":"string"}},{"name":"state","in":"query","schema":{"type":"string"}},{"name":"shop","in":"query","schema":{"type":"string"}},{"name":"hmac","in":"query","schema":{"type":"string"}},{"name":"timestamp","in":"query","schema":{"type":"string"}},{"name":"error","in":"query","schema":{"type":"string"}},{"name":"error_description","in":"query","schema":{"type":"string"}}],"responses":{"302":{"description":"Connected; public apps return to Shopify Admin, custom apps return to the Nitrosend integration","headers":{"Location":{"schema":{"type":"string","format":"uri"}}}},"400":{"description":"Invalid callback request","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"OAuth exchange failure","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/hooks/stripe_apps":{"post":{"tags":["Integrations"],"operationId":"receiveStripeAppWebhook","summary":"Receive a Stripe App event for a connected account","description":"Events from every Stripe account that installed the Nitrosend app,\ndelivered to the platform's connected-account webhook endpoint. The\nsignature is verified with the app endpoint secret (live or test),\nthe connection is resolved from `account` and `livemode`, and the\nevent is processed on that integration's execution lane. Events for\naccounts that are not connected are acknowledged and dropped.\n","security":[],"parameters":[{"name":"Stripe-Signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"Verified event acknowledged"},"403":{"description":"Invalid signature or unconfigured secret"},"500":{"description":"Verified event could not be enqueued"}}}},"/hooks/shopify/events":{"post":{"tags":["Integrations"],"operationId":"receiveShopifyAppStoreWebhook","summary":"Receive an App Store Shopify webhook","description":"Uses the App Store app credentials when no app key is present.","security":[],"parameters":[{"name":"X-Shopify-Hmac-Sha256","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Shopify-Shop-Domain","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Shopify-Topic","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"Verified webhook acknowledged"},"400":{"description":"Invalid JSON payload"},"401":{"description":"Invalid App Store HMAC"},"500":{"description":"Verified webhook could not be applied"}}}},"/hooks/shopify/merchant/events":{"post":{"tags":["Integrations"],"operationId":"receiveShopifyMerchantWebhook","summary":"Receive a merchant-managed Shopify webhook","description":"Resolves only active merchant-managed connections from the Shopify shop\nheader and verifies the raw request body with that connection's encrypted\nclient secret before parsing. Unknown shops, ambiguous ownership, missing\nsecrets, and invalid signatures return the same response. Shopify Billing\nAPI topics are never processed on this route.\n","security":[],"parameters":[{"name":"X-Shopify-Hmac-Sha256","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Shopify-Shop-Domain","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Shopify-Topic","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Shopify-Webhook-Id","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"Verified supported webhook processed or unsupported topic safely acknowledged"},"400":{"description":"Verified supported webhook contained invalid JSON"},"401":{"description":"Webhook could not be authenticated"},"500":{"description":"Verified webhook could not be applied"}}}},"/hooks/shopify/events/{app_key}":{"post":{"tags":["Integrations"],"operationId":"receiveShopifyAppWebhook","summary":"Receive a Shopify webhook for a named app","security":[],"parameters":[{"name":"app_key","in":"path","required":true,"schema":{"type":"string","enum":["custom"]}},{"name":"X-Shopify-Hmac-Sha256","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Shopify-Shop-Domain","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Shopify-Topic","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"Verified webhook acknowledged"},"400":{"description":"Invalid JSON payload"},"401":{"description":"Invalid app-specific HMAC"},"500":{"description":"Verified webhook could not be applied"}}}},"/integrations/shopify/session":{"post":{"tags":["Integrations"],"operationId":"openShopifyEmbeddedSession","summary":"Open or resume the embedded Shopify app","description":"Verifies the Shopify App Bridge ID token in the Authorization header,\nexchanges it for an offline Shopify access token when installation is\nrequired, and provisions or resumes the Nitrosend account integration.\nSubsequent embedded requests continue to authenticate with fresh\nShopify ID tokens.\nAn existing-account response never links by email. It includes a\nrelative connect_path for ordinary Nitrosend sign-in and explicit\naccount/brand confirmation before Shopify OAuth authorization.\n","responses":{"200":{"description":"Embedded Shopify integration opened","content":{"application/json":{"schema":{"type":"object","required":["integration_id","requires_plan","redirect_to"],"properties":{"integration_id":{"type":"integer"},"manage_url":{"type":"string","format":"uri","nullable":true},"requires_plan":{"type":"boolean"},"redirect_to":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"description":"Embedded install needs recovery or cannot be opened","content":{"application/json":{"schema":{"type":"object","required":["error","message"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"connect_path":{"type":"string","description":"Relative dashboard path, only present for existing_account recovery"}}}}}}}}},"/integrations/shopify/billing/callback":{"get":{"tags":["Integrations"],"operationId":"reconcileShopifyAppPricing","summary":"Reconcile Shopify App Pricing after plan management","security":[],"parameters":[{"name":"shop","in":"query","required":true,"schema":{"type":"string","example":"test-shop.myshopify.com"}}],"responses":{"302":{"description":"Redirect back to the app in Shopify Admin"},"400":{"description":"Invalid Shopify shop domain"}}}},"/v1/public/shopify/events":{"post":{"tags":["Public"],"operationId":"ingestShopifyPixelEvent","summary":"Ingest a Shopify Web Pixel event","description":"Browser-safe public collector for Shopify Web Pixel standard events.\nRequires a dedicated `wpkey_live_...` collector key. Secret\n`nskey_live_...` API keys are rejected. Pixel events are treated as\nfunnel telemetry; verified Shopify webhooks remain authoritative for\nrevenue checkout/purchase Events.\n","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event_id","event_name"],"properties":{"event_id":{"type":"string"},"event_name":{"type":"string","enum":["product_viewed","product_added_to_cart","product_removed_from_cart"]},"customer_id":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"properties":{"type":"object","additionalProperties":true}}}}}},"responses":{"202":{"description":"Event accepted, ignored, or dropped","content":{"application/json":{"schema":{"type":"object","required":["ok","outcome"],"properties":{"ok":{"type":"boolean"},"outcome":{"type":"string","enum":["captured","ignored","dropped"]},"event_id":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/brands":{"get":{"tags":["Brands"],"operationId":"listBrands","summary":"List brands (paginated)","description":"Brand-scoped credentials see only their own brand. Signed-in account users see their accessible account's brands.","parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"per","in":"query","schema":{"type":"integer","default":100,"maximum":100}}],"responses":{"200":{"description":"All brands for the account","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Brand"}}}}}}},"post":{"tags":["Brands"],"operationId":"createBrand","summary":"Create a brand","description":"Requires a signed-in account user. Brand-scoped credentials cannot create brands.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Internal brand name; mirrors company_name when company_name is omitted"},"brand_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"text_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"bg_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"radius":{"type":"integer","minimum":0,"maximum":64,"nullable":true},"spacing_density":{"type":"string","enum":["compact","normal","spacious"],"nullable":true},"font_heading":{"type":"string"},"font_body":{"type":"string"},"heading_size":{"type":"integer","minimum":12,"maximum":48,"nullable":true},"body_size":{"type":"integer","minimum":12,"maximum":20,"nullable":true},"brand_document":{"type":"string","nullable":true,"maxLength":15360},"company_description":{"type":"string"},"physical_address":{"type":"string"},"company_name":{"type":"string"},"logo":{"type":"string","description":"Signed blob ID or URL"},"email_from_name":{"type":"string"},"email_from_email":{"type":"string","format":"email"},"email_reply_to":{"type":"string","format":"email"},"email_view_online":{"type":"boolean"},"email_view_online_placement":{"type":"string","enum":["top","footer"],"description":"Where the View in browser link goes: at the top of the email, or beside the footer's Unsubscribe link."},"email_track_opens":{"type":"boolean","description":"Inject the open-tracking pixel into this brand's emails."},"email_track_clicks":{"type":"boolean","description":"Rewrite this brand's links for click tracking."},"email_utm_tagging":{"type":"boolean","description":"Add UTM tags to links to this brand's own domains in campaign and flow emails. On by default; test sends and transactional email are never tagged."},"email_utm_source":{"type":"string","maxLength":100,"description":"utm_source on tagged links. Default nitrosend."},"email_utm_medium":{"type":"string","maxLength":100,"description":"utm_medium on tagged links. Default email."},"email_utm_domains":{"type":["array","null"],"minItems":1,"maxItems":20,"items":{"type":"string"},"description":"Domains whose links get UTM tags, subdomains included. Null uses the registrable domains of the brand's website and verified sending domains."},"test_email_recipients":{"type":"array","items":{"type":"string","format":"email"},"maxItems":5},"links":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"icon":{"type":"string"},"title":{"type":"string"}}}},"default_header":{"type":"object","additionalProperties":true},"default_footer":{"type":"object","additionalProperties":true},"default_theme":{"type":"object","additionalProperties":true}}}}}},"responses":{"201":{"description":"Brand created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Brand"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"description":"Brand limit reached or validation failed","content":{"application/json":{"schema":{"oneOf":[{"type":"object","required":["error","code","message"],"properties":{"error":{"type":"boolean","const":true},"code":{"type":"string","enum":["brand_limit_reached"],"description":"Machine-readable reason returned when the current plan cannot create another brand."},"message":{"type":"string"}}},{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"validation_errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}}]}]}}}}}}},"/v1/my/brands/{sid}":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"get":{"tags":["Brands"],"operationId":"getBrand","summary":"Get a brand","responses":{"200":{"description":"Brand","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Brand"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Brands"],"operationId":"updateBrand","summary":"Update a brand","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Internal brand name; mirrors company_name when company_name is omitted"},"brand_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"text_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"bg_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"radius":{"type":"integer","minimum":0,"maximum":64,"nullable":true},"spacing_density":{"type":"string","enum":["compact","normal","spacious"],"nullable":true},"font_heading":{"type":"string"},"font_body":{"type":"string"},"heading_size":{"type":"integer","minimum":12,"maximum":48,"nullable":true},"body_size":{"type":"integer","minimum":12,"maximum":20,"nullable":true},"brand_document":{"type":"string","nullable":true,"maxLength":15360},"company_description":{"type":"string"},"physical_address":{"type":"string"},"company_name":{"type":"string"},"logo":{"type":"string","description":"Signed blob ID or URL"},"email_from_name":{"type":"string"},"email_from_email":{"type":"string","format":"email","description":"Selects the ready sending identity that authorizes this address. A connected mailbox becomes the default sender only when chosen with sender_identity_id, never by matching its address."},"email_reply_to":{"type":"string","format":"email"},"email_view_online":{"type":"boolean"},"email_view_online_placement":{"type":"string","enum":["top","footer"],"description":"Where the View in browser link goes: at the top of the email, or beside the footer's Unsubscribe link."},"email_track_opens":{"type":"boolean","description":"Inject the open-tracking pixel into this brand's emails."},"email_track_clicks":{"type":"boolean","description":"Rewrite this brand's links for click tracking."},"email_utm_tagging":{"type":"boolean","description":"Add UTM tags to links to this brand's own domains in campaign and flow emails. On by default; test sends and transactional email are never tagged."},"email_utm_source":{"type":"string","maxLength":100,"description":"utm_source on tagged links. Default nitrosend."},"email_utm_medium":{"type":"string","maxLength":100,"description":"utm_medium on tagged links. Default email."},"email_utm_domains":{"type":["array","null"],"minItems":1,"maxItems":20,"items":{"type":"string"},"description":"Domains whose links get UTM tags, subdomains included. Null uses the registrable domains of the brand's website and verified sending domains."},"sender_identity_id":{"type":"integer","description":"Ready brand-owned email sending identity to select through the canonical sender-selection authority."},"sender_local_part":{"type":"string","description":"Visible From local part for the selected sending identity."},"confirm_sender_flows":{"type":"boolean","description":"Send true once the user has approved the outcome a 409 sender_flows_confirmation_required described. Any other value leaves the change unconfirmed."},"test_email_recipients":{"type":"array","items":{"type":"string","format":"email"},"maxItems":5},"links":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"icon":{"type":"string"},"title":{"type":"string"}}}},"default_header":{"type":"object","additionalProperties":true},"default_footer":{"type":"object","additionalProperties":true},"default_theme":{"type":"object","additionalProperties":true}}}}}},"responses":{"200":{"description":"Updated brand","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Brand"}}}},"409":{"description":"sender_flows_confirmation_required: the sender change would move live or paused flows to the new sender, or leave some on the old one for now. message says which. Nothing changed; send the same update with confirm_sender_flows: true once the user agrees.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}},"delete":{"tags":["Brands"],"operationId":"deleteBrand","summary":"Delete a brand","parameters":[{"name":"force","in":"query","required":false,"description":"Must be `true` to delete a brand that has queued messages or scheduled/live campaigns.","schema":{"type":"string","enum":["true"]}}],"responses":{"200":{"description":"Deleted brand","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Brand"}}}},"409":{"description":"Brand has active sends and requires explicit force confirmation","content":{"application/json":{"schema":{"type":"object","required":["error","code","active_sends","deletion_safety"],"properties":{"error":{"type":"boolean","const":true},"code":{"type":"string","enum":["brand_has_active_sends"]},"active_sends":{"$ref":"#/components/schemas/BrandDeletionSafetyActiveSends"},"deletion_safety":{"$ref":"#/components/schemas/BrandDeletionSafety"}}}}}},"422":{"description":"Cannot delete the only brand","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/brands/{sid}/prepare_sending":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"post":{"tags":["Brands"],"operationId":"prepareBrandSending","summary":"Reserve and prepare the Nitrosend sender","description":"Reserves the brand's Nitrosend address when the brand has none (using the optional chosen `subdomain` and `local_part`, otherwise the company-derived name) and idempotently materializes the brand-owned logical Domain and sending identity under the verified shared nitrosend.net root. The operation is database-only: it makes no DNS, Vercel, Cloudflare, or SES call and never sends or retains email. A brand that already owns a namespace gets it back unchanged; the body is ignored because an allocated name is immutable.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"subdomain":{"type":"string","description":"Chosen subdomain label under the hosted apex; validated by the same policy as company-derived names."},"local_part":{"type":"string","description":"Local part for the sender address (defaults to `hello`)."}}}}}},"responses":{"200":{"description":"The brand-subdomain sender is ready","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandSubdomainPreparationResponse"}}}},"422":{"description":"The account or Brand Kit is not eligible, or the chosen name was rejected. `error_code` is one of `subdomain_taken`, `subdomain_unsafe`, `local_part_invalid`, `brand_identity_required`, `brand_identity_review_required`, `sender_identity_limit_reached`, `sender_identity_retired`, `brand_inactive`, `sending_paused`, `subscription_inactive`, `principal_email_missing`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The shared hosted-sender root is not release-ready; no identity or delivery state was written","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Address request rate or claim allowance reached. Retry-After specifies the wait in seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/brands/{sid}/rename_hosted_sender":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"post":{"tags":["Brands"],"operationId":"renameHostedSender","summary":"Change the brand's Nitrosend address name","description":"Replaces the hosted subdomain while preserving the inbox, its history, and previous receiving addresses. Old names remain permanently owned; future replies use the new domain. Requires brand.manage authority and the current fqdn as a precondition. Active flow bindings and unsettled delivery work prevent a change. New claims share the account's existing lifetime allowance and are limited to two per brand per hour, including the initial claim. No DNS, SES or model calls occur during this operation. Changing the sender requires fresh clearance through normal send admission.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["subdomain","expected_fqdn"],"additionalProperties":false,"properties":{"subdomain":{"type":"string","maxLength":63,"description":"Requested hosted address name"},"expected_fqdn":{"type":"string","description":"Current brand_subdomain.fqdn"}}}}}},"responses":{"200":{"description":"Updated brand; an exact retry returns the same address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Brand"}}}},"409":{"description":"The address changed, or affected delivery work is still active. Nothing was changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The name is prohibited or taken, the account allowance is exhausted, or the inbox cannot preserve more addresses. Nothing was changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Request or claim rate exceeded. Retry-After specifies the wait in seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The shared service is unavailable. Nothing was changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/brands/{sid}/hosted_sender_availability":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"get":{"tags":["Brands"],"operationId":"getHostedSenderAvailability","summary":"Check whether a Nitrosend address can be reserved","description":"Advisory read for choosing the brand's Nitrosend address before it is reserved. Uses the same normalizer and uniqueness check as reservation, so the returned `subdomain` is exactly what `prepare_sending` would reserve. Never writes.","parameters":[{"name":"subdomain","in":"query","required":true,"schema":{"type":"string"},"description":"Requested subdomain label under the hosted apex"},{"name":"local_part","in":"query","required":false,"schema":{"type":"string"},"description":"Requested local part, checked with the same policy reservation applies; omitted means the allocator's default."}],"responses":{"200":{"description":"Availability result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HostedSenderAvailability"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/brands/{sid}/deletion_safety":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"get":{"tags":["Brands"],"operationId":"getBrandDeletionSafety","summary":"Get deletion safety for a brand","description":"Returns authoritative deletion impact counts and active-send state for the confirmation UI.","responses":{"200":{"description":"Brand deletion safety","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandDeletionSafety"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/brands/{sid}/scrape":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"post":{"tags":["Brands"],"operationId":"scrapeBrandKit","summary":"Scan a business website and apply its Brand Kit","description":"A refused website answers 422 with error_code email_address, free_mail, platform_page, example_address or invalid.","parameters":[{"$ref":"#/components/parameters/BrandScanIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandWebsiteInput"}}}},"responses":{"202":{"description":"Admitted scan, including the same reference on an idempotent retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandScanAdmission"}}}},"400":{"description":"Invalid idempotency key"},"409":{"description":"Idempotency key already used for another website"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/brands/{sid}/onboarding":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"get":{"tags":["Brands"],"operationId":"getBrandOnboarding","summary":"Get brand onboarding state","responses":{"200":{"description":"Onboarding state for the brand","content":{"application/json":{"schema":{"type":"object","properties":{"steps":{"type":"object","description":"Current state of each onboarding step"},"progress":{"type":"object","properties":{"completed":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/brands/{sid}/onboarding/steps":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"post":{"tags":["Brands"],"operationId":"completeBrandOnboardingStep","summary":"Complete a brand onboarding step","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["step"],"properties":{"step":{"type":"string","enum":["brand_kit_setup","domain_verified","first_contact","first_send"]}}}}}},"responses":{"200":{"description":"Updated onboarding state","content":{"application/json":{"schema":{"type":"object","properties":{"steps":{"type":"object"},"progress":{"type":"object","properties":{"completed":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/brands/{sid}/scrape_preview":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"post":{"tags":["Brands"],"operationId":"previewBrandWebsite","summary":"Start a website preview","description":"A fresh brand's first scan is kept atomically. An existing kit remains available for explicit review and apply. Leaving the screen does not cancel the job. A refused website answers 422 with error_code email_address, free_mail, platform_page, example_address or invalid.","parameters":[{"$ref":"#/components/parameters/BrandScanIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandWebsiteInput"}}}},"responses":{"202":{"description":"Admitted preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandScanAdmission"}}}},"400":{"description":"Invalid idempotency key"},"409":{"description":"Idempotency key already used for another website"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/brands/{sid}/scrape_preview_status":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"get":{"tags":["Brands"],"operationId":"getBrandWebsiteScanStatus","summary":"Read the named or current brand scan","parameters":[{"in":"query","name":"scan_id","required":false,"schema":{"type":"string"},"description":"Omit to recover this brand's current admitted scan. The reference survives transient progress-cache expiry."}],"responses":{"200":{"description":"Current transient scan result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandScanStatus"}}}},"404":{"description":"Unknown or expired progress. The setup center retains any admitted reference.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandScanStatus"}}}}}}},"/v1/my/brands/{sid}/kit_apply":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"post":{"tags":["Brands"],"operationId":"applyBrandKitSelection","summary":"Apply a selected website or file kit preview","description":"Selects an existing completed preview for this brand. Saves only the selected fields and logo, together with the captured website assets and source reference. A newer source selected during asset preparation refuses the older save. No second website capture is performed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["scan_id"],"properties":{"scan_id":{"type":"string"},"fields":{"type":"object","description":"Selected editable Brand Kit fields. Unselected captured fields are not applied.","additionalProperties":true},"include_logo":{"type":"boolean","default":false,"description":"Attach the website preview's captured logo."},"logo":{"type":"string","description":"A signed uploaded logo blob, overriding the preview logo."},"logo_candidate_id":{"type":"string","description":"Selected candidate from a file kit preview."},"template_id":{"type":"string","description":"Selected template from a file kit preview."}}}}}},"responses":{"200":{"description":"Selected kit saved atomically","content":{"application/json":{"schema":{"type":"object","required":["brand"],"properties":{"brand":{"$ref":"#/components/schemas/Brand"},"template":{"type":"object","additionalProperties":true}}}}}},"409":{"description":"A newer source superseded this save"},"422":{"$ref":"#/components/responses/ValidationError"},"503":{"description":"Logo rendering is temporarily unavailable"}}}},"/v1/my/brands/{sid}/sign_in_link":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"post":{"tags":["Brands"],"operationId":"emailBrandSignInLink","summary":"Email the account owner a one-time sign-in link","description":"Sends the account's own address a link that signs its owner in on another device. It works once, lasts three days, and the latest link replaces any before it. Takes no recipient or redirect. Owner only, during an account's first week.","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"Accepted"},"400":{"description":"Missing idempotency key"},"403":{"description":"Not the account owner, or past the first week"}}}},"/v1/sign_in_links/consume":{"post":{"tags":["Auth"],"operationId":"consumeSignInLink","summary":"Sign in with a one-time link","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string"}}}}}},"responses":{"200":{"description":"A session token and the account and brand to open"},"404":{"description":"Not a link we issued"},"410":{"description":"Expired or already used"}}}},"/v1/sign_in_links/resend":{"post":{"tags":["Auth"],"operationId":"resendSignInLink","summary":"Send a fresh link to the owner of an expired one","description":"Always answers 202, and sends only to the account's own address, so it says nothing about whether the token named an account.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string"}}}}}},"responses":{"202":{"description":"Accepted"}}}},"/v1/my/brands/{sid}/welcome_email":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"post":{"tags":["Brands"],"operationId":"requestBrandWelcomeEmail","summary":"Ask for the brand's welcome email","description":"Writes the welcome email when the brand has none, again after a failure or once the Brand Kit is a different business; otherwise leaves it as it stands. Progress arrives in the setup center's `welcome_email`.","responses":{"202":{"description":"Setup center state, with the welcome email's progress","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupCenterPayload"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/brands/{sid}/nitrollm_learning":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"get":{"tags":["Brands"],"operationId":"getBrandNitrollmLearning","summary":"Read the brand's subject-test learning decision and disclosure","responses":{"200":{"description":"Current disclosure, decision and viewer permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandNitrollmLearning"}}}}}},"patch":{"tags":["Brands"],"operationId":"updateBrandNitrollmLearning","summary":"Record the direct brand owner's decision","description":"Requires the owner's own Nitrosend sign-in and the exact current disclosure revision.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["decision","disclosure_revision"],"properties":{"decision":{"type":"string","enum":["opt_in","decline","withdraw"]},"disclosure_revision":{"type":"string"}}}}}},"responses":{"200":{"description":"Recorded decision","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandNitrollmLearning"}}}},"403":{"description":"The request did not come from the direct owner"},"409":{"description":"The disclosure changed or the brand has no eligible result"},"422":{"description":"The requested decision is invalid"}}}},"/v1/my/brands/{sid}/setup_center":{"parameters":[{"$ref":"#/components/parameters/BrandSid"}],"get":{"tags":["Brands"],"operationId":"getBrandSetupCenter","summary":"Get brand setup center state","responses":{"200":{"description":"Setup center state for the brand","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupCenterPayload"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Brands"],"operationId":"updateBrandSetupCenter","summary":"Update brand setup center state","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"seen":{"type":"boolean"},"dismissed":{"type":"boolean"},"sender_choice":{"type":"string","enum":["own","hosted"]},"card":{"type":"string","enum":["brand_kit_scan","import_subscribers","first_email","connect_agent","dns"]},"metadata":{"type":"object","additionalProperties":true}},"description":"Provide one of `seen`, `dismissed`, `sender_choice`, or `card`."}}}},"responses":{"200":{"description":"Updated setup center state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupCenterPayload"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/messages":{"post":{"tags":["Messages"],"operationId":"createMessage","summary":"Send a transactional message","description":"Queue a transactional email or SMS for delivery. When email needs a new\ncontent check, the API returns 201 with the message ID, status `queued`,\nand status_reason_code `content_review_pending`. Nitrosend checks it\nbefore delivery. Poll GET /v1/my/messages/{id} to follow its status.\nOn a temporary check failure, the message remains queued with\nstatus_reason_code `delivery_evidence_pending` and an admission_retry_at.\nNitrosend retries that same message automatically for up to 24 hours.\nContent refusals found after acceptance appear as a failed message with\nfailure_code, failure_reason and, where available, failure_how_to_fix.\nA refusal already known before acceptance may be returned as 422.\nA hold stays queued with status_reason_code `email_under_review` and\nresumes on approval through the original message and delivery checks.\nNo campaign, no audience, no approval required.\nUse for receipts, password resets, OTPs, order confirmations, and system notifications.\nRequires an idempotency key via the `Idempotency-Key` header or the\n`idempotency_key` body field. Reuse a key only for an exact retry: the\nsame key with the same payload returns the original message, and with\na different payload returns 409.\nA top-level field not listed in the request body is ignored and named\nin the response's `ignored_fields`; an otherwise valid request is\ncreated and sent as usual. When a request made with an API key\ncarries such fields, the account owner gets an email, at most once a\nweek, naming the key and the fields.\n","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Required unless idempotency_key is supplied in the body. Prevents duplicate sends on retry. The same key with the same payload returns the original message; the same key with a different payload returns 409.\n"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["channel","to"],"properties":{"channel":{"type":"string","enum":["email","sms"]},"to":{"type":"string","description":"Recipient email address or E.164 phone number"},"cc":{"type":"array","maxItems":10,"items":{"type":"string","format":"email"},"description":"Visible email copies. Each distinct recipient consumes an email credit, daily allowance and sending capacity. Email only."},"bcc":{"type":"array","maxItems":10,"items":{"type":"string","format":"email"},"description":"Hidden email copies, omitted from delivered headers. Counted toward usage just like To and Cc. Email only."},"subject":{"type":"string","description":"Email subject line (required for email channel)"},"body":{"type":"string","description":"Message body. Required for SMS. For email this is plain text (HTML in this field is escaped) and serves as the plain-text alternative when `html` is set. To send HTML, use `html` or `template_id`.\n"},"html":{"type":"string","description":"Pre-rendered HTML body for email, used verbatim as the HTML part (not escaped). Use this to send your own fully-rendered HTML. Mutually exclusive with `template_id` (email only). Personalization syntax inside ordinary HTML comments is ignored; visible and Outlook conditional content is validated.\n"},"template_id":{"type":"integer","description":"Load email design from an existing template (email only)"},"contact_id":{"type":"integer","description":"Optional contact to personalize with when rendering a template"},"from":{"type":"string","description":"Verified sender email for this email message. May include a display name, for example \"Acme \u003chello@example.com\u003e\". The address must be on a sending domain this brand has verified, be one of its Inbox addresses, or be the brand's selected connected mailbox. Another connected mailbox's address is refused.\n"},"from_email":{"type":"string","description":"Verified sender email for this email message. Alias of `from`, with the same rules."},"from_name":{"type":"string","description":"Sender display name for this email message"},"reply_to":{"type":"string","description":"Reply-to email address for this email message"},"headers":{"type":"object","description":"Provider headers for this email message. Structural and Nitrosend-reserved headers are rejected.\n","additionalProperties":{"type":"string"}},"tags":{"type":"object","description":"Provider tags for this email message. Nitrosend-reserved tag keys are rejected and system tags are always controlled by Nitrosend. For SES senders, names and values may contain only ASCII letters, numbers, underscores and hyphens, up to 256 characters. Unsupported tags return 422 before queuing.\n","additionalProperties":{"type":"string"}},"data":{"type":"object","description":"Merge variables","additionalProperties":true},"mail_action":{"$ref":"#/components/schemas/MailActionDescription","description":"A Mail Action Protocol 0.3 description of any type. Nitrosend parses it as MAP JSON within the core limits, validates it against the canonical MailSchema core schema and adds it as a designated application/ld+json part in a partial multipart/related representation. Delivery requires a raw-message provider. The description carries no service credential or authorization grant.\n"},"idempotency_key":{"type":"string","minLength":1,"description":"Stable idempotency key (alternative to the header). One of the two is required.\n"},"unless_inbound_since":{"type":"string","format":"date-time","description":"Send only if the recipient hasn't emailed this Brand since this time. It's checked when the message is queued, which answers 422 with error type `inbound_since`, and again when the message goes out, so a message held for pacing still stops on a reply; it then reads back as refused.\n"}}}}}},"responses":{"201":{"description":"Message created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageSendResult"}}}},"200":{"description":"Existing message returned for idempotency replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageSendResult"}}}},"400":{"description":"Missing idempotency key (`idempotency_key_required`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"$ref":"#/components/responses/PlanRequired"},"409":{"description":"Idempotency conflict or explicit sender selection required; no new message is retained in either case","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"code":{"type":"integer","example":409},"message":{"type":"string"},"error":{"type":"boolean","example":true},"error_code":{"type":"string","enum":["idempotency_conflict"]}}},{"type":"object","required":["code","message","error","error_code","retryable","brand_subdomain"],"properties":{"code":{"type":"string","enum":["sender_identity_selection_required"]},"message":{"type":"string"},"error":{"type":"boolean","const":true},"error_code":{"type":"string","enum":["sender_identity_selection_required"]},"retryable":{"type":"boolean"},"brand_subdomain":{"$ref":"#/components/schemas/BrandSubdomain"}}}]}}}},"422":{"description":"Validation failed, or the send was refused. When the message itself is invalid, the body also lists the request's ignored top-level fields in `ignored_fields`. When the safety check couldn't read the email (`error_code` `image_unavailable` or `content_needs_changes`), the body carries `reason_code`, `how_to_fix` and `details`.\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"validation_errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"ignored_fields":{"type":"array","items":{"type":"string"}}}},{"$ref":"#/components/schemas/SendRefusalDetail"}]}}}},"503":{"description":"Admission evidence or the shared hosted-sender root is temporarily unavailable","content":{"application/json":{"schema":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","required":["error_code","retryable","retry_at"],"properties":{"error_code":{"type":"string","enum":["delivery_evidence_pending"]},"retryable":{"type":"boolean","const":true},"retry_at":{"type":"string","format":"date-time"}}}]},{"type":"object","required":["code","message","error","error_code","retryable","brand_subdomain"],"properties":{"code":{"type":"string","enum":["hosted_sender_root_unavailable"]},"message":{"type":"string"},"error":{"type":"boolean","const":true},"error_code":{"type":"string","enum":["hosted_sender_root_unavailable"]},"retryable":{"type":"boolean","const":true},"brand_subdomain":{"$ref":"#/components/schemas/BrandSubdomain"}}}]}}}}}},"get":{"tags":["Messages"],"operationId":"listMessages","summary":"List messages","description":"Returns all messages by default. Use source_type to narrow to campaign,\nflow, transactional, or test sends.\n","parameters":[{"name":"source_type","in":"query","schema":{"type":"string","enum":["all","campaign","flow","transactional","test"]},"description":"Filter by source. Omit or use 'all' for everything."},{"name":"flow_id","in":"query","schema":{"type":"integer"},"description":"Filter to messages from a specific flow"},{"name":"campaign_id","in":"query","schema":{"type":"integer"},"description":"Filter to messages from a specific campaign"},{"name":"date","in":"query","schema":{"type":"string","format":"date"},"description":"Filter to messages created on this date"},{"name":"channel","in":"query","schema":{"type":"string","enum":["email","sms"]}},{"name":"status","in":"query","schema":{"type":"string","enum":["queued","sent","failed"]}},{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Paginated list of messages","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Message"}}}}}}}},"/v1/my/messages/sends":{"get":{"tags":["Messages"],"operationId":"listMessageSends","summary":"Sending log rows, filter counts and email engagement (Activity)","description":"Groups the brand's messages into Sending log rows: one per campaign, one per standalone flow, and one per creation day for transactional messages and for test sends. A `since` window selects messages by the time they were sent, or by the time they were created while they have no send time (queued or failed messages). This is the same window as the email engagement cohort. One request time anchors every part of the response. `engagement` is the engagement of the emails the provider accepted in that window for the same source (test sends excluded), counted once per email. Each campaign, flow and transactional row takes its `delivered`, `opened`, `clicked` and rates from it, so on those rows `opened \u003c= delivered \u003c= sent`. Rows of the failed-only view (`failed=true`) list no accepted email and report no engagement. Rows are ordered by last send and limited by `limit`, while `engagement.summary` covers every email in the window, so row sums can be below it. Responses are cached for 45 seconds.\n","parameters":[{"name":"source_type","in":"query","required":false,"description":"Restrict to one source. Omit for every source.","schema":{"type":"string","enum":["campaign","flow","transactional","test"]}},{"name":"since","in":"query","required":false,"description":"Window by send time (creation time while unsent). Omit for all time.","schema":{"type":"string","enum":["today","7d","30d","3m"]}},{"name":"failed","in":"query","required":false,"description":"Only failed messages. Their rows report no engagement.","schema":{"type":"boolean"}},{"name":"campaign_id","in":"query","required":false,"description":"Only messages of this campaign's flows.","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Maximum rows (1-100, default 50). Counts and engagement are not limited.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}],"responses":{"200":{"description":"Sending log rows, filter counts and the Activity engagement.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageSendsResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/my/messages/{id}":{"get":{"tags":["Messages"],"operationId":"getMessage","summary":"Get a transactional message","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/messages/{id}/preview":{"get":{"tags":["Messages"],"operationId":"previewMessage","summary":"Render a message subject and HTML for preview","description":"Returns the as-composed subject and HTML for an email message from any send source. The stored subject is interpolated with the same preview merge context as its template (rendered design), raw `html`, or escaped plain-text `body`. Stored message fields are not changed. This is a current preview, not a historical delivered-message snapshot. Non-email or unrenderable messages (deleted/design-less template) return a typed empty body state (`empty: true`) rather than an error; an email subject can still be rendered when the body is empty.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Rendered preview, or a typed empty state.","content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string","nullable":true,"description":"Rendered subject as plain text, not HTML-escaped. Null for non-email messages or a blank stored subject. Independent of the body empty state; consumers should display it as text.\n"},"html":{"type":"string","nullable":true,"description":"Rendered HTML, or null when empty is true."},"format":{"type":"string","nullable":true,"enum":["template","raw","plain"],"description":"Composition source of the html, or null when empty."},"empty":{"type":"boolean","description":"True when no HTML could be rendered (see reason)."},"reason":{"type":"string","nullable":true,"enum":["not_previewable","template_no_design","template_missing","template_render_error"],"description":"Why the preview is empty, when empty is true."}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/suppressions":{"get":{"tags":["Suppressions"],"operationId":"listSuppressions","summary":"List suppressions","description":"Returns the authenticated account's current suppression records by\ndefault, including bounded provider diagnostics when the source\nfeedback event is available.\n","parameters":[{"name":"id","in":"query","schema":{"type":"integer"},"description":"Filter to a specific suppression ID"},{"name":"email","in":"query","schema":{"type":"string","format":"email"},"description":"Filter to a specific suppressed email address"},{"name":"reason","in":"query","schema":{"type":"string","enum":["hard_bounce","soft_bounce","complaint","manual","admin","unsubscribe","verification","marketing_withheld","unconfirmed"]}},{"name":"source_provider","in":"query","schema":{"type":"string"},"description":"Filter by provider that emitted the source event"},{"name":"active","in":"query","schema":{"type":"boolean","default":true},"description":"Defaults to true. Set false to list expired suppressions."},{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Paginated list of suppressions","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Suppression"}}}}}}},"post":{"tags":["Suppressions"],"operationId":"addSuppression","summary":"Stop the brand's mail to one address","description":"Records a stop for the current brand: an `unsubscribe` blocks\nmarketing email, a `complaint` or `bounce` all email. Use it for a\nstop the caller learned of itself, such as a reply asking not to be\nwritten to. Adding the same stop again keeps the one stop.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","reason"],"properties":{"email":{"type":"string","format":"email"},"reason":{"type":"string","enum":["unsubscribe","complaint","bounce"]}}}}}},"responses":{"201":{"description":"The address is stopped","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string"},"suppressed":{"type":"boolean"},"reason":{"type":"string"}}}}}},"422":{"description":"The email or reason can't be read"}}}},"/v1/my/messages/lookup":{"get":{"tags":["Messages"],"operationId":"lookupMessage","summary":"Read a message back by its key","description":"One message of the current brand by the idempotency key it was sent\nunder, or its id, as a mail client reads it back: what was asked to be\nsent, its thread, and its `status`. A message can be accepted now and\ngo out later, paced by its mailbox: `scheduled` (with\n`scheduled_for`), `sent` (with `sent_at`), `refused` before it went\n(with `refusal`), or `failed`. `item` is null when no message has the\nkey or id.\n","parameters":[{"name":"idempotency_key","in":"query","schema":{"type":"string"}},{"name":"id","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"The message, or null","content":{"application/json":{"schema":{"type":"object","required":["item"],"properties":{"item":{"type":["object","null"],"properties":{"id":{"type":"string"},"idempotency_key":{"type":["string","null"]},"thread_id":{"type":"string","description":"m and the id of the thread's first message."},"rfc_message_id":{"type":["string","null"]},"to":{"type":"string"},"from_email":{"type":["string","null"]},"from_name":{"type":["string","null"]},"reply_to":{"type":["string","null"]},"subject":{"type":["string","null"]},"body":{"type":["string","null"]},"in_reply_to":{"type":["string","null"]},"status":{"type":"string","enum":["pending","scheduled","sent","refused","failed"]},"status_reason_code":{"type":"string","nullable":true},"status_reason":{"type":"string","nullable":true},"admission_retry_at":{"type":"string","format":"date-time","nullable":true},"scheduled_for":{"type":["string","null"],"format":"date-time"},"sent_at":{"type":["string","null"],"format":"date-time"},"refusal":{"type":["object","null"],"properties":{"code":{"type":"string","description":"Why it was refused, such as inbound_since or recipient_suppressed."},"reason":{"type":["string","null"]}}}}}}}}}},"400":{"description":"Neither or both of idempotency_key and id were given"}}}},"/v1/my/suppressions/check":{"get":{"tags":["Suppressions"],"operationId":"checkSuppression","summary":"What stops a send to one address","description":"Whether a send from the current brand to one address is stopped, and\nby what: global stops, the account's and the brand's own, as a send\nis checked. `suppressed` is true when any stop applies to marketing\nemail. Each stop says whether it blocks `marketing` only (an\nunsubscribe) or `all` mail (a bounce or complaint), so a reply to\nsomeone who wrote can still go where only marketing is stopped.\n","parameters":[{"name":"email","in":"query","required":true,"schema":{"type":"string","format":"email"}}],"responses":{"200":{"description":"The address's stops","content":{"application/json":{"schema":{"type":"object","required":["address","suppressed","stops"],"properties":{"address":{"type":"string"},"suppressed":{"type":"boolean"},"reason":{"type":["string","null"],"description":"The latest stop's reason."},"stops":{"type":"array","items":{"type":"object","properties":{"scope":{"type":"string","enum":["global","account","brand"]},"reason":{"type":"string"},"blocks":{"type":"string","enum":["marketing","all"]},"occurred_at":{"type":["string","null"],"format":"date-time"}}}}}}}}},"400":{"description":"No email was given"}}}},"/v1/my/webhooks/events":{"get":{"tags":["Webhooks"],"operationId":"listWebhookEvents","summary":"Read webhook events without an endpoint","description":"The events the current brand's webhooks receive, read after a cursor\ninstead of pushed, oldest first: `email.received`, `email.delivered`,\n`email.bounced` and `email.complained`. Each event is the body its\nwebhook receives, with the `id` its delivery carries as `webhook-id`,\nso a receiver that takes webhooks and catches up here sees each event\nonce. `payload=agent` gives the bodies an MCP Events subscriber\nreceives instead: every field bounded, and a reply's text sanitized,\nwith no HTML.\n\nWithout `after`, it returns no events and the cursor to start from;\nwith `from=start` and no `after`, it reads from the beginning. Pass\neach response's `cursor` as the next `after`; `more` is true while\nfurther events are ready. A page read again returns the same events.\nAn event is returned once it is 30 seconds old. Reading\n`email.received` with a delegated credential needs inbox access as\nwell.\n","parameters":[{"name":"after","in":"query","schema":{"type":"string"},"description":"The cursor a previous response returned."},{"name":"from","in":"query","schema":{"type":"string","enum":["start"]},"description":"With no `after`, read from the beginning instead of from now."},{"name":"events","in":"query","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["email.received","email.delivered","email.bounced","email.complained"]}},"description":"The events to read, comma-separated; all four when absent."},{"name":"payload","in":"query","schema":{"type":"string","enum":["full","agent"],"default":"full"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}],"responses":{"200":{"description":"The events after the cursor, and the cursor to read from next","content":{"application/json":{"schema":{"type":"object","required":["events","cursor","more"],"properties":{"events":{"type":"array","items":{"allOf":[{"type":"object","required":["id"],"properties":{"id":{"type":"string","description":"The event's id, `evt_` and a UUID: the `webhook-id` its webhook delivery carries."}}},{"oneOf":[{"$ref":"#/components/schemas/WebhookEventPayload"},{"$ref":"#/components/schemas/WebhookReceivedEventPayload"}]}]}},"cursor":{"type":"string"},"more":{"type":"boolean"}}}}}},"400":{"description":"The cursor, start, events, payload or limit can't be read"},"403":{"description":"A delegated credential without inbox access asked for `email.received`"}}}},"/v1/my/webhooks":{"get":{"tags":["Webhooks"],"operationId":"listWebhooks","summary":"List webhooks","description":"The current brand's webhook endpoints, oldest first, each with its newest delivery. Secrets are masked.","parameters":[{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Paginated list of webhooks","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Webhooks"],"operationId":"createWebhook","summary":"Register a webhook endpoint","description":"Registers an HTTPS endpoint to receive the chosen events for the\nbrand's transactional email. The response carries the signing secret\nin full; later reads mask it unless `reveal=true`. A brand can have at\nmost 10 webhooks. The URL must resolve only to public addresses.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookWriteRequest"},{"required":["url","events"]}]}}}},"responses":{"201":{"description":"Webhook created, secret revealed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/webhooks/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Webhooks"],"operationId":"getWebhook","summary":"Get a webhook","parameters":[{"name":"reveal","in":"query","schema":{"type":"boolean","default":false},"description":"Return the signing secret in full."}],"responses":{"200":{"description":"Webhook","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Webhooks"],"operationId":"updateWebhook","summary":"Update a webhook","description":"Changes the URL, the events, or whether the webhook is on. Turning it\noff fails the deliveries it still owed; turning it on clears its\nfailing state. Events that occur while it is off are not sent.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookWriteRequest"}}}},"responses":{"200":{"description":"Webhook updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}},"delete":{"tags":["Webhooks"],"operationId":"deleteWebhook","summary":"Delete a webhook and its delivery history","responses":{"200":{"description":"Webhook deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/webhooks/{id}/test":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Webhooks"],"operationId":"testWebhook","summary":"Send a test event","description":"Queues a sample event of the chosen type to this webhook through the\nnormal delivery path, signed and retried like a real event. Its data\ncarries `test: true` and no message id.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/WebhookEventType"}}}}}},"responses":{"202":{"description":"Test event queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"Unknown event type, or the webhook is off","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/webhooks/{id}/deliveries":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Webhooks"],"operationId":"listWebhookDeliveries","summary":"List a webhook's deliveries","description":"The last 7 days of deliveries to this webhook, newest first.","parameters":[{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Paginated list of deliveries","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/chat_sessions":{"get":{"tags":["Chat Sessions"],"operationId":"listChatSessions","summary":"List persisted chat sessions","parameters":[{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Paginated list of chat sessions","headers":{"X-Total-Count":{"schema":{"type":"integer"}},"X-Total-Pages":{"schema":{"type":"integer"}},"X-Page-Number":{"schema":{"type":"integer"}},"X-Next-Page":{"schema":{"type":"integer"}},"X-Prev-Page":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ChatSession"}}}}}}}},"/v1/my/chat_sessions/{id}":{"get":{"tags":["Chat Sessions"],"operationId":"getChatSession","summary":"Get a persisted chat session with ordered messages","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Chat session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatSessionDetail"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/chat_sessions/{id}/close":{"patch":{"tags":["Chat Sessions"],"operationId":"closeChatSession","summary":"Close an active persisted chat session","description":"A request from an embedded Shopify session closes only a session that\nsession's install started; any other session answers 404.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Closed chat session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatSession"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/billing/paid_action_intents":{"post":{"tags":["Billing"],"operationId":"createPaidActionIntent","summary":"Create or exactly replay a resumable paid operation","description":"Persists encrypted, operation-owned continuation state. The intent is\nnot spend authority and never executes the operation automatically.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaidActionIntentCreate"}}}},"responses":{"200":{"description":"Exact idempotent replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaidActionIntent"}}}},"201":{"description":"Continuation created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaidActionIntent"}}}},"409":{"description":"Operation key reused with different continuation state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/my/billing/paid_action_intents/{id}":{"get":{"tags":["Billing"],"operationId":"getPaidActionIntent","summary":"Restore and re-quote a paid operation","parameters":[{"$ref":"#/components/parameters/PaidActionIntentId"}],"responses":{"200":{"description":"Actor-scoped continuation with current terms","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaidActionIntent"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/my/billing/paid_action_intents/{id}/cancel":{"post":{"tags":["Billing"],"operationId":"cancelPaidActionIntent","summary":"Cancel and scrub a paid-operation continuation","parameters":[{"$ref":"#/components/parameters/PaidActionIntentId"}],"responses":{"200":{"description":"Canceled continuation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaidActionIntent"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Terminal continuation cannot be canceled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/my/billing/paid_action_intents/{id}/consume":{"post":{"tags":["Billing"],"operationId":"consumePaidActionIntent","summary":"Mark a successfully executed paid operation consumed","parameters":[{"$ref":"#/components/parameters/PaidActionIntentId"}],"responses":{"200":{"description":"Consumed continuation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaidActionIntent"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Continuation is not ready to consume","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/flow_demo":{"post":{"tags":["Public"],"operationId":"startGuestFlowDemo","summary":"Start an anonymous brand scan for a flow demo","description":"Creates a short-lived isolated demo workspace, not a visitor account,\nthen scans the site and writes a flow for the goal. Requires a fresh\nCloudflare Turnstile token for every attempt. Rate limited per IP (10\nan hour, 20 a day); verified starts also count against a global daily\ncap.\n","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["domain","goal","turnstile_token"],"properties":{"domain":{"type":"string","maxLength":253},"goal":{"type":"string","maxLength":1000},"turnstile_token":{"type":"string","description":"Single-use Turnstile token for the flow_demo_start action"}}}}}},"responses":{"202":{"description":"Scan started","content":{"application/json":{"schema":{"type":"object","required":["token","status","revision"],"properties":{"token":{"type":"string","description":"Opaque bearer token kept on the visitor's device"},"status":{"type":"string","enum":["scanning"]},"revision":{"type":"integer"}}}}}},"422":{"description":"Invalid or private website or goal (`flow_demo_invalid`), or a\nmissing or failed bot check (`flow_demo_bot_check_failed`).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Per-IP demo start limit reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The demo is unavailable or its daily cap is spent\n(`flow_demo_unavailable`).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Public"],"operationId":"getGuestFlowDemo","summary":"Read an anonymous flow demo","description":"A demo past its scan deadline (3 minutes) or its generation deadline\n(8 minutes) reads as failed.\n","security":[],"parameters":[{"name":"X-Flow-Demo-Token","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Current demo state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuestFlowDemo"}}}}}}},"/v1/public/flow_demo/review":{"post":{"tags":["Public"],"operationId":"reviewGuestFlowBrand","summary":"Edit the scanned Brand Kit and regenerate the flow","description":"Changed fields start one regeneration under a new revision; unchanged\nfields change nothing. Each demo has four generation attempts in total.\n","security":[],"parameters":[{"name":"X-Flow-Demo-Token","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["fields"],"properties":{"fields":{"type":"object","additionalProperties":true}}}}}},"responses":{"200":{"description":"The demo after the edit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuestFlowDemo"}}}},"422":{"description":"Expired or unscanned demo, or a field that is not an editable brand\nfield (`flow_demo_invalid`); no attempts left\n(`flow_demo_attempts_exhausted`).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/flow_demo/generate":{"post":{"tags":["Public"],"operationId":"generateGuestFlowDemo","summary":"Retry a demo that failed during generation","description":"Starts one regeneration under a new revision. Any other demo is\nreturned unchanged. A demo that failed during the scan cannot be\nretried: start again.\n","security":[],"parameters":[{"name":"X-Flow-Demo-Token","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The demo after the retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuestFlowDemo"}}}},"422":{"description":"Expired demo or a failed scan (`flow_demo_invalid`); no attempts\nleft (`flow_demo_attempts_exhausted`).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/flow_demo/spec":{"get":{"tags":["Public"],"operationId":"getGuestFlowEditorSpec","summary":"Get guest-safe Flow Builder steps and triggers","security":[],"responses":{"200":{"description":"Flow editor schema restricted to guest-authorable actions","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/v1/public/templates/{id}":{"get":{"tags":["Public"],"operationId":"getPublicEmailCatalogTemplate","summary":"Get a canonical email template for guest editing","description":"Returns one known system catalog template as concrete, validated editor\nJSON. Catalog theme markers are resolved before the response. The\nresponse contains no account-specific data and does not create a saved\ntemplate.\n","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"revision","in":"query","required":false,"description":"Open only the design revision shown in a published gallery preview.","schema":{"type":"string","pattern":"^[a-f0-9]{64}$"}}],"responses":{"200":{"description":"Canonical catalog template","headers":{"Cache-Control":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicEmailCatalogTemplate"}}}},"409":{"description":"The requested preview revision is no longer current. The visitor can explicitly open the current version.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/public/templates/spec":{"get":{"tags":["Public"],"operationId":"getPublicEmailComponentSpec","summary":"Get the email editor schema for guest editing","description":"Returns the canonical component and theme schema used by the email editor.","security":[],"responses":{"200":{"description":"Email component schema","headers":{"Cache-Control":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailComponentSpec"}}}}}}},"/v1/public/contacts":{"post":{"tags":["Public"],"operationId":"createPublicContact","summary":"Create or update a public contact (website forms)","description":"Public signup endpoint for website forms. Authenticate with a\nwpkey_live_… public key. A captured signup returns 201 { ok: true }\nwhether the address is new, already subscribed or not subscribed;\nthis preserves idempotency and avoids leaking which emails are on\nthe list or have unsubscribed. Error responses are unchanged.\n\nA new address is subscribed and added to the list as before. An\naddress the brand already holds as not subscribed (for example one\nthat unsubscribed, including one whose deleted contact left its\nunsubscribe behind) is never subscribed by this endpoint. Instead of\nadding it to the list, it asks the address to confirm by email: at\nmost once a week per list, and only when the brand can send that\nemail. The address joins the list when its owner confirms. A\nsuppressed address (bounced, complained or blocked) is added to the\nlist as before, gets no confirmation email, and its subscription is\nleft as it was.\n\nUse the brand's public key (wpkey_live_…). Secret keys\n(nskey_live_…) are rejected on this endpoint.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","list_id"],"properties":{"email":{"type":"string","format":"email","description":"Subscriber email address."},"list_id":{"type":"integer","description":"ID of a contact list owned by the brand whose public key is presented."},"first_name":{"type":"string","nullable":true,"description":"Optional first name written to the contact."},"last_name":{"type":"string","nullable":true,"description":"Optional last name written to the contact."},"phone":{"type":"string","nullable":true,"description":"Optional E.164 phone number written to the SMS channel if provided."},"source":{"type":"string","nullable":true,"description":"Optional free-text label, e.g. \"footer-form\" or \"/pricing\", recorded against the signup."},"data":{"type":"object","additionalProperties":true,"nullable":true,"description":"Optional bag of custom contact data. Reserved keys are silently dropped."}}}}}},"responses":{"201":{"description":"Contact accepted","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","const":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/app":{"get":{"tags":["Public"],"operationId":"getPlans","summary":"Get available plans","security":[],"responses":{"200":{"description":"Active plans","content":{"application/json":{"schema":{"type":"object","properties":{"plans":{"type":"array","items":{"$ref":"#/components/schemas/Plan"}},"stripe_publishable_key":{"type":"string","nullable":true}}}}}}}}},"/v1/staff/comps":{"post":{"tags":["Operator"],"operationId":"grantPartnerAccess","summary":"Make an existing account a partner","description":"Requires a staff user. Grants the Affiliates tab (`affiliate_center`) and Client\nManagement (`managed_clients`). The account keeps its plan and billing is untouched.\nIdentify the account with exactly one of `account_id`, `user_id` or `email`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"integer"},"user_id":{"type":"integer"},"email":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"Partner access enabled, or already enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StaffPartnerGrantResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"Partner access was revoked by an admin and is not re-granted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/operator/activity":{"get":{"tags":["Operator"],"operationId":"readOperatorActivity","summary":"Compare product activity across two completed UTC periods","description":"Requires a staff or admin API key.","parameters":[{"name":"period","in":"query","required":true,"schema":{"type":"string","enum":["daily","weekly"]}},{"name":"end_before","in":"query","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Compare product activity across two completed UTC periods","content":{"application/json":{"schema":{"type":"object","required":["source","timezone","measured_at","period","current","previous"],"properties":{"current":{"$ref":"#/components/schemas/OperatorActivityWindow"},"previous":{"$ref":"#/components/schemas/OperatorActivityWindow"}}}}}},"400":{"description":"Invalid period or UTC boundary"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/operator/daily_digest":{"get":{"tags":["Operator"],"operationId":"readOperatorDailyDigest","summary":"Read the team digest metrics and current support queue","description":"Requires a staff or admin API key.","responses":{"200":{"description":"Read the team digest metrics and current support queue","content":{"application/json":{"schema":{"type":"object","required":["source","measured_at","activity_end_before","currency","counts","paid","mrr","support"],"properties":{"counts":{"description":"Current and previous values for waitlist signups, customer signups, DAU, WAU, daily emails, weekly emails and contacts added.","type":"object"},"paid":{"description":"Current and previous 24-hour and 7-day conversion counts and collected revenue in cents.","type":"object"},"mrr":{"description":"Gross USD monthly recurring revenue in cents and contributing subscriptions. Unavailable values are null.","type":"object"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/operator/onboarding":{"get":{"tags":["Operator"],"operationId":"readOperatorOnboarding","summary":"Read recent accounts and observed onboarding milestones","description":"Requires a staff or admin API key. Continue with next_before_id and the same cohort_at.","parameters":[{"name":"before_id","in":"query","schema":{"type":"integer","minimum":1}},{"name":"cohort_at","in":"query","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"A page of up to 25 recently created accounts and their latest observed milestones","content":{"application/json":{"schema":{"type":"object","required":["source","measured_at","cohort_since","cohort_at","accounts","next_before_id"],"properties":{"source":{"const":"nitrosend.onboarding"},"measured_at":{"type":"string","format":"date-time"},"cohort_since":{"type":"string","format":"date-time"},"cohort_at":{"type":"string","format":"date-time"},"accounts":{"type":"array","items":{"type":"object","required":["account_id","created_at"]}},"next_before_id":{"type":["integer","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/operator/reviews/sender_health":{"get":{"tags":["Operator"],"operationId":"readOperatorSenderHealthReview","summary":"Read recent deliverability alerts","description":"Requires a staff or admin API key. Continue with next_after_id, even when this page has no findings.","parameters":[{"name":"after_id","in":"query","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"A bounded review page with source, observation time, population inspected, findings and continuation","content":{"application/json":{"schema":{"type":"object","required":["source","measured_at","inspected","items","next_after_id"],"properties":{"source":{"const":"nitrosend.sender_health"},"measured_at":{"type":"string","format":"date-time"},"inspected":{"type":"integer","minimum":0,"maximum":25},"items":{"type":"array","items":{"type":"object"}},"next_after_id":{"type":["integer","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/operator/reviews/reliability":{"get":{"tags":["Operator"],"operationId":"readOperatorReliabilityReview","summary":"Read unresolved issue-intake threads","description":"Requires a staff or admin API key. Continue with next_after_id, even when this page has no findings.","parameters":[{"name":"after_id","in":"query","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"A bounded review page with source, observation time, population inspected, findings and continuation","content":{"application/json":{"schema":{"type":"object","required":["source","measured_at","inspected","items","next_after_id"],"properties":{"source":{"const":"nitrosend.reliability"},"measured_at":{"type":"string","format":"date-time"},"inspected":{"type":"integer","minimum":0,"maximum":25},"items":{"type":"array","items":{"type":"object"}},"next_after_id":{"type":["integer","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/operator/reviews/account_health":{"get":{"tags":["Operator"],"operationId":"readOperatorAccountHealthReview","summary":"Read usage evidence for commercial paid accounts","description":"Requires a staff or admin API key. Continue with next_after_id, even when this page has no findings.","parameters":[{"name":"after_id","in":"query","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"A bounded review page with source, observation time, population inspected, findings and continuation","content":{"application/json":{"schema":{"type":"object","required":["source","measured_at","inspected","items","next_after_id"],"properties":{"source":{"const":"nitrosend.account_health"},"measured_at":{"type":"string","format":"date-time"},"inspected":{"type":"integer","minimum":0,"maximum":25},"items":{"type":"array","items":{"type":"object"}},"next_after_id":{"type":["integer","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/operator/reviews/pipeline":{"get":{"tags":["Operator"],"operationId":"readOperatorPipelineReview","summary":"Read recent signup accounts classified as commercial prospects","description":"Requires a staff or admin API key. Continue with next_after_id, even when this page has no findings.","parameters":[{"name":"after_id","in":"query","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"A bounded review page with source, observation time, population inspected, findings and continuation","content":{"application/json":{"schema":{"type":"object","required":["source","measured_at","inspected","items","next_after_id"],"properties":{"source":{"const":"nitrosend.pipeline"},"measured_at":{"type":"string","format":"date-time"},"inspected":{"type":"integer","minimum":0,"maximum":25},"items":{"type":"array","items":{"type":"object"}},"next_after_id":{"type":["integer","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/operator/reviews/billing":{"get":{"tags":["Operator"],"operationId":"readOperatorBillingReview","summary":"Read subscription entitlement drift candidates","description":"Requires a staff or admin API key. Continue with next_after_id, even when this page has no findings.","parameters":[{"name":"after_id","in":"query","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"A bounded review page with source, observation time, population inspected, findings and continuation","content":{"application/json":{"schema":{"type":"object","required":["source","measured_at","inspected","items","next_after_id"],"properties":{"source":{"const":"nitrosend.billing"},"measured_at":{"type":"string","format":"date-time"},"inspected":{"type":"integer","minimum":0,"maximum":25},"items":{"type":"array","items":{"type":"object"}},"next_after_id":{"type":["integer","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/operator/support_requests/summary":{"get":{"tags":["Operator"],"operationId":"readOperatorSupportSummary","summary":"Read actionable support counts, due follow-ups and recent cases","description":"Requires a staff or admin API key.","responses":{"200":{"description":"Read actionable support counts, due follow-ups and recent cases","content":{"application/json":{"schema":{"type":"object","required":["source","measured_at","open","waiting","automatic_reviews","due_count","more_due","due","recent"],"properties":{"recent":{"type":"array","maxItems":10,"items":{"type":"object","required":["id","status","subject","opened_at"]}},"due":{"type":"array","maxItems":25,"items":{"type":"object","required":["id","account_id","due_at"]}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/operator/support_requests":{"get":{"tags":["Operator"],"operationId":"listOperatorSupportRequests","summary":"List the production customer-support queue","description":"Requires an `nskey_live_...` API key owned by an admin or staff user. Browser JWTs are rejected.","parameters":[{"name":"status","in":"query","schema":{"type":"string","description":"Comma-separated open","waiting":null,"or resolved states":null}},{"name":"due_only","in":"query","schema":{"type":"boolean","default":false}},{"name":"account_id","in":"query","schema":{"type":"integer"}},{"name":"brand_id","in":"query","schema":{"type":"integer"}},{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Paginated support queue","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OperatorSupportRequest"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/operator/support_requests/{id}":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Operator"],"operationId":"getOperatorSupportRequest","summary":"Get one production support case","responses":{"200":{"description":"Support request, customer account, brand, and latest reply ledger state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperatorSupportCase"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/operator/support_requests/{id}/diagnostics":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"get":{"tags":["Operator"],"operationId":"diagnoseOperatorSupportRequest","summary":"Read bounded live diagnostics for a support case","responses":{"200":{"description":"Current sending, DNS, campaign, and message evidence","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/operator/support_requests/{id}/draft":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Operator"],"operationId":"draftOperatorSupportReply","summary":"Persist a versioned customer reply draft","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["body"],"properties":{"body":{"type":"string"},"runx_receipt_id":{"type":"string","nullable":true}}}}}},"responses":{"201":{"description":"Draft persisted in the reply ledger","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperatorReplyDraft"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/operator/support_requests/{id}/send_reply":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Operator"],"operationId":"sendOperatorSupportReply","summary":"Send one current versioned customer reply","description":"Delivery is fail-closed and requires `confirm: true`; stale draft versions are rejected by the server ledger.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["thread_record_id","draft_version","confirm"],"properties":{"thread_record_id":{"type":"integer"},"draft_version":{"type":"integer"},"confirm":{"type":"boolean","const":true}}}}}},"responses":{"200":{"description":"Reply delivered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperatorReplyDraft"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/operator/support_requests/{id}/disposition":{"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"post":{"tags":["Operator"],"operationId":"dispositionOperatorSupportRequest","summary":"Set the persistent support-case disposition","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["status","confirm"],"properties":{"status":{"type":"string","enum":["open","waiting","resolved"]},"confirm":{"type":"boolean","enum":[true],"description":"Explicit confirmation of the disposition mutation."},"follow_up_at":{"type":"string","format":"date-time","description":"Required only for waiting."}}}}}},"responses":{"200":{"description":"Updated support request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperatorSupportRequest"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}}},"webhooks":{"email.sent":{"post":{"tags":["Webhooks"],"operationId":"emailSentWebhook","summary":"The provider accepted the email","description":"The provider accepted the email. Carries `sent_at`.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEventPayload"}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"email.delivered":{"post":{"tags":["Webhooks"],"operationId":"emailDeliveredWebhook","summary":"The provider reported the email delivered to the recipient's server","description":"The provider reported the email delivered to the recipient's server.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEventPayload"}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"email.bounced":{"post":{"tags":["Webhooks"],"operationId":"emailBouncedWebhook","summary":"The email bounced","description":"The email bounced. Carries `bounce`: its `type` (hard or soft) and the provider's `subtype`.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEventPayload"}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"email.complained":{"post":{"tags":["Webhooks"],"operationId":"emailComplainedWebhook","summary":"The recipient marked the email as spam","description":"The recipient marked the email as spam. Carries `complaint.feedback_type`.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEventPayload"}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"email.opened":{"post":{"tags":["Webhooks"],"operationId":"emailOpenedWebhook","summary":"The recipient opened the email, the first counted open only","description":"The recipient opened the email, the first counted open only. Scanner and bot opens are not counted.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEventPayload"}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"email.clicked":{"post":{"tags":["Webhooks"],"operationId":"emailClickedWebhook","summary":"The recipient clicked a link, the first human click of each link","description":"The recipient clicked a link, the first human click of each link. Carries the `url`.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEventPayload"}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"email.failed":{"post":{"tags":["Webhooks"],"operationId":"emailFailedWebhook","summary":"The email failed for good","description":"The email failed for good. A failure that will be retried, or a provider outcome that is still unknown, is not reported. Carries `failure`: `code`, `reason` and `category`, as `GET /v1/my/messages/{id}` reports them.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEventPayload"}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"email.received":{"post":{"tags":["Webhooks"],"operationId":"emailReceivedWebhook","summary":"A message arrived in the brand's inbox","description":"A message arrived in one of the brand's inboxes and was not quarantined (a reply to one of the brand's emails, an automatic reply, or new mail to the inbox address), or a reply to one of the brand's emails came back into the connected mailbox it was sent from. When it answers a send, `thread_id` is that send's thread and `message_id`, `idempotency_key` and `tags` identify that send as on every other event. Carries the reply's `from`, `to`, `subject`, `text` and `html` (each body capped at 64 KiB, with `truncated`), `auto_submitted`, and every attachment it carried by id, including files Nitrosend kept back (blocked, failed a scan, too large, or not stored). Fetch a file whose `downloadable` is true from `GET /v1/my/conversations/{id}/messages/{message_id}/attachments/{attachment_id}`, adding `acknowledge_unscanned=true` when `download_requires_confirmation` is true; a file that is not downloadable is never served, and `availability_reason` says why. `attachments_omitted` counts files past the per-message attachment limit, which were not kept. Mail to a domain route without an inbox is not stored and emits nothing.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookReceivedEventPayload"}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"campaign.completed":{"post":{"tags":["Webhooks"],"operationId":"campaignCompletedWebhook","summary":"A campaign finished sending","description":"A campaign finished sending to its whole audience.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["campaign.completed"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/CampaignCompletedWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"campaign.failed":{"post":{"tags":["Webhooks"],"operationId":"campaignFailedWebhook","summary":"A campaign send reached no recipient","description":"A campaign send ended before reaching any recipient.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["campaign.failed"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/CampaignFailedWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"campaign.stopped":{"post":{"tags":["Webhooks"],"operationId":"campaignStoppedWebhook","summary":"Nitrosend paused a campaign send","description":"Nitrosend paused a campaign send because its bounce or spam-complaint rate crossed the stop threshold.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["campaign.stopped"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/CampaignStoppedWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"flow.paused":{"post":{"tags":["Webhooks"],"operationId":"flowPausedWebhook","summary":"Nitrosend paused a flow","description":"Nitrosend paused a flow because its bounce or spam-complaint rate crossed the pause threshold.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["flow.paused"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/FlowPausedWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"sending.paused":{"post":{"tags":["Webhooks"],"operationId":"sendingPausedWebhook","summary":"Nitrosend paused all sending on the account","description":"Nitrosend paused all sending on the account. The dashboard and nitro_get_status explain why and what to do. Sent to every brand's webhooks.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["sending.paused"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/SendingPausedWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"sending.limit_approaching":{"post":{"tags":["Webhooks"],"operationId":"sendingLimitApproachingWebhook","summary":"The account is nearing its sending allowance","description":"The account has used most of its rolling 24-hour sending allowance. Sent to every brand's webhooks.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["sending.limit_approaching"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/SendingLimitWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"sending.limit_reached":{"post":{"tags":["Webhooks"],"operationId":"sendingLimitReachedWebhook","summary":"The account reached its sending allowance","description":"The account has used its whole rolling 24-hour sending allowance; sends wait for capacity. Sent to every brand's webhooks.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["sending.limit_reached"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/SendingLimitWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"import.completed":{"post":{"tags":["Webhooks"],"operationId":"importCompletedWebhook","summary":"A contact import finished","description":"A contact import finished.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["import.completed"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/ImportCompletedWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"import.failed":{"post":{"tags":["Webhooks"],"operationId":"importFailedWebhook","summary":"A contact import failed","description":"A contact import failed.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["import.failed"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/ImportFailedWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"domain.verified":{"post":{"tags":["Webhooks"],"operationId":"domainVerifiedWebhook","summary":"A sending domain passed verification","description":"A sending domain passed DNS verification and can send.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["domain.verified"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/DomainVerifiedWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"domain.verification_lost":{"post":{"tags":["Webhooks"],"operationId":"domainVerificationLostWebhook","summary":"A sending domain lost verification","description":"A verified sending domain failed its DNS checks and is no longer verified.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["domain.verification_lost"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/DomainVerificationLostWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"domain.dns_degraded":{"post":{"tags":["Webhooks"],"operationId":"domainDnsDegradedWebhook","summary":"A sending domain's DNS could not be confirmed","description":"A verified sending domain's DNS records could not be confirmed; it stays verified while Nitrosend rechecks.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["domain.dns_degraded"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/DomainDnsDegradedWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}},"webhook.disabled":{"post":{"tags":["Webhooks"],"operationId":"webhookDisabledWebhook","summary":"Nitrosend turned off a webhook","description":"Nitrosend turned off a webhook after three days of failed deliveries. Turn it back on once the endpoint is fixed.","parameters":[{"$ref":"#/components/parameters/WebhookIdHeader"},{"$ref":"#/components/parameters/WebhookTimestampHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["webhook.disabled"]},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/WebhookDisabledWebhookData"}}}}}},"responses":{"200":{"$ref":"#/components/responses/WebhookAcknowledged"}}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"Authentication scheme depends on the route:\n\n- Authenticated endpoints (`/v1/my/*`) accept a server API key\n  (`nskey_live_...`), a Nitrosend JWT, or a verified Shopify App Bridge\n  ID token for an active embedded installation. API key is checked first.\n- Public website-form endpoints (`/v1/public/*`) require a brand\n  public key (`wpkey_live_...`). Secret keys (`nskey_live_...`)\n  are rejected here so they can't be smuggled into browser code.\n\nFor accounts with multiple brands, include the `X-Brand-SID` header to scope\nrequests to a specific brand. If omitted, the account's default\nbrand is used. JWT requests can also include `X-Account-ID` to select\nan accessible account.\n"},"PartnerProvisioningCredential":{"type":"http","scheme":"bearer","bearerFormat":"nspk_live","description":"Manager-account provisioning credential revealed once at issuance."},"ManagementCredential":{"type":"http","scheme":"bearer","bearerFormat":"nsmc_live","description":"One-time-revealed operator_v1 credential pinned to one active management grant and Brand."}},"parameters":{"ResourceId":{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},"PaidActionIntentId":{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":64},"description":"Opaque paid-operation continuation identifier."},"BrandSid":{"name":"sid","in":"path","required":true,"schema":{"type":"string"},"description":"Brand secure identifier"},"PageParam":{"name":"page","in":"query","schema":{"type":"integer","default":1}},"LimitParam":{"name":"limit","in":"query","schema":{"type":"integer","default":25,"maximum":100}},"PerParam":{"name":"per","in":"query","schema":{"type":"integer","default":30,"maximum":100}},"XBrandSID":{"name":"X-Brand-SID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional brand context header. Pass the brand's `sid` to scope the\nrequest to a specific brand. If omitted, the account's default brand\nis used. Required for accounts with multiple brands.\n"},"XAccountID":{"name":"X-Account-ID","in":"header","required":false,"schema":{"type":"integer"},"description":"Optional account context header for JWT-authenticated requests. Pass an\naccessible account id to switch the current account. API-key requests\nignore this header.\n"},"WebhookIdHeader":{"name":"webhook-id","in":"header","required":true,"schema":{"type":"string","example":"evt_0192f3a4-7b1c-7d2e-9f10-2a3b4c5d6e7f"},"description":"Event id, stable across retries. Receivers drop a repeat of an id they have processed."},"WebhookTimestampHeader":{"name":"webhook-timestamp","in":"header","required":true,"schema":{"type":"integer","example":1727690400},"description":"Unix seconds when this attempt was signed. Reject requests more than a few minutes old."},"WebhookSignatureHeader":{"name":"webhook-signature","in":"header","required":true,"schema":{"type":"string","example":"v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="},"description":"`v1,` then the base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{raw body}`,\nkeyed by the base64-decoded part of the webhook's `whsec_` secret.\nAny Standard Webhooks library verifies it.\n"},"SignupDeviceType":{"name":"X-Nitrosend-Device-Type","in":"header","required":false,"description":"Bounded client-declared signup measurement; never authentication or account authority. OAuth preserves it through the existing signed attribution context.","schema":{"type":"string","enum":["computer","phone","tablet"]}},"SignupInAppBrowser":{"name":"X-Nitrosend-In-App-Browser","in":"header","required":false,"description":"Bounded client-declared embedded browser measurement. Omitted or unknown is unclassified, not proof of a standalone browser.","schema":{"type":"string","enum":["Instagram","Facebook","TikTok","LinkedIn","X","Google app","this app"]}},"BrandScanIdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":128},"description":"Reuse only for an exact retry of this website request."},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":255},"description":"Exact-request idempotency key; changed normalized input conflicts."}},"responses":{"SignupCapacityReached":{"description":"Signup acquisition or mail capacity reached. Keep existing credentials and retry after the stated delay; rotating IPs or email domains does not bypass these limits.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1},"description":"Seconds before retrying"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error_code":{"type":"string","enum":["signup_capacity_reached"]},"message":{"type":"string"},"next_action":{"type":"string"}}}}}},"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Not authenticated","headers":{"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"Not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Conflict":{"description":"Request conflicts with durable lifecycle or idempotency state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"QueryTimeout":{"description":"A read did not finish within the request's database time limit (`error_code: query_timeout`). Nothing was changed; retry after the Retry-After interval. Any GET can return this.","headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Gone":{"description":"One-time capability is invalid, expired, rotated, or consumed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"WebhookAcknowledged":{"description":"Any 2xx acknowledges the event. Other responses, timeouts after 10 seconds and redirects are retried."},"ValidationError":{"description":"Validation failed","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"validation_errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}}]}}}},"TooManyRequests":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ServiceUnavailable":{"description":"Upstream service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"AdmissionDeferred":{"description":"Delivery admission is temporarily deferred; retry the same idempotent request at or after `retry_at`","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","required":["error_code","retryable","retry_at"],"properties":{"error_code":{"type":"string","enum":["delivery_evidence_pending"]},"retryable":{"type":"boolean","const":true},"retry_at":{"type":"string","format":"date-time"}}}]}}}},"PlanRequired":{"description":"Live sending needs a plan (`error_code: plan_required`). The account is in Setup mode: its work is saved and test sends still work, but no live email goes out until it is on Starter or above. Nothing was sent, queued, scheduled, approved or published. Show `plan_url` to the user (it opens the plan choice in Billing) and send again once the plan is active. Retrying before then returns the same refusal.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","required":["error_code","how_to_fix","plan_url"],"properties":{"code":{"type":"integer","const":402},"error_code":{"type":"string","enum":["plan_required"]},"how_to_fix":{"type":"string"},"plan_url":{"type":"string","format":"uri"}}}]}}}}},"schemas":{"OperatorActivityWindow":{"type":"object","required":["start_on","end_before","active_users","emails_sent"],"properties":{"start_on":{"type":"string","format":"date"},"end_before":{"type":"string","format":"date"},"active_users":{"type":"integer"},"emails_sent":{"type":"integer"}}},"WorkspaceRoute":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"params":{"type":"object","additionalProperties":true},"query":{"type":"object","additionalProperties":true}}},"WorkspaceAttentionItem":{"type":"object","required":["key","title","detail","state","blocking","updated_at","to","action"],"properties":{"key":{"type":"string"},"title":{"type":"string"},"detail":{"type":"string"},"state":{"type":"string","enum":["action_required","working"]},"blocking":{"type":"boolean"},"updated_at":{"type":"string","format":"date-time"},"to":{"oneOf":[{"$ref":"#/components/schemas/WorkspaceRoute"},{"type":"null"}]},"action":{"type":"string"},"href":{"type":"string"},"progress":{"type":"object","additionalProperties":true},"dismissible":{"type":"boolean"},"chat_session_id":{"type":"integer"},"priority":{"type":"integer","description":"Account-wide restrictions use 0 and precede individual tasks."},"recovery_actions":{"type":"array","description":"Existing recovery actions for this restriction; opening one never approves or resumes sending.","items":{"type":"object","required":["type","label","url"],"properties":{"type":{"type":"string"},"label":{"type":"string"},"url":{"type":"string"}}}}}},"WorkspaceActivityItem":{"type":"object","required":["id","source","title","outcome","client","created_at","to"],"properties":{"id":{"type":"integer"},"source":{"type":"string","enum":["mcp","nitrollm","api"]},"title":{"type":"string"},"outcome":{"type":"string","enum":["ok","incomplete","accepted","streamed","denied","error","http_error","unknown"]},"client":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"to":{"oneOf":[{"$ref":"#/components/schemas/WorkspaceRoute"},{"type":"null"}]}}},"OperatorSupportRequest":{"type":"object","required":["id","account_id","brand_id","subject","message","status","created_at","updated_at"],"properties":{"id":{"type":"integer"},"account_id":{"type":"integer"},"brand_id":{"type":"integer"},"subject":{"type":"string"},"message":{"type":"string"},"status":{"type":"string","enum":["open","waiting","resolved"]},"follow_up_at":{"type":"string","format":"date-time","nullable":true},"resolved_at":{"type":"string","format":"date-time","nullable":true},"last_replied_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"OperatorSupportCase":{"type":"object","required":["support_request","account","brand"],"properties":{"support_request":{"allOf":[{"$ref":"#/components/schemas/OperatorSupportRequest"},{"type":"object","properties":{"support_transcript":{"type":"string","nullable":true},"support_transcript_truncated":{"type":"boolean"}}}]},"account":{"type":"object","additionalProperties":true},"brand":{"type":"object","additionalProperties":true},"latest_reply":{"type":"object","additionalProperties":true,"nullable":true},"github_issue":{"type":"object","additionalProperties":true,"nullable":true}}},"OperatorReplyDraft":{"type":"object","required":["status","support_request_id","thread_record_id","draft_version"],"properties":{"status":{"type":"string","enum":["drafted","sent"]},"support_request_id":{"type":"integer"},"thread_record_id":{"type":"integer"},"draft_version":{"type":"integer"},"draft_state":{"type":"string"},"terminal_outcome":{"type":"string","nullable":true},"last_replied_at":{"type":"string","format":"date-time","nullable":true}}},"TimelineEntry":{"type":"object","description":"One normalized, whitelisted entry in a contact's unified timeline.","properties":{"id":{"type":"string","description":"Stable composite id, e.g. \"event-123\"."},"kind":{"type":"string","enum":["event","activity","lifecycle","message"]},"type":{"type":"string","description":"Event/activity/lifecycle type, e.g. checkout, opened, flow_exit."},"title":{"type":"string","description":"Human-readable label for the entry."},"occurred_at":{"type":"string","format":"date-time"},"meta":{"type":"object","additionalProperties":true,"description":"Display-only extras (e.g. amount, resource_name). Flow exits include the flow name in resource_name and its exit_event. No internal fields."}},"required":["id","kind","type","title","occurred_at","meta"]},"EnterpriseRequestInput":{"type":"object","additionalProperties":false,"properties":{"monthly_emails":{"description":"Emails a month they expect to send, from 0 to 1,000,000,000, as a whole number or a string of up to 10 digits.","oneOf":[{"type":"integer","minimum":0,"maximum":1000000000},{"type":"string","pattern":"^[0-9]{1,10}$"},{"type":"null"}]},"needs":{"type":["array","null"],"maxItems":6,"uniqueItems":true,"items":{"type":"string","enum":["volume_pricing","dedicated_ip","seats_or_domains","security_review","invoicing","migration"]}},"message":{"type":["string","null"],"maxLength":2000}}},"EnterpriseRequestReceipt":{"type":"object","required":["received","replayed","request"],"properties":{"received":{"type":"boolean","const":true},"replayed":{"type":"boolean","description":"True when this is the member's request from earlier today."},"request":{"type":"object","required":["id","received_at","requester_email"],"properties":{"id":{"type":"integer"},"received_at":{"type":"string","format":"date-time"},"requester_email":{"type":"string","format":"email","description":"Where the team will reply."}}}}},"SafetyRecoveryAction":{"type":"object","required":["type","label","url"],"properties":{"type":{"type":"string","enum":["ask_team","domain_settings"]},"label":{"type":"string"},"url":{"type":"string","description":"For ask_team, opens the app in the right account with a request to the team staged in NitroLLM; it is never sent automatically."},"review_id":{"type":"integer","description":"The held case","for ask_team.":null},"prompt":{"type":"string","description":"The staged request","for ask_team.":null}}},"SendRefusalDetail":{"type":"object","description":"Present when the safety check refused the email. For content.image_unavailable and content.unreviewable it couldn't read the email, for reasons the sender can fix: no review is opened; change the email and send again. For content.vetting_review the email is held for review, and for content.vetting_denied it was blocked; how much either says depends on the account (some carry only the generic copy, or nothing more).\n","properties":{"reason_code":{"type":"string","enum":["content.image_unavailable","content.unreviewable","content.vetting_review","content.vetting_denied"]},"how_to_fix":{"type":"string","description":"The changes to make, in order, then how to send again. For a held or blocked email, how much is said depends on the account: some refusals carry only the generic copy.\n"},"category":{"type":"string","description":"The kind of concern, when the account may be told it: unsolicited_bulk, impersonation or unsupported_authority (trusted accounts may also see an abuse label).\n"},"agent_prompt":{"type":"string","description":"The reason and fix as one paragraph to paste to an agent. Names IDs only, never text from the email."},"recovery_actions":{"type":"array","items":{"$ref":"#/components/schemas/SafetyRecoveryAction"}},"details":{"type":"object","properties":{"images":{"type":"array","description":"Each image that couldn't be loaded.","items":{"type":"object","properties":{"url":{"type":"string","description":"The image address","shortened to 500 characters for display.":null},"problem":{"type":"string","enum":["not_found","refused","rejected","server_error","unreachable","private_host","unsupported_type","too_large","too_many_pixels","unreadable","not_a_web_address","unsupported_inline_image"]},"http_status":{"type":"integer","description":"The image host's HTTP status","when it answered.":null}}}},"changes":{"type":"array","description":"Other changes the email needs before it can be checked.","items":{"type":"object","properties":{"code":{"type":"string"},"fix":{"type":"string"}}}},"review_id":{"type":"integer","description":"The held or blocked case, for a request to the team."},"model_reason":{"type":"string","description":"The safety check's own reason, for trusted accounts only."}}}}},"Error":{"type":"object","required":["code","message","error"],"properties":{"capacity_recovery":{"$ref":"#/components/schemas/DeliveryCapacityRecovery"},"recovery_action":{"type":"object","description":"Context-specific recovery action, including sending capacity or prepaid funding recovery, and StartHostedCheckoutAction on a bank-verification card refusal from POST /v1/my/subscription."},"code":{"type":"integer"},"message":{"type":"string"},"error":{"type":"boolean","const":true},"error_code":{"type":"string","nullable":true,"description":"Optional machine-readable error reason."},"provisioning_id":{"type":"integer","nullable":true,"description":"Existing provisioning row involved in a managed-account conflict."},"retryable":{"type":"boolean","description":"Whether retrying the same idempotent operation can succeed."},"retry_at":{"type":"string","format":"date-time","description":"Earliest recommended retry time for a retryable failure."}}},"SignupPromoResult":{"type":"object","required":["applied","reason","partner","plan_granted"],"properties":{"applied":{"type":"boolean","description":"Whether the code was redeemed."},"reason":{"type":"string","enum":["applied","blank","not_found","not_redeemable","plan_not_found","partner_access_revoked"]},"partner":{"type":"boolean","description":"True when the code made the account a partner (Affiliates tab and Client Management). Partner codes never change the plan."},"plan_granted":{"type":"boolean","description":"True only when a referral code granted a plan."},"plan_pending":{"type":"boolean","description":"True when an optional partner plan offer is being applied after signup."}}},"StaffPartnerGrantResult":{"type":"object","required":["status","message","account_id","capabilities"],"properties":{"status":{"type":"string","enum":["partner_enabled","already_partner"]},"message":{"type":"string"},"account_id":{"type":"integer"},"email":{"type":"string","nullable":true},"plan":{"type":"string","nullable":true,"description":"The account's current plan slug, unchanged by this call."},"commercial_tier":{"type":"string","nullable":true},"capabilities":{"type":"array","items":{"type":"string","enum":["affiliate_center","managed_clients"]}}}},"SignupVerificationRequired":{"type":"object","required":["status","next_action","message"],"properties":{"status":{"type":"string","enum":["verification_required"]},"error_code":{"type":"string","enum":["verification_required"]},"next_action":{"type":"string","enum":["verify_email"]},"message":{"type":"string"},"error":{"type":"boolean"},"code":{"type":"integer"},"verification_expires_in":{"type":"integer","example":86400,"description":"Seconds a sign-up's emailed link lasts."}}},"SignupSession":{"allOf":[{"$ref":"#/components/schemas/User"},{"type":"object","properties":{"meta":{"type":"object","properties":{"account_id":{"type":"integer","nullable":true},"promo":{"$ref":"#/components/schemas/SignupPromoResult"}}}}}]},"User":{"type":"object","properties":{"id":{"type":"integer"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"email":{"type":"string","format":"email"},"email_verified_at":{"type":"string","format":"date-time","nullable":true,"description":"Actual email proof time; legacy access does not fabricate proof."},"unconfirmed_email":{"type":"string","format":"email","nullable":true,"description":"Requested email change awaiting proof. Continue signing in with email until confirmation."},"signup_completed_at":{"type":"string","format":"date-time","nullable":true},"mobile":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"time_zone":{"type":"string","nullable":true},"admin":{"type":"boolean"},"ui_login_count":{"type":"integer","description":"Capped three-state dashboard-login counter: 0 = the user has never logged into the app UI, 1 = the user is inside their first UI login, 2 = returning. Advances only on real dashboard logins (never on API key, MCP, or agent-connect authentication)."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Impersonator":{"type":"object","properties":{"id":{"type":"integer"},"email":{"type":"string","format":"email"},"name":{"type":"string","nullable":true}}},"ImpersonationStatus":{"type":"object","required":["impersonating","impersonator"],"properties":{"impersonating":{"type":"boolean"},"impersonator":{"oneOf":[{"$ref":"#/components/schemas/Impersonator"},{"type":"null"}]}}},"ImpersonationExit":{"type":"object","required":["redirect_url"],"properties":{"redirect_url":{"type":"string","format":"uri","example":"https://api.nitrosend.com/adm"}}},"ManagedAccountLifecycleStatus":{"type":"string","description":"setup is a claimed client on the unpaid Setup plan whose manager access is active; it is never reported as active until the client pays.","enum":["preparing","awaiting_owner","payment_required","setup","active","payment_issue","ended"]},"ManagedAccountLifecycleStatusFilter":{"type":"string","enum":["preparing","awaiting_owner","payment_required","setup","active","payment_issue","ended","needs_setup"]},"ManagedAccountProvisioning":{"type":"object","required":["id","external_ref","source","status","permission_set","allowed_actions","managed_account","managed_on_setup","managed_plan_paid","owner","invitation","created_at","updated_at"],"properties":{"id":{"type":"integer"},"external_ref":{"type":"string","maxLength":128},"source":{"type":"string","enum":["dashboard","partner_api"]},"status":{"$ref":"#/components/schemas/ManagedAccountLifecycleStatus"},"permission_set":{"type":"string","enum":["operator_v1"]},"allowed_actions":{"type":"array","uniqueItems":true,"items":{"type":"string","enum":["send_invitation","resend_invitation","send_payment_reminder","enter","release"]}},"managed_account":{"type":"object","required":["id","name"],"properties":{"id":{"type":"integer"},"name":{"type":"string","nullable":true}}},"managed_on_setup":{"type":"boolean","description":"The client account is on Setup mode now, whatever the invitation's state. The agency builds and tests in it, and live email waits until the owner chooses a paid plan."},"managed_plan_paid":{"type":"boolean","description":"The client account already has an active paid plan (for example one the agency bought), so the owner does not need to choose one to keep the agency's access."},"owner":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}},"invitation":{"type":"object","required":["expired","expires_at","deadline_at","notice_sent_at","claimed_at","reissues_remaining"],"properties":{"expired":{"type":"boolean"},"expires_at":{"type":"string","format":"date-time"},"deadline_at":{"type":"string","format":"date-time"},"notice_sent_at":{"type":"string","format":"date-time","nullable":true},"claimed_at":{"type":"string","format":"date-time","nullable":true},"reissues_remaining":{"type":"integer","minimum":0,"maximum":3}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ManagedAccountProvisioningCreated":{"allOf":[{"$ref":"#/components/schemas/ManagedAccountProvisioning"},{"type":"object","required":["idempotent_replay"],"properties":{"idempotent_replay":{"type":"boolean"}}}]},"DashboardPaymentHandoffRequest":{"type":"object","properties":{"payment_handoff":{"type":"boolean","default":false,"description":"Reject an invitation whose purpose is payment if the client has paid or billing is being updated."}}},"DashboardManagedAccountCreateRequest":{"type":"object","required":["managed_account"],"properties":{"managed_account":{"type":"object","required":["owner_email","account_name"],"properties":{"owner_email":{"type":"string","format":"email"},"owner_first_name":{"type":"string","maxLength":100},"owner_last_name":{"type":"string","maxLength":100},"account_name":{"type":"string","maxLength":120}}}}},"PartnerManagedAccountCreateRequest":{"type":"object","required":["managed_account"],"properties":{"managed_account":{"type":"object","required":["external_ref","owner_email","account_name"],"properties":{"external_ref":{"type":"string","maxLength":128},"owner_email":{"type":"string","format":"email"},"owner_first_name":{"type":"string","maxLength":100},"owner_last_name":{"type":"string","maxLength":100},"account_name":{"type":"string","maxLength":120}}}}},"AccountProvisioningCredential":{"type":"object","required":["id","name","scopes","secret_hint","expires_at","created_at"],"properties":{"id":{"type":"integer"},"name":{"type":"string","maxLength":120},"scopes":{"type":"array","uniqueItems":true,"items":{"type":"string","enum":["provision","manage"]}},"secret_hint":{"type":"string"},"expires_at":{"type":"string","format":"date-time"},"last_used_at":{"type":"string","format":"date-time","nullable":true},"revoked_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"AccountProvisioningCredentialIssued":{"allOf":[{"$ref":"#/components/schemas/AccountProvisioningCredential"},{"type":"object","required":["secret"],"properties":{"secret":{"type":"string","writeOnly":true,"description":"One-time nspk_live_ credential secret."}}}]},"AccountProvisioningCredentialCreateRequest":{"type":"object","required":["credential"],"properties":{"credential":{"type":"object","required":["name","scopes"],"properties":{"name":{"type":"string","maxLength":120},"scopes":{"type":"array","minItems":1,"uniqueItems":true,"items":{"type":"string","enum":["provision","manage"]}},"expires_at":{"type":"string","format":"date-time"}}}}},"AccountManagementCredential":{"type":"object","required":["id","account_management_grant_id","name","permission_set","secret_hint","expires_at","created_at","brand"],"properties":{"id":{"type":"integer"},"account_management_grant_id":{"type":"integer"},"name":{"type":"string","maxLength":120},"permission_set":{"type":"string","enum":["operator_v1"]},"secret_hint":{"type":"string"},"expires_at":{"type":"string","format":"date-time"},"last_used_at":{"type":"string","format":"date-time","nullable":true},"revoked_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"brand":{"type":"object","required":["id","sid","name"],"properties":{"id":{"type":"integer"},"sid":{"type":"string"},"name":{"type":"string"}}}}},"AccountManagementCredentialIssued":{"allOf":[{"$ref":"#/components/schemas/AccountManagementCredential"},{"type":"object","required":["secret"],"properties":{"secret":{"type":"string","writeOnly":true,"description":"One-time nsmc_live_ credential secret."}}}]},"AccountManagementCredentialCreateRequest":{"type":"object","required":["credential"],"properties":{"credential":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":120},"brand_sid":{"type":"string","description":"Defaults to the managed Account's default Brand."},"expires_at":{"type":"string","format":"date-time","description":"Defaults to 90 days and cannot exceed one year."}}}}},"ManagedAccountClaimRequest":{"type":"object","required":["claim"],"properties":{"claim":{"type":"object","required":["token"],"properties":{"token":{"type":"string","writeOnly":true}}}}},"ManagedAccountClaimCompletionRequest":{"$ref":"#/components/schemas/ManagedAccountClaimRequest"},"ManagedAccountClaimInspection":{"type":"object","required":["manager","managed_account","owner_email","expires_at","authentication"],"properties":{"manager":{"type":"object","properties":{"name":{"type":"string","nullable":true}}},"managed_account":{"type":"object","properties":{"name":{"type":"string","nullable":true}}},"owner_email":{"type":"string","description":"Masked owner address"},"expires_at":{"type":"string","format":"date-time"},"authentication":{"type":"string","const":"login_required"}}},"ManagedAccountClaimCompletion":{"type":"object","required":["claimed","status","payment_required","managed_on_setup","managed_account"],"properties":{"claimed":{"type":"boolean","const":true},"status":{"type":"string","enum":["payment_required","active","manager_disabled"],"description":"The agency's management access. active on Setup mode does not mean paid; read payment_required."},"payment_required":{"type":"boolean","description":"The owner still has to choose a paid plan before live email. True on Setup mode, even though status is active, and whenever no paid plan is active; false when a paid plan is active, such as one the agency already bought."},"managed_on_setup":{"type":"boolean","description":"The client account is on Setup mode."},"managed_account":{"type":"object","required":["id","name"],"properties":{"id":{"type":"integer"},"name":{"type":"string","nullable":true}}}}},"Account":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","nullable":true},"avatar":{"type":"string","nullable":true,"description":"Signed blob ID"},"banner":{"type":"string","nullable":true,"description":"Signed blob ID"},"commercial_tier":{"type":"string","enum":["unsubscribed","free","setup","starter","pro","growth","scale","ultra","enterprise"],"description":"The current plan's tier. setup is Setup mode, the hidden plan an agency and every client account it creates build and test on before a paid plan turns on live email."},"safe_mode_enabled":{"type":"boolean"},"access":{"$ref":"#/components/schemas/AccountAccess"},"billing":{"description":"Owners, admins and members get the full projection. An agency operator working in a client account it manages, or a management credential, gets the delegated projection: enough to choose and pay for the client's first plan from Setup mode, with no usage, funding, spend cap, payment or invoice details.","oneOf":[{"$ref":"#/components/schemas/AccountBilling"},{"$ref":"#/components/schemas/DelegatedAccountBilling"}]},"team":{"type":"object","description":"Present for direct access and omitted from delegated account projections.","properties":{"seat_limit":{"type":"integer"},"seat_count":{"type":"integer"},"member_count":{"type":"integer"},"invite_count":{"type":"integer"},"current_role":{"type":"string","nullable":true},"can_manage_team":{"type":"boolean"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"AccountBilling":{"type":"object","description":"Billing for direct access (owners, admins and members, and their own credentials).","required":["access_policy","brands","funding","provider_route"],"properties":{"access_policy":{"type":"string","enum":["free_allowed","paid_required"],"nullable":true},"plan_name":{"type":"string","nullable":true},"plan":{"allOf":[{"$ref":"#/components/schemas/Plan"}],"nullable":true},"spend_cap_monthly_cents":{"type":"integer","minimum":0,"nullable":true},"comped":{"type":"boolean"},"overage":{"type":"object","additionalProperties":true},"entitlements":{"$ref":"#/components/schemas/BillingEntitlements"},"resources":{"type":"object","properties":{"email":{"$ref":"#/components/schemas/AccountResourceUsage"},"sms":{"$ref":"#/components/schemas/AccountResourceUsage"},"ai":{"$ref":"#/components/schemas/AccountResourceUsage"}}},"funding":{"type":"object","additionalProperties":true},"provider_route":{"type":"object","additionalProperties":true},"removable_branding":{"type":"boolean","description":"Whether this account may take the Nitrosend footer off its emails, whatever allows it (plan, add-on or waiver)."},"outstanding_invoice":{"type":["object","null"],"description":"Present while sending is paused because the account has an unpaid invoice; null otherwise. Owners and admins can pay it through GET /v1/my/invoices/{id}/payment.","properties":{"id":{"type":["integer","null"],"description":"The newest unpaid invoice. Null only when no invoice record exists for the unpaid balance."}}},"brands":{"type":"object","description":"Per-account brand-count headroom. Usage for email, SMS, and AI remains pooled at the account level; only brand count is capped here. A limit of 0 with unlimited=true means unlimited brands.","properties":{"used":{"type":"integer"},"limit":{"type":"integer","description":"Effective brand capacity including purchased units. 0 means unlimited when unlimited is true."},"remaining":{"type":"integer","nullable":true,"description":"Null when unlimited is true."},"unlimited":{"type":"boolean"},"can_create":{"type":"boolean","description":"True when plan headroom allows creating another brand."}}},"domains":{"type":"object","description":"Account-wide customer sending-domain capacity, including purchased units. Brand-subdomain senders do not consume these slots.","required":["limit","used","remaining","unlimited","can_add"],"properties":{"limit":{"type":["integer","null"]},"used":{"type":"integer"},"remaining":{"type":["integer","null"]},"unlimited":{"type":"boolean"},"can_add":{"type":"boolean"}}},"lifetime":{"type":"object","properties":{"email_sent":{"type":"integer"},"sms_sent":{"type":"integer"},"ai_used":{"type":"integer"}}}}},"DelegatedAccountBilling":{"type":"object","description":"Billing for an agency operator working in a client account it manages (delegated access): the plan, its status, the tier, the access policy and the billing route, which is what choosing and paying for the client's first plan from Setup mode needs. Usage, funding, spend cap, payment and invoice details stay with the account's owner and admins.","additionalProperties":false,"required":["access_policy","plan","subscription_status","commercial_tier","provider_route"],"properties":{"access_policy":{"type":"string","enum":["free_allowed","paid_required"],"nullable":true},"plan":{"allOf":[{"$ref":"#/components/schemas/Plan"}],"nullable":true},"subscription_status":{"type":"string","enum":["pending","active","inactive","canceled","free_tier"],"nullable":true},"commercial_tier":{"type":"string","enum":["unsubscribed","free","setup","starter","pro","growth","scale","ultra","enterprise"]},"provider_route":{"type":"object","additionalProperties":true}}},"SendingPause":{"type":"object","description":"What the owner of a suspended account is told. A deliverability pause names the metric and the fix (`reason`, `what_to_do`). Any other suspension is opaque and carries no reason. Recovery actions reach the existing support channel.","required":["sending_paused","occurred_at","headline","detail","request_review","recovery_actions"],"properties":{"sending_paused":{"type":"boolean","enum":[true]},"reason":{"type":"string","enum":["critical_bounce_rate","critical_complaint_rate"],"description":"Present only for an explained deliverability pause."},"occurred_at":{"type":"string","format":"date-time"},"headline":{"type":"string"},"detail":{"type":"string"},"what_to_do":{"type":"array","items":{"type":"string"},"description":"Present only for an explained deliverability pause."},"request_review":{"type":"string","description":"The instruction an agent relays to the owner."},"recovery_actions":{"type":"array","items":{"type":"object","required":["type","label","url"],"properties":{"type":{"type":"string","enum":["verify_list","request_review","contact_support"]},"label":{"type":"string"},"url":{"type":"string","description":"App link or support mailto."}}}}}},"AccountResourceUsage":{"type":"object","required":["used","allowance","remaining","overage_rate","mode","budget","budget_used"],"properties":{"used":{"type":"integer"},"allowance":{"type":"integer","nullable":true},"remaining":{"type":"integer","nullable":true},"overage_rate":{"type":"number"},"mode":{"type":"string","enum":["budget","monthly","unlimited"]},"budget":{"type":"integer","nullable":true},"budget_used":{"type":"integer"}}},"AccountAccess":{"type":"object","required":["source","delegated"],"properties":{"source":{"type":"string","enum":["owner","membership","platform_admin","delegated","management_credential","api_key","shopify"]},"delegated":{"type":"boolean"},"manager_account_id":{"type":"integer"},"manager_account_name":{"type":"string","nullable":true},"management_grant_id":{"type":"integer"},"permission_set":{"type":"string","enum":["operator_v1"]},"credential_type":{"type":"string","enum":["management"]}}},"AccountManagementGrant":{"type":"object","required":["id","status","permission_set","manager_account","requested_at"],"properties":{"id":{"type":"integer"},"status":{"type":"string","enum":["pending","active","revoked","released"]},"permission_set":{"type":"string","enum":["operator_v1"]},"manager_account":{"type":"object","required":["id"],"properties":{"id":{"type":"integer"},"name":{"type":"string","nullable":true}}},"requested_at":{"type":"string","format":"date-time"},"activated_at":{"type":"string","format":"date-time","nullable":true},"revoked_at":{"type":"string","format":"date-time","nullable":true},"released_at":{"type":"string","format":"date-time","nullable":true}}},"AccountManagementGrantCommand":{"type":"object","required":["management_grant_id"],"properties":{"management_grant_id":{"type":"integer","description":"Exact grant returned by the show endpoint; prevents a stale command from targeting a replacement grant."}}},"AccountTeam":{"type":"object","properties":{"account":{"$ref":"#/components/schemas/Account"},"memberships":{"type":"array","items":{"$ref":"#/components/schemas/AccountMembership"}},"invites":{"type":"array","items":{"$ref":"#/components/schemas/AccountInvite"}},"join_requests":{"type":"array","description":"Confirmed requests to join that are waiting on a decision. Empty unless you are a direct owner or admin.","items":{"$ref":"#/components/schemas/AccountJoinRequest"}},"accessible_accounts":{"type":"array","items":{"$ref":"#/components/schemas/Account"}}}},"AccountJoinRequest":{"type":"object","description":"Someone asking to join this workspace, as the workspace sees it.","properties":{"id":{"type":"integer"},"email":{"type":"string","format":"email","description":"The address they signed up and confirmed with."},"name":{"type":"string","nullable":true},"domain":{"type":"string","description":"The domain this workspace holds that their address is at."},"status":{"type":"string","enum":["unconfirmed","pending","approved","declined","cancelled","expired"]},"created_at":{"type":"string","format":"date-time"},"confirmed_at":{"type":"string","format":"date-time","nullable":true},"decided_at":{"type":"string","format":"date-time","nullable":true}}},"JoinRequestAvailability":{"type":"object","properties":{"available":{"type":"boolean","description":"Whether there is a workspace you can ask to join now. False for 30 days after that workspace declines you."},"domain":{"type":"string","nullable":true,"description":"The domain that workspace holds. Null when none."},"email":{"type":"string","format":"email","description":"Your sign-in address","where the confirm link goes.":null},"request":{"type":"object","nullable":true,"description":"Your latest request for that workspace. When there is none to ask (once you are in, for one): the request you made of whoever holds the domain in question, else your latest for that domain, else your latest at all. `expired` also covers a request made under an address you no longer have.","properties":{"id":{"type":"integer"},"status":{"type":"string","enum":["unconfirmed","pending","approved","declined","cancelled","expired"]},"created_at":{"type":"string","format":"date-time"},"confirmed_at":{"type":"string","format":"date-time","nullable":true},"decided_at":{"type":"string","format":"date-time","nullable":true},"account":{"type":"object","description":"The workspace. Present only once the request is approved.","properties":{"id":{"type":"integer"},"name":{"type":"string"}}}}}}},"JoinRequestReceipt":{"type":"object","properties":{"status":{"type":"string","enum":["confirmation_sent","pending"]},"domain":{"type":"string"},"email":{"type":"string","format":"email"}}},"AccountMembership":{"type":"object","properties":{"id":{"type":"integer"},"role":{"type":"string","enum":["member","admin","owner"]},"user_id":{"type":"integer"},"email":{"type":"string","format":"email"},"name":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"AccountInvite":{"type":"object","properties":{"id":{"type":"integer"},"account_id":{"type":"integer"},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["member","admin"]},"token":{"type":"string"},"status":{"type":"string","enum":["pending","accepted","revoked","expired"]},"accepted_at":{"type":"string","format":"date-time","nullable":true},"revoked_at":{"type":"string","format":"date-time","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Subscription":{"type":"object","properties":{"id":{"type":"integer"},"plan_id":{"type":"integer"},"plan_name":{"type":"string","nullable":true,"description":"Current package name. Historical purchase labels are retained in billing records."},"billing_provider":{"type":"string","enum":["shopify","stripe","stripe_projects","vercel","aws"],"nullable":true},"source_billing_provider":{"type":"string","enum":["shopify","stripe","stripe_projects","vercel","aws"],"nullable":true},"billing_migration_required":{"type":"boolean"},"manage_url":{"type":"string","format":"uri","nullable":true},"spend_cap_monthly_cents":{"type":"integer","minimum":0,"nullable":true,"description":"Merchant-selected monthly cap for metered usage charges."},"shopify_usage_metered":{"type":"boolean","description":"Whether the active Shopify plan has at least one configured usage meter."},"status":{"type":"string","enum":["pending","active","inactive","canceled","free_tier"]},"interval":{"type":"string","enum":["month","year","week","day"]},"currency":{"type":"string"},"subtotal_cents":{"type":"integer"},"tax_cents":{"type":"integer"},"total_cents":{"type":"integer"},"base_price_cents":{"type":"integer"},"discount_cents":{"type":"integer","description":"Per-period Stripe discount in cents (0 when none)."},"next_payment_cents":{"type":"integer","description":"Amount billed next period","total_cents less discount_cents":null,"floored at 0.":null},"discount_end_at":{"type":"string","format":"date-time","nullable":true,"description":"When the discount stops (null for forever/once or no discount)."},"activated":{"type":"boolean"},"entitlements":{"$ref":"#/components/schemas/BillingEntitlements"}}},"BillingEntitlements":{"type":"object","required":["agent_inbox"],"properties":{"agent_inbox":{"$ref":"#/components/schemas/AgentInboxEntitlement"}}},"AgentInboxEntitlement":{"type":"object","required":["enabled","max_inboxes","inbound_messages_included","inbound_messages_metered","inbound_message_overage_rate_cents","max_inbound_domains","max_apex_domains","apex_mx","legacy_forwarding","catch_all","retention_days","advanced_queue_controls"],"properties":{"enabled":{"type":"boolean"},"max_inboxes":{"type":"integer","nullable":true,"minimum":0,"description":"Account-wide exact-inbox capacity. Null means contract-defined unlimited capacity."},"included_inboxes":{"type":["integer","null"],"minimum":0,"description":"Effective included allowance","including preserved existing capacity without stacking.":null},"grandfathered_inboxes":{"type":"integer","minimum":0},"purchased_inboxes":{"type":"integer","minimum":0,"description":"Confirmed paid units only."},"coexistence_inboxes":{"type":"integer","minimum":0,"description":"Paid onward-copy capacity for enrolled inboxes receiving through Nitrosend MX. Does not apply to provider-primary forwarding."},"inbound_messages_included":{"type":"integer","nullable":true,"minimum":0},"inbound_messages_metered":{"type":"boolean"},"inbound_message_overage_rate_cents":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},"max_inbound_domains":{"type":"integer","nullable":true,"minimum":0},"max_apex_domains":{"type":"integer","nullable":true,"minimum":0},"apex_mx":{"type":"boolean"},"legacy_forwarding":{"type":"boolean"},"catch_all":{"type":"boolean"},"retention_days":{"type":"integer","nullable":true,"minimum":0},"advanced_queue_controls":{"type":"boolean"}}},"SubscriptionCreateRequest":{"type":"object","required":["plan_id"],"properties":{"plan_id":{"type":"integer"},"stripe_token":{"type":"string","nullable":true,"description":"Stripe card token for paid-plan creation."},"coupon_code":{"type":"string","nullable":true,"description":"Customer-entered Stripe promotion code or coupon ID. Refused on an agency operator's purchase for a client account."}}},"DelegatedSubscription":{"type":"object","description":"What an agency operator working in a client account it manages sees of its subscription: the plan, its status and the billing route, which is what choosing and paying for the first plan from Setup mode needs. Payment, invoice, discount, spend cap and renewal details stay with the account's owner and admins.","additionalProperties":false,"required":["id","plan_id","plan_name","status","interval","currency","activated","base_price_cents","billing_provider","source_billing_provider","billing_route","plan"],"properties":{"id":{"type":"integer"},"plan_id":{"type":"integer"},"plan_name":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","active","inactive","canceled","free_tier"]},"interval":{"type":"string","enum":["month","year","week","day"]},"currency":{"type":"string"},"activated":{"type":"boolean"},"base_price_cents":{"type":"integer"},"billing_provider":{"type":"string","enum":["shopify","stripe","stripe_projects","vercel","aws"],"nullable":true},"source_billing_provider":{"type":"string","enum":["shopify","stripe","stripe_projects","vercel","aws"],"nullable":true},"billing_route":{"type":"object","additionalProperties":true},"plan":{"allOf":[{"$ref":"#/components/schemas/Plan"}],"nullable":true}}},"FundingPurchaseCreateRequest":{"type":"object","additionalProperties":false,"required":["amount_cents"],"properties":{"amount_cents":{"type":"integer","minimum":1,"description":"Integer service value in minor currency units."},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"instrument":{"type":"string","enum":["stripe_checkout","shopify_one_time"],"description":"Optional hosted funding instrument. Omit to use the account default."},"paid_action_intent_id":{"type":"string","nullable":true,"description":"Optional opaque continuation bound to this funding purchase."}}},"FundingInstrument":{"type":"object","additionalProperties":false,"required":["instrument","provider","mode","available"],"properties":{"instrument":{"type":"string","enum":["stripe_checkout","shopify_one_time"]},"provider":{"type":"string","enum":["stripe","shopify"]},"mode":{"type":"string","enum":["hosted_approval"]},"available":{"type":"boolean"},"reason":{"type":"string","nullable":true}}},"FundingUrlApproval":{"type":"object","additionalProperties":false,"required":["kind","provider","url","target"],"properties":{"kind":{"type":"string","enum":["url"]},"provider":{"type":"string","enum":["stripe","shopify"]},"url":{"type":"string","format":"uri"},"target":{"type":"string","enum":["self","top"]}}},"FundingChallengeApproval":{"type":"object","additionalProperties":false,"required":["kind","instrument","protocol","challenge"],"properties":{"kind":{"type":"string","enum":["challenge"]},"instrument":{"type":"string"},"protocol":{"type":"string"},"challenge":{"type":"string"},"expires_at":{"type":"string","format":"date-time","nullable":true}}},"FundingApproval":{"oneOf":[{"$ref":"#/components/schemas/FundingUrlApproval"},{"$ref":"#/components/schemas/FundingChallengeApproval"}]},"FundingPurchase":{"type":"object","additionalProperties":false,"required":["id","provider","instrument","status","currency","requested_cents","credited_cents","reversed_cents","created_at","updated_at"],"properties":{"id":{"type":"integer"},"paid_action_intent_id":{"type":"string","nullable":true},"provider":{"type":"string","enum":["stripe","shopify"]},"instrument":{"type":"string","enum":["stripe_checkout","shopify_one_time","stripe_off_session"]},"status":{"type":"string","enum":["requested","pending","checkout_created","credited","failed","expired","partially_reversed","reversed"]},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"requested_cents":{"type":"integer","minimum":1},"requested_display":{"type":"string"},"checkout_url":{"type":"string","format":"uri","nullable":true},"approval":{"allOf":[{"$ref":"#/components/schemas/FundingApproval"}],"nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"credited_cents":{"type":"integer","minimum":0},"reversed_cents":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"FundingPurchaseCapability":{"type":"object","additionalProperties":false,"required":["available","state","instruments","currency","preset_cents"],"properties":{"available":{"type":"boolean"},"state":{"type":"string"},"reason":{"type":"string","nullable":true},"default_instrument":{"type":"string","enum":["stripe_checkout","shopify_one_time"],"nullable":true},"instruments":{"type":"array","items":{"$ref":"#/components/schemas/FundingInstrument"}},"currency":{"type":"string"},"minimum_cents":{"type":"integer","nullable":true},"maximum_cents":{"type":"integer","nullable":true},"preset_cents":{"type":"array","items":{"type":"integer"}}}},"FundingStatus":{"type":"object","additionalProperties":true,"required":["state","applies_to","subscription_gate","currency","available_cents","reserved_cents","deficit_cents","purchase"],"properties":{"state":{"type":"string"},"applies_to":{"type":"string","enum":["prepaid_features"]},"subscription_gate":{"type":"boolean"},"currency":{"type":"string"},"available_cents":{"type":"integer"},"reserved_cents":{"type":"integer"},"deficit_cents":{"type":"integer"},"purchase":{"$ref":"#/components/schemas/FundingPurchaseCapability"},"pending_purchase":{"allOf":[{"$ref":"#/components/schemas/FundingPurchase"}],"nullable":true}}},"FundingPurchaseResponse":{"type":"object","additionalProperties":false,"required":["purchase","funding"],"properties":{"purchase":{"$ref":"#/components/schemas/FundingPurchase"},"funding":{"$ref":"#/components/schemas/FundingStatus"}}},"SubscriptionChangeRequest":{"type":"object","required":["plan_id"],"properties":{"plan_id":{"type":"integer"},"stripe_token":{"type":"string","nullable":true,"description":"Stripe card token that pays for a paid plan on a subscription with no\nStripe subscription (a comped or other unpaid plan). Any other change\nto an available plan with a token is refused with 400; replace the\ncard of a Stripe subscription with PUT /v1/my/user/payment_method.\n"},"coupon_code":{"type":"string","nullable":true,"description":"Customer-entered Stripe promotion code or coupon ID."}}},"SubscriptionCouponPreviewRequest":{"type":"object","required":["plan_id","coupon_code"],"properties":{"plan_id":{"type":"integer"},"coupon_code":{"type":"string","description":"Customer-entered Stripe promotion code or coupon ID."}}},"SubscriptionCouponPreview":{"type":"object","required":["code","discount_label","discount_cents","subtotal_cents","tax_cents","total_cents","total_after_discount_cents","currency"],"properties":{"code":{"type":"string"},"discount_label":{"type":"string"},"discount_cents":{"type":"integer"},"subtotal_cents":{"type":"integer"},"tax_cents":{"type":"integer"},"total_cents":{"type":"integer"},"total_after_discount_cents":{"type":"integer"},"currency":{"type":"string"}}},"OAuthPopupAccount":{"type":"object","required":["id","name","needs_subscribe"],"properties":{"id":{"type":"integer"},"name":{"type":"string"},"access":{"$ref":"#/components/schemas/AccountAccess"},"can_manage":{"type":"boolean"},"has_campaign":{"type":"boolean","description":"Whether the account has made any campaign. This alone does not determine onboarding eligibility."},"setup_brand":{"type":"object","nullable":true,"description":"Optional setup for a fresh, unconfigured workspace, visible only to a direct manager. Start setup through the existing brand endpoints; OAuth need not wait for the scan.","required":["sid","brand_color"],"properties":{"sid":{"type":"string"},"suggested_site":{"type":"string","nullable":true},"brand_color":{"type":"string"}}},"needs_subscribe":{"type":"boolean"},"plans":{"type":"array","description":"Offers available through this account's provider, including retained Free terms when eligible.","items":{"$ref":"#/components/schemas/Plan"}}}},"OAuthPopupPlan":{"type":"object","required":["id","name","slug","base_price_cents"],"properties":{"id":{"type":"integer"},"name":{"type":"string"},"slug":{"type":"string"},"base_price_cents":{"type":"integer"},"interval":{"type":"string","nullable":true},"tier_group":{"type":"string"}}},"OAuthPopupContext":{"type":"object","required":["accounts","plans"],"properties":{"application_name":{"type":"string","nullable":true},"email":{"type":"string","description":"The signed-in person's address, where an agent's first test goes."},"accounts":{"type":"array","items":{"$ref":"#/components/schemas/OAuthPopupAccount"}},"plans":{"type":"array","items":{"$ref":"#/components/schemas/OAuthPopupPlan"}},"stripe_publishable_key":{"type":"string","nullable":true}}},"OAuthPopupSubscribeRequest":{"type":"object","required":["plan_id"],"properties":{"plan_id":{"type":"integer"},"account_id":{"type":"integer","nullable":true},"stripe_token":{"type":"string","nullable":true}}},"OAuthPopupSubscribeResponse":{"type":"object","required":["next_step"],"properties":{"next_step":{"type":"string","enum":["consent"]}}},"FirstTouchAttributionContext":{"type":"object","description":"Optional first-touch attribution captured by the client for a new-account signup. Send URLs without query strings. UTM values have control characters removed and surrounding whitespace stripped, and are capped at 100 characters server-side. Click identifiers are accepted only as strings: surrounding whitespace is stripped, then the whole value must be 1-255 ASCII letters, digits, underscores, periods or hyphens; an invalid or oversized identifier is omitted, never truncated, without rejecting the signup. Values are persisted only for a genuinely new account and never overwrite an earlier first touch.","properties":{"landing_url":{"type":"string","nullable":true},"referrer_url":{"type":"string","nullable":true},"captured_at":{"type":"string","format":"date-time","nullable":true},"utm_source":{"type":"string","nullable":true},"utm_medium":{"type":"string","nullable":true},"utm_campaign":{"type":"string","nullable":true},"utm_content":{"type":"string","nullable":true},"utm_term":{"type":"string","nullable":true},"fbclid":{"type":"string","nullable":true,"description":"Meta click identifier (fbclid) from the first touch, subject to the click-identifier rules above."},"ttclid":{"type":"string","nullable":true,"description":"TikTok click identifier (ttclid) from the first touch, subject to the click-identifier rules above."},"gclid":{"type":["string","null"],"description":"Google Ads click identifier (gclid), subject to the click-identifier rules above. Unlike the other fields, the three Google identifiers name the visitor's latest tagged touch, which can be later than the first touch, and are stored as one set. `POST /v1/oauth/launch` ignores them: the provider callback reads them from the first-party touch cookie instead."},"gbraid":{"type":["string","null"],"description":"Google Ads gbraid click identifier, under the same rules as gclid."},"wbraid":{"type":["string","null"],"description":"Google Ads wbraid click identifier, under the same rules as gclid."}}},"OAuthLaunchRequest":{"type":"object","required":["provider"],"properties":{"provider":{"type":"string","enum":["google_oauth2","github"]},"auth_intent":{"type":"string","enum":["app","agent"],"default":"app"},"auth_step":{"type":"string","enum":["login","signup"],"default":"login"},"resume_url":{"type":"string","format":"uri","nullable":true,"description":"Required when `auth_intent=agent`; must point to the frontend `/oauth/connect` route."},"invite_token":{"type":"string","nullable":true},"referral_code":{"type":"string","nullable":true},"rewardful_referral_id":{"type":"string","nullable":true},"attribution_context":{"$ref":"#/components/schemas/FirstTouchAttributionContext"},"signup_intent":{"$ref":"#/components/schemas/SignupIntent"}}},"SignupIntent":{"type":"string","enum":["agency"],"nullable":true,"description":"Optional. `agency` marks a signup that came from the agencies page; a new account created with it becomes a partner (Affiliates tab, client management, a personal Rewardful campaign) unless the signup is held for review. Any other value is ignored and the signup proceeds normally."},"OAuthLaunchResponse":{"type":"object","required":["launch_url"],"properties":{"launch_url":{"type":"string","format":"uri"}}},"Brand":{"type":"object","properties":{"id":{"type":"integer"},"sid":{"type":"string","description":"Public secure identifier (non-sequential)","readOnly":true},"account_id":{"type":"integer"},"brand_color":{"type":"string","nullable":true},"text_color":{"type":"string","nullable":true},"bg_color":{"type":"string","nullable":true},"radius":{"type":"integer","minimum":0,"maximum":64,"nullable":true},"spacing_density":{"type":"string","enum":["compact","normal","spacious"],"nullable":true},"font_heading":{"type":"string","nullable":true},"font_body":{"type":"string","nullable":true},"heading_size":{"type":"integer","minimum":12,"maximum":48,"nullable":true},"body_size":{"type":"integer","minimum":12,"maximum":20,"nullable":true},"brand_document":{"type":"string","nullable":true,"maxLength":15360},"company_description":{"type":"string","nullable":true},"default_header":{"type":"object","nullable":true},"default_footer":{"type":"object","nullable":true},"default_theme":{"type":"object","nullable":true},"physical_address":{"type":"string","nullable":true},"company_name":{"type":"string","nullable":true},"source_url":{"type":"string","nullable":true},"last_scraped_at":{"type":"string","format":"date-time","nullable":true},"links":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"icon":{"type":"string"},"title":{"type":"string"}}},"nullable":true},"logo":{"type":"string","nullable":true,"description":"Logo URL"},"complete":{"type":"boolean","description":"True when brand_color and company_name are set"},"email_from_name":{"type":"string","nullable":true},"email_from_email":{"type":"string","nullable":true},"email_reply_to":{"type":"string","nullable":true},"from_email_domain_status":{"type":"string","enum":["blank","verified","unverified"],"description":"Authorization state of the configured visible From address."},"effective_from_email":{"type":"string","format":"email","nullable":true,"readOnly":true},"effective_reply_to":{"type":"string","format":"email","nullable":true,"readOnly":true},"effective_sending_domain":{"type":"string","nullable":true,"readOnly":true},"effective_source_email":{"type":"string","format":"email","nullable":true,"readOnly":true},"effective_from_email_note":{"type":"string","nullable":true,"readOnly":true,"description":"Why effective_from_email differs from email_from_email, and what to do, when the From is moved onto the verified domain paired with a sending domain. Null otherwise."},"sender_flows_note":{"type":["string","null"],"readOnly":true,"description":"Update responses only. When the update changed the sender: which live and paused flows move to the new sender, which keep the old one for now (changes waiting to be published, an A/B test, or Safe Mode), and which have emails whose own saved From is the old address (those keep it). Null when no flow moves, waits or keeps one."},"sender_configured":{"type":"boolean","readOnly":true},"email_view_online":{"type":"boolean","description":"Brand setting, on by default for new brands, that injects a campaign view-in-browser link when a verified tracking domain is available."},"email_view_online_placement":{"type":"string","enum":["top","footer"],"description":"Where the view-in-browser link goes: beside the Unsubscribe link in its footer (default for new brands), or at the top of the email. The link is only added once the campaign's web copy exists."},"email_track_opens":{"type":"boolean","description":"Default-on brand setting. When false, this brand's emails carry no open-tracking pixel and opens from mail already sent are not recorded."},"email_track_clicks":{"type":"boolean","description":"Default-on brand setting. When false, this brand's links are not rewritten and clicks from mail already sent are not recorded; delivered links keep working."},"email_utm_tagging":{"type":"boolean","description":"Default-on brand setting. When true, links to the domains in email_utm_effective_domains carry utm_source, utm_medium, utm_campaign (the campaign or flow name and id) and utm_content (the email's subject) in campaign and flow emails. Links that already have a utm_ parameter, test sends and transactional email are never tagged."},"email_utm_source":{"type":"string","description":"utm_source on tagged links. Default nitrosend."},"email_utm_medium":{"type":"string","description":"utm_medium on tagged links. Default email."},"email_utm_domains":{"type":["array","null"],"items":{"type":"string"},"description":"The brand's own list of tagged domains, or null for the automatic list."},"email_utm_effective_domains":{"type":"array","readOnly":true,"items":{"type":"string"},"description":"The domains whose links get UTM tags now: email_utm_domains, or the automatic list when it is null."},"test_email_recipients":{"type":"array","items":{"type":"string","format":"email"}},"onboarding_state":{"type":"object","additionalProperties":true,"description":"JSONB — keys are step names, values are completion metadata"},"onboarding":{"type":"object","properties":{"steps":{"type":"object","description":"Current state of each onboarding step"},"progress":{"type":"object","properties":{"completed":{"type":"integer"},"total":{"type":"integer"}}}}},"domain_verified":{"type":"boolean"},"can_send":{"type":"boolean"},"brand_subdomain":{"allOf":[{"$ref":"#/components/schemas/BrandSubdomain"}],"nullable":true},"byo_routing":{"type":"object","description":"Warns when the brand has connected its own (BYO) email provider but verified sending domains still route through Nitrosend's hosted provider. Read-only; never blocks a send. `mismatch` is false (and `message` null) when all is well.","properties":{"mismatch":{"type":"boolean"},"provider":{"type":"string","nullable":true,"description":"The connected BYO provider, e.g. ses."},"bypassing_domains":{"type":"array","items":{"type":"string"},"description":"Verified domains still sending through Nitrosend's hosted provider."},"message":{"type":"string","nullable":true}}},"subscribed_contacts_count":{"type":"integer","description":"Count of subscribed contacts in this brand, recounted in the background at most every 10 minutes while the brand is listed or fetched."},"contacts_count":{"type":["integer","null"],"description":"Count of every contact in this brand, from the same cached recount as subscribed_contacts_count. It can lag recent changes while a background recount is pending. Null when no recount that includes it is cached."},"email_subscribed_contacts_count":{"type":["integer","null"],"description":"Count of contacts in this brand subscribed to email (the contact-level flag sends check), from the same cached recount as subscribed_contacts_count. A suppression list can still block delivery to some of them. It can lag recent changes while a background recount is pending. Null when no recount that includes it is cached."},"logo_url":{"type":"string","format":"uri","nullable":true,"readOnly":true},"logo_tone":{"type":"string","enum":["light","dark"],"nullable":true,"readOnly":true,"description":"Measured from the logo. A light mark on transparent gets a header band in emails."},"logo_aspect":{"type":"number","nullable":true,"readOnly":true,"description":"The logo's width over its height. Emails fit the logo to one header height."},"screenshot_url":{"type":"string","format":"uri","nullable":true,"readOnly":true},"site_icon_url":{"type":["string","null"],"format":"uri","readOnly":true},"site_icon_tone":{"type":["string","null"],"enum":["light","dark",null],"readOnly":true,"description":"Measured from the current website icon when available."},"capabilities":{"type":"object","additionalProperties":true},"sms_provisioned":{"type":"boolean","readOnly":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"BrandSubdomain":{"type":"object","required":["namespace_status","status","ready","preparation_required"],"properties":{"namespace_status":{"type":"string","enum":["unreserved","active","replacement_pending","retiring","retired"]},"status":{"type":"string","enum":["brand_identity_required","brand_identity_review_required","namespace_reservation_required","not_materialized","root_unavailable","ready","unavailable"]},"ready":{"type":"boolean"},"selected":{"type":"boolean"},"preparation_required":{"type":"boolean"},"from_email":{"type":"string","format":"email"},"fqdn":{"type":"string"},"apex":{"type":"string"},"local_part":{"type":"string"},"local_part_editable":{"type":"boolean"},"fqdn_changeable":{"type":"boolean","description":"Whether the current hosted address offers a rename. The write still enforces pending work and claim allowances."},"suggested_subdomain":{"type":"string","nullable":true,"description":"Candidate offered while the brand has no namespace (`namespace_status: unreserved`): derived from the company name, or from the account owner while the Brand Kit is incomplete. Absent once a name is reserved, because an allocated name never changes, and absent when nothing safe can be derived."},"message":{"type":"string","description":"Only with `status: brand_identity_required`: the next step, naming the missing fields. The same sentence the prepare_sending refusal carries."}}},"BrandSubdomainPreparationResponse":{"type":"object","required":["status","brand_subdomain"],"properties":{"status":{"type":"string","enum":["ready","unavailable"]},"brand_subdomain":{"$ref":"#/components/schemas/BrandSubdomain"}}},"AudienceReachFit":{"type":"object","required":["plan_id","slug","name","tier_group","covers"],"properties":{"plan_id":{"type":"integer"},"slug":{"type":"string"},"name":{"type":"string"},"tier_group":{"type":"string"},"daily_cap":{"type":"integer","nullable":true,"description":"Recipients per 24 hours at the account's sending standing; null when unlimited"},"capacity":{"type":"integer","nullable":true,"description":"Emails available within the month: what remains on the current plan, the first month's allowance on a candidate; null when unlimited"},"days_to_reach":{"type":"integer","nullable":true,"description":"Days until everyone has been reached once; null when the month cannot hold the send"},"covers":{"type":"boolean","description":"Whether one full send to the audience fits within the month"}}},"AudienceReach":{"type":"object","required":["audience","cohort","covered"],"properties":{"audience":{"type":"integer"},"cohort":{"type":"string","description":"The account's deliverability cohort the daily caps are read at"},"current":{"allOf":[{"$ref":"#/components/schemas/AudienceReachFit"}],"nullable":true,"description":"The current plan; null when the account has no subscription"},"recommended":{"allOf":[{"$ref":"#/components/schemas/AudienceReachFit"}],"nullable":true,"description":"The cheapest listed plan above the current one whose first month holds the send; null when the current plan covers it or no listed plan would"},"covered":{"type":"boolean","description":"Whether the current plan covers a full send"},"summary":{"type":"string","nullable":true,"description":"The one sentence every surface shows; null when covered"}}},"HostedSenderAvailability":{"type":"object","required":["subdomain","available"],"properties":{"subdomain":{"type":"string","description":"The normalized label that would be reserved (or the input when unsafe)"},"fqdn":{"type":"string","nullable":true},"available":{"type":"boolean"},"reason":{"type":"string","nullable":true,"enum":["taken","unsafe","reserved","local_part_invalid"],"description":"Why the address is unavailable; null when available"},"local_part":{"type":"string","nullable":true,"description":"The normalized local part that would be reserved (the allocator's default when none was given), or the input when it is invalid."},"from_email":{"type":"string","nullable":true,"description":"The exact address that would be reserved; null when unavailable for a policy reason"}}},"BrandDeletionSafetyImpact":{"type":"object","required":["contacts","campaigns","flows","templates","domains","messages"],"properties":{"contacts":{"type":"integer","minimum":0},"campaigns":{"type":"integer","minimum":0},"flows":{"type":"integer","minimum":0},"templates":{"type":"integer","minimum":0},"domains":{"type":"integer","minimum":0},"messages":{"type":"integer","minimum":0}}},"BrandDeletionSafetyActiveSends":{"type":"object","required":["queued_messages","active_campaigns"],"properties":{"queued_messages":{"type":"integer","minimum":0},"active_campaigns":{"type":"integer","minimum":0,"description":"Scheduled or live campaigns."}}},"BrandDeletionSafety":{"type":"object","required":["deletion_impact","active_sends","can_delete","requires_force"],"properties":{"deletion_impact":{"$ref":"#/components/schemas/BrandDeletionSafetyImpact"},"active_sends":{"$ref":"#/components/schemas/BrandDeletionSafetyActiveSends"},"can_delete":{"type":"boolean","description":"True when no force confirmation is required."},"requires_force":{"type":"boolean","description":"True when active sends require `force=true` to delete."}}},"AffiliateCenterPayload":{"type":"object","required":["enrolled","available"],"properties":{"enrolled":{"type":"boolean","description":"Whether the account is linked to a Rewardful affiliate."},"available":{"type":"boolean","description":"Whether live affiliate data or setup is currently available."},"state":{"type":"string","enum":["active","paused","unavailable"],"nullable":true},"setup_status":{"type":"string","enum":["pending","needs_details","unavailable"],"nullable":true,"description":"Present only while an entitled, unlinked account is being reconciled."},"share_url":{"type":"string","format":"uri","nullable":true},"stats":{"type":"object","properties":{"visitors":{"type":"integer","minimum":0},"leads":{"type":"integer","minimum":0},"conversions":{"type":"integer","minimum":0}}},"earnings":{"type":"object","properties":{"known":{"type":"boolean"},"total_cents":{"type":"integer","nullable":true},"currency":{"type":"string"}}}}},"BrandWebsiteInput":{"type":"object","required":["url"],"properties":{"url":{"type":"string","description":"Real business website. HTTPS is added when no scheme is supplied. A bare business email address (name@company.com) is read as its domain's website. Reserved example websites are rejected before scanning."}}},"BrandScanAdmission":{"type":"object","required":["status","url","scan_id"],"properties":{"status":{"type":"string","enum":["scanning","scraping"]},"url":{"type":"string"},"scan_id":{"type":"string"},"idempotent_replay":{"type":"boolean"}}},"BrandScanStatus":{"type":"object","required":["status","scan_id"],"properties":{"status":{"type":"string","enum":["scanning","completed","failed","unknown"]},"scan_id":{"type":"string","nullable":true},"kind":{"type":"string","enum":["website","kit"]},"url":{"type":"string"},"error":{"type":"string"},"preview":{"type":"object","additionalProperties":true}}},"SetupCenterPayload":{"type":"object","properties":{"next_actions":{"type":"array","description":"Read-only onboarding recommendations and requirements. Blocking is scoped to the stated operation; this list never authorizes delivery. Custom-domain connection is optional when a provided sender is ready.","items":{"type":"object","required":["id","blocking","state"],"properties":{"id":{"type":"string","enum":["brand","sender","address","contacts","custom_domain","agent"]},"blocking":{"type":"boolean"},"scope":{"type":"string","enum":["email","campaigns_and_flows"]},"state":{"type":"string","enum":["action_required","recommended","waiting"]}}}},"cards":{"type":"array","items":{"$ref":"#/components/schemas/SetupCenterCard"}},"sections":{"type":"object","properties":{"required":{"type":"array","items":{"type":"string"}},"recommended":{"type":"array","items":{"type":"string"}}}},"progress":{"type":"object","description":"Counts the three required cards: Brand Kit, contacts and the first audience email. Agent connection and owner previews do not count.","properties":{"completed":{"type":"integer"},"total":{"type":"integer"}}},"seen":{"type":"boolean"},"dismissed":{"type":"boolean"},"complete":{"type":"boolean"},"established":{"type":"boolean","description":"True once real accepted email history proves the brand has sent. Drafts, owner tests and operator proof are not activation. Current DNS health and recent analytics cannot reset this state. Independent of `complete` — an established brand may still carry incomplete cards it has chosen to skip. Clients use it to retire setup nudges."},"welcome_email":{"type":"object","nullable":true,"description":"The welcome email Nitrosend writes in the brand and puts in the owner's inbox once the brand has a Brand Kit of its own. A preview, not the brand's first send; the draft is kept for the brand to reuse. Null until it starts.","properties":{"state":{"type":"string","enum":["queued","writing","sending","sent","written","skipped","failed"],"description":"`written`: the draft exists and Nitrosend did not send it itself (the account is not new), so a test goes through the brand's sender. `skipped`: not written for this brand."},"campaign_id":{"type":"integer","nullable":true},"sent_at":{"type":"string","format":"date-time","nullable":true},"to":{"type":"string","nullable":true}}},"suggested_site":{"type":"string","nullable":true,"description":"A website the setup screen offers in its website box until the brand has a site of its own: the signup's work email domain, when it is a live site. Never scanned until the person asks."},"sender_choice":{"type":"string","nullable":true,"enum":["own","hosted"],"description":"Who a first real send comes from, once asked."},"contact_source":{"type":"object","nullable":true,"description":"The mail tools the last scan found evidence of on the brand's site.","properties":{"site":{"type":"string"},"tools":{"type":"array","items":{"type":"string","enum":["mailchimp","klaviyo","hubspot","mailerlite","brevo","activecampaign","shopify"]}}}},"suggested_address":{"type":"object","nullable":true,"description":"A postal address the last scan found on the brand's own site, offered while the brand has no physical_address. It is never saved by the scan: save it as physical_address only after the person confirms it.","properties":{"site":{"type":"string"},"address":{"type":"string"},"page":{"type":"string","description":"Where on the site it was found, as host and path (allbirds.com/pages/contact)."}}},"first_kit":{"type":"boolean","readOnly":true,"description":"Whether a website read now saves itself as this brand's first Brand Kit. Once it's false, a preview waits for an explicit apply."},"can_email_sign_in_link":{"type":"boolean","readOnly":true,"description":"Present on authenticated UI snapshots. Whether this requester is the fresh account owner eligible to request the saved draft link; the command rechecks authorization and draft ownership."},"current_scan":{"type":"object","nullable":true,"description":"The current admitted source reference and bounded progress. Cache expiry is unknown progress, not permission to apply a scan. Applied is a durable fact recorded on this exact source reference after its save; timestamps or cache entries for other attempts never establish it.","required":["scan_id","kind","started_at","status","applied"],"properties":{"scan_id":{"type":"string"},"kind":{"type":"string","enum":["website","kit","brief"]},"url":{"type":"string"},"started_at":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["scanning","completed","failed","unknown"]},"applied":{"type":"boolean"},"error":{"type":"string"}}}}},"SetupCenterCard":{"type":"object","properties":{"id":{"type":"string","enum":["brand_kit_scan","import_subscribers","first_email","connect_agent","dns"],"description":"The setup steps are `brand_kit_scan`, `import_subscribers` and `first_email`, the brand's first real send to its contacts (required, counted in `progress`), and `connect_agent` (recommended). `dns` is not a step: it reports whether sending still needs an address set up."},"complete":{"type":"boolean"},"acknowledged":{"type":"boolean"},"acknowledged_at":{"type":"string","format":"date-time","nullable":true},"client":{"type":"string","nullable":true,"description":"`connect_agent` only: the agent that connected first, as the API names clients (for example `Claude Code`)."},"clients":{"type":"array","items":{"type":"string"},"description":"`connect_agent` only: the agents connected now, one per live MCP connection, by the same names. Agents the API cannot name are left out."}}},"FieldCatalog":{"type":"object","required":["id","key","category","field_type","presentation_type","presentation_options","label","promoted"],"properties":{"id":{"type":"integer"},"key":{"type":"string","description":"Dot-separated field key. Typed contact columns use the bare column name\n(e.g. `email`, `first_name`). JSONB data keys are prefixed with `data.`\n(e.g. `data.plan`, `data.apollo.title`, `data.hubspot.company`, `data.tags`).\n"},"category":{"type":"string","enum":["contact","custom","enrichment","engagement","tag"],"description":"Derived from the key namespace.\n- `contact` — typed column on the contacts table\n- `tag` — `data.tags` array\n- `enrichment` — reserved enrichment namespaces such as `data.apollo.*`, `data.pdl.*`, `data.attio.*`, `data.hubspot.*`, `data.stripe.*`, `data.shopify.*`, and derived `data.nitro.*`\n- `custom` — any other `data.*` key\n- `engagement` — future engagement traits (reserved)\n"},"field_type":{"type":"string","enum":["string","number","boolean","date","enum"],"description":"Inferred from the first observed value; pinned and never flipped."},"presentation_type":{"type":"string","enum":["text","number","currency","percent","date","datetime","boolean","enum"],"description":"Shared presentation contract used by fact displays and generated merge tags."},"presentation_options":{"type":"object","additionalProperties":true,"description":"Provider-supplied formatting metadata such as decimal precision,\ncurrency-code field path, unit scale, or percentage multiplier.\n"},"label":{"type":"string","description":"Human-readable label. Defaults to a humanized version of the key."},"display_label":{"type":"string","description":"Source-qualified field label suitable for display."},"source_key":{"type":"string","nullable":true},"source_name":{"type":"string","nullable":true},"object_label":{"type":"string","nullable":true},"source_field_label":{"type":"string","nullable":true},"merge_tag":{"type":"string","nullable":true,"description":"Ready-to-insert merge tag for a scalar custom or projected integration field.\nTyped fields include the deterministic presentation filter used by preview,\ntest, and delivery rendering.\n"},"promoted":{"type":"boolean","description":"Whether this field is pinned as a default column in the contacts grid."},"fill_rate":{"type":"string","nullable":true,"description":"Percentage of contacts that have a non-null value for this field.\nComputed asynchronously; may be null if the refresh job has not run yet.\n","example":"75.0"},"fill_rate_refreshed_at":{"type":"string","format":"date-time","nullable":true,"description":"When fill_rate was last computed."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"DeliveryCapacity":{"type":"object","additionalProperties":false,"required":["status","limit","reserved","accepted","provider_unknown","remaining"],"properties":{"source":{"type":"string","enum":["plan","operator_override","shared_domain"]},"window_seconds":{"type":"integer","const":86400},"status":{"type":"string","enum":["known","unlimited","not_applicable","unknown","degraded"]},"limit":{"type":"integer","minimum":0,"nullable":true},"reserved":{"type":"integer","minimum":0,"nullable":true},"accepted":{"type":"integer","minimum":0,"nullable":true},"provider_unknown":{"type":"integer","minimum":0,"nullable":true},"remaining":{"type":"integer","minimum":0,"nullable":true}}},"SharedAbuseCapacity":{"type":"object","additionalProperties":false,"description":"Retired shared probation allowance. Status is always not_applicable; the field remains for compatibility.","required":["status"],"properties":{"status":{"type":"string","enum":["available","deferred","not_applicable","unknown","degraded"]},"reason_code":{"type":"string","const":"signup_sending_capacity_reached"},"retry_at":{"type":"string","format":"date-time"}}},"DeliveryPacingScope":{"type":"object","additionalProperties":false,"required":["type","status","minimum_interval_seconds","feedback_epoch"],"properties":{"type":{"type":"string"},"key":{"type":"string"},"status":{"type":"string","enum":["ready","deferred"]},"next_dispatch_at":{"type":"string","format":"date-time"},"minimum_interval_seconds":{"type":"number","minimum":0},"baseline_rate_per_second":{"type":"number","minimum":0},"effective_rate_per_second":{"type":"number","minimum":0},"cooldown_reason":{"type":"string"},"cooldown_until":{"type":"string","format":"date-time"},"feedback_epoch":{"type":"integer","minimum":0}}},"DeliveryPacingState":{"type":"object","additionalProperties":false,"required":["status","policy_version","scopes"],"properties":{"status":{"type":"string","enum":["ready","deferred"]},"policy_version":{"type":"string"},"queued_quantity":{"type":"integer","minimum":0},"next_dispatch_at":{"type":"string","format":"date-time"},"shared_sender":{"$ref":"#/components/schemas/SharedSenderStatus"},"initial_bulk_observation":{"type":"object","additionalProperties":false,"required":["status","reason_code","retry_at","label","detail"],"properties":{"status":{"type":"string","enum":["observing","deferred"]},"reason_code":{"type":"string","const":"initial_bulk_observation"},"retry_at":{"type":"string","format":"date-time"},"label":{"type":"string"},"detail":{"type":"string"}}},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryPacingScope"}}}},"SharedSenderStatus":{"type":"object","additionalProperties":false,"required":["status","observed_at","episode_key","label","detail","recovery_actions"],"properties":{"status":{"type":"string","enum":["ready","deferred","paused","degraded"]},"reason_code":{"type":"string","enum":["shared_sender_rate_limited","shared_sender_provider_backpressure","shared_sender_evidence_pending"]},"retry_at":{"type":"string","format":"date-time"},"observed_at":{"type":"string","format":"date-time"},"episode_key":{"type":"string"},"label":{"type":"string"},"detail":{"type":"string"},"recovery_actions":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["type","label","url"],"properties":{"type":{"type":"string","enum":["connect_domain","contact_support"]},"label":{"type":"string"},"url":{"type":"string","format":"uri"}}}}}},"DeliveryStatusIssue":{"type":"object","additionalProperties":false,"required":["control","reason_code","retryable"],"properties":{"control":{"type":"string","enum":["account_status","brand","sender_identity","commercial_capacity","shared_abuse_capacity"]},"reason_code":{"type":"string","enum":["sending_paused","brand_unavailable","sender_not_ready","sending_capacity_reached","signup_sending_capacity_reached","delivery_evidence_pending"]},"retryable":{"type":"boolean"},"retry_at":{"type":"string","format":"date-time"}}},"DeliveryStatus":{"type":"object","additionalProperties":false,"required":["assessment_scope","admission_status","commercial_capacity","shared_abuse_capacity","pacing_state","issues","observed_at"],"properties":{"assessment_scope":{"type":"string","const":"account_capacity"},"admission_status":{"type":"string","enum":["allowed","deferred","denied"]},"sending_pause":{"$ref":"#/components/schemas/SendingPause"},"commercial_capacity":{"$ref":"#/components/schemas/DeliveryCapacity"},"shared_abuse_capacity":{"$ref":"#/components/schemas/SharedAbuseCapacity"},"capacity_recovery":{"$ref":"#/components/schemas/DeliveryCapacityRecovery"},"pacing_state":{"$ref":"#/components/schemas/DeliveryPacingState"},"blocking_control":{"type":"string","enum":["account_status","brand","sender_identity","commercial_capacity","shared_abuse_capacity"]},"reason_code":{"type":"string"},"issues":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryStatusIssue"}},"retry_at":{"type":"string","format":"date-time"},"observed_at":{"type":"string","format":"date-time"}}},"CampaignVersionInput":{"type":"object","required":["subject"],"additionalProperties":false,"properties":{"subject":{"type":"string","minLength":1},"generation_event_id":{"type":"integer","description":"From a suggested line in readiness `versions.lines`."},"candidate_locator":{"type":"string","description":"From a suggested line in readiness `versions.lines`."}}},"CampaignWinnerInput":{"type":"object","required":["test_share_percent"],"additionalProperties":false,"description":"Send the versions to a test part of the list, then the winning version to the rest after the wait. Omit to split everyone. When nothing clearly wins, the rest gets the campaign's own subject line.","properties":{"test_share_percent":{"type":"integer","minimum":1,"maximum":95,"description":"From readiness `versions.test_shares[n].min_bp / 100` up to 95."},"wait_hours":{"type":"integer","enum":[2,4,8,24],"default":4},"measure":{"type":"string","enum":["opens","clicks"],"default":"opens"}}},"SubjectVersionOffer":{"type":"object","description":"Subject line versions for this campaign's audience. Read only.","properties":{"eligible":{"type":"boolean"},"learning_notice":{"type":"string","description":"Brand learning and withdrawal terms to display before a multivariant send."},"audience_count":{"type":["integer","null"]},"max_versions":{"type":"integer"},"test_shares":{"type":["object","null"],"description":"By number of lines kept (2 up to max_versions): the smallest and the starting winner test share in basis points, and whether sending the winner fits. Null while the audience count is unknown.","additionalProperties":{"type":"object","properties":{"min_bp":{"type":"integer"},"default_bp":{"type":"integer"},"winner_available":{"type":"boolean"}}}},"wait_hours":{"type":"array","items":{"type":"integer"}},"status":{"type":"string","enum":["none","writing","ready","unavailable"]},"phase":{"type":"string","enum":["checking"],"description":"While writing: the lines are written and their checks have begun. Absent before that."},"reason":{"type":"string"},"lines":{"type":"array","description":"Suggested alternatives for the current content.","items":{"type":"object","properties":{"subject":{"type":"string"},"approach":{"type":"string"},"generation_event_id":{"type":"integer"},"candidate_locator":{"type":"string"}}}}}},"BrandNitrollmLearning":{"type":"object","required":["status","available","can_decide","disclosure"],"properties":{"status":{"type":"string","enum":["unanswered","opted_in","declined","withdrawn"]},"available":{"type":"boolean"},"can_decide":{"type":"boolean"},"disclosure":{"type":"object","required":["revision","heading","body"],"properties":{"revision":{"type":"string"},"heading":{"type":"string"},"body":{"type":"string"}}}}},"SubjectTestOutcome":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["pending","mature","unavailable"]},"reason":{"type":"string"},"due_at":{"type":"string","format":"date-time"},"observed_at":{"type":"string","format":"date-time"},"policy":{"type":"string"},"measure":{"type":"string","enum":["opens","clicks"]},"unsubscribe_attribution":{"type":"string","const":"inferred_contact_opt_out"},"qualified_verdict":{"type":["object","null"]},"arms":{"type":"array","items":{"type":"object","properties":{"key":{"type":"integer"},"sent":{"type":"integer"},"delivered":{"type":"integer"},"non_bounced":{"type":"integer"},"bounced":{"type":"integer"},"opens":{"type":"integer"},"clicks":{"type":"integer"},"proxy_opens":{"type":"integer"},"qualified_opens":{"type":["integer","null"]},"qualified_clicks":{"type":["integer","null"]},"complaints":{"type":"integer"},"unsubscribes":{"type":"integer"}}}}}},"CampaignExperiment":{"type":"object","description":"The test on this send. Rates and the verdict appear only once decided, from the numbers frozen at that time.","properties":{"id":{"type":"integer"},"recipients":{"type":"integer"},"mode":{"type":"string","enum":["split","winner"]},"state":{"type":"string","enum":["running","awaiting_winner","sending_winner","complete","stopped"]},"measure":{"type":"string","enum":["opens","clicks"]},"stop_reason":{"type":"string"},"test_share_percent":{"type":"number"},"wait_hours":{"type":"integer"},"decide_at":{"type":"string","format":"date-time"},"decided_at":{"type":"string","format":"date-time"},"winner_sent":{"type":"integer"},"outcomes":{"type":"object","properties":{"48h":{"$ref":"#/components/schemas/SubjectTestOutcome"},"7d":{"$ref":"#/components/schemas/SubjectTestOutcome"}}},"learning_prompt":{"type":"object","properties":{"eligible":{"type":"boolean"},"results_url":{"type":"string"}}},"versions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"integer"},"letter":{"type":"string"},"subject":{"type":"string"},"own":{"type":"boolean"},"writer":{"type":"string","enum":["owner","ai"]},"approach":{"type":"string"},"sent":{"type":"integer"},"open_rate":{"type":["number","null"]},"click_rate":{"type":["number","null"]},"unsubscribe_rate":{"type":["number","null"],"description":"People who unsubscribed after this version was sent, by the horizon, over sent."}}}},"verdict":{"type":"object","properties":{"rule":{"type":"string"},"reason":{"type":"string"},"winner_key":{"type":["integer","null"]},"chosen_key":{"type":["integer","null"]}}}}},"DeliveryReviewBudgetStatus":{"type":"object","description":"Read-only account allowance for potentially reviewable new email content. Informational only; it neither authorizes delivery nor blocks approval. Non-email readiness omits this property. Remaining allowance and reset times are omitted when unavailable or not applicable. Exhaustion does not imply that cached content or exempt workloads cannot be sent.","required":["status","assessment_scope","channel","observed_at","message","note"],"properties":{"status":{"type":"string","enum":["available","exhausted","not_applicable","unavailable"]},"assessment_scope":{"type":"string","const":"new_content_review"},"channel":{"type":"string","const":"email"},"observed_at":{"type":"string","format":"date-time"},"message":{"type":"string"},"note":{"type":"string"},"reason_code":{"type":"string","const":"delivery_evidence_pending"},"retry_at":{"type":"string","format":"date-time","description":"UTC release of the blocking calendar allowance; present when exhausted."},"remaining":{"type":"object","required":["hour","day"],"properties":{"hour":{"type":"integer","minimum":0},"day":{"type":"integer","minimum":0}}},"resets_at":{"type":"object","required":["hour","day"],"properties":{"hour":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date-time"}}}}},"DeliveryCapacityRecovery":{"type":"object","description":"Informational recovery at 80 percent used, exhaustion, or when a campaign exceeds remaining allowance. Never denies a send or promises that payment or verification bypasses safety. Actions come from the shared backend projection; only offer verification when new valid proof can improve standing. Capacity counters and usage_percent are present for the account's commercial allowance only; shared probation notices never disclose platform totals.","required":["state","reason_code","blocking_control","label","detail","recovery_actions"],"properties":{"state":{"type":"string","enum":["approaching","reached","campaign_exceeds_remaining"]},"reason_code":{"type":"string","enum":["sending_capacity_warning","sending_capacity_reached","signup_sending_capacity_reached"]},"blocking_control":{"type":"string","enum":["commercial_capacity","shared_abuse_capacity"]},"usage_percent":{"type":"integer","minimum":0,"maximum":100},"requested_quantity":{"type":"integer","minimum":0},"label":{"type":"string"},"detail":{"type":"string"},"capacity":{"$ref":"#/components/schemas/DeliveryCapacity"},"upgrade_url":{"type":"string","format":"uri","description":"Shareable account-specific plan link. Authentication and billing permissions still apply."},"retry_at":{"type":"string","format":"date-time","description":"Recorded retry time, not a guarantee that delivery completes then."},"recovery_action":{"$ref":"#/components/schemas/DeliveryCapacityRecoveryAction"},"recovery_actions":{"type":"array","minItems":0,"items":{"$ref":"#/components/schemas/DeliveryCapacityRecoveryAction"}},"owner_action":{"$ref":"#/components/schemas/DeliveryCapacityRecoveryAction"}}},"DeliveryCapacityRecoveryAction":{"type":"object","required":["type","label","url"],"properties":{"type":{"type":"string","enum":["upgrade_plan","verify_list","contact_owner","manage_provider_billing","contact_support","connect_domain"]},"label":{"type":"string"},"detail":{"type":"string"},"url":{"type":"string","format":"uri"},"required_role":{"type":"string","const":"account_owner_or_admin"}}},"ValidationAudience":{"type":"object","additionalProperties":false,"properties":{"lead_ids":{"type":"array","minItems":1,"maxItems":100000,"uniqueItems":true,"items":{"type":"integer","minimum":1},"description":"Explicit Lead selection in the current Brand. Does not create marketing Contacts or require a discovery search."},"contact_channel_ids":{"type":"array","minItems":1,"maxItems":100000,"uniqueItems":true,"items":{"type":"integer"}},"contact_ids":{"type":"array","minItems":1,"maxItems":100000,"uniqueItems":true,"items":{"type":"integer"}},"list_id":{"type":"integer"},"segment_id":{"type":"integer"},"all_contacts":{"type":"boolean","const":true,"description":"All email channels in the current Brand, subject to the 100000-candidate operation bound."},"quote_digest":{"type":"string","pattern":"^[0-9a-f]{64}$","description":"Pass the reviewed quote digest when creating an operation. A changed address set, eligibility or price returns 409 validation_quote_changed without holding funds. Omit only when intentionally authorizing the current audience at the current price."}},"oneOf":[{"required":["lead_ids"]},{"required":["contact_channel_ids"]},{"required":["contact_ids"]},{"required":["list_id"]},{"required":["segment_id"]},{"required":["all_contacts"]}]},"ValidationOperationCounts":{"type":"object","additionalProperties":false,"required":["candidate_count","deduplicated_count","cached_count","ineligible_count","eligible_count"],"properties":{"candidate_count":{"type":"integer","minimum":0},"deduplicated_count":{"type":"integer","minimum":0},"cached_count":{"type":"integer","minimum":0},"ineligible_count":{"type":"integer","minimum":0},"eligible_count":{"type":"integer","minimum":0},"pending_count":{"type":"integer","minimum":0},"executing_count":{"type":"integer","minimum":0},"billable_count":{"type":"integer","minimum":0},"not_billable_count":{"type":"integer","minimum":0},"provider_unknown_count":{"type":"integer","minimum":0},"failed_count":{"type":"integer","minimum":0}}},"ValidationOperationPricing":{"type":"object","additionalProperties":false,"required":["price_book_version","unit_rate_cents","maximum_charge_cents","currency","expires_at"],"properties":{"price_book_version":{"type":"string"},"unit_rate_cents":{"type":"string"},"included_quantity":{"type":"integer","minimum":0},"maximum_charge_cents":{"type":"integer","minimum":0},"committed_cents":{"type":"integer","minimum":0},"released_cents":{"type":"integer","minimum":0},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"quote_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"expires_at":{"type":"string","format":"date-time"},"execution_deadline_at":{"type":"string","format":"date-time","nullable":true}}},"ValidationOperationFunding":{"type":"object","additionalProperties":false,"required":["route","available"],"properties":{"route":{"type":"string","const":"direct_prepaid"},"available":{"type":"boolean"},"reason":{"type":"string"},"usage_event_id":{"type":"integer"},"state":{"type":"string","enum":["needs_funding","held","committed","released"]},"recovery":{"type":"object","additionalProperties":true}}},"ValidationOperationQuote":{"type":"object","additionalProperties":false,"required":["status","source_kind","counts","pricing","funding","spend","mutation","quote_digest"],"properties":{"status":{"type":"string","enum":["quoted","needs_funding"]},"source_kind":{"type":"string","enum":["contact_channel","contact","list","segment","all_contacts","lead"]},"quote_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"counts":{"$ref":"#/components/schemas/ValidationOperationCounts"},"pricing":{"$ref":"#/components/schemas/ValidationOperationPricing"},"funding":{"$ref":"#/components/schemas/ValidationOperationFunding"},"spend":{"$ref":"#/components/schemas/SpendProjection"},"mutation":{"type":"boolean","const":false}}},"ValidationOperation":{"type":"object","additionalProperties":false,"required":["operation_id","status","source_kind","item_detail","counts","pricing","funding","spend"],"properties":{"operation_id":{"type":"string","minLength":32,"maxLength":64},"status":{"type":"string","enum":["requested","quoted","held","executing","partially_committed","committed","released","needs_funding","failed"]},"source_kind":{"type":"string","enum":["contact_channel","contact","list","segment","all_contacts","lead"]},"item_detail":{"type":"object","additionalProperties":false,"required":["status"],"properties":{"status":{"type":"string","enum":["available","compacted"]},"compacted_at":{"type":"string","format":"date-time"},"item_count":{"type":"integer","minimum":0}}},"counts":{"$ref":"#/components/schemas/ValidationOperationCounts"},"results":{"type":"object","additionalProperties":false,"description":"Per-verdict results across this run's checks and the results it reused. Absent for runs compacted before verdicts were kept.","properties":{"valid_count":{"type":"integer","minimum":0},"invalid_count":{"type":"integer","minimum":0},"disposable_count":{"type":"integer","minimum":0},"unknown_count":{"type":"integer","minimum":0},"catchall_count":{"type":"integer","minimum":0}}},"unconfirmed":{"type":"object","additionalProperties":false,"description":"Unknown and catch-all addresses. Left out of sends by default once the run finishes; keepable per run.","properties":{"excluded_count":{"type":"integer","minimum":0,"description":"Addresses this run currently holds out of sends."},"sendable_count":{"type":"integer","minimum":0,"description":"This run's unknown and catch-all addresses still in sends."},"pending":{"type":"boolean","description":"The run is still leaving its unconfirmed addresses out."},"kept_count":{"type":"integer","minimum":0},"kept_at":{"type":"string","format":"date-time"},"can_include":{"type":"boolean","description":"Including this run's left-out addresses can be requested now."},"can_leave_out":{"type":"boolean","description":"Leaving this run's sendable unconfirmed addresses out can be requested now."},"include_blocked":{"type":"boolean","description":"Present and true when sending resumed automatically on the condition unconfirmed addresses stay out. Including them needs support until an operator release."}}},"pricing":{"$ref":"#/components/schemas/ValidationOperationPricing"},"funding":{"$ref":"#/components/schemas/ValidationOperationFunding"},"spend":{"$ref":"#/components/schemas/SpendProjection"},"failure_code":{"type":"string"},"started_at":{"type":"string","format":"date-time"},"completed_at":{"type":"string","format":"date-time"},"next_action":{"type":"string"}}},"ValidationOperationItem":{"type":"object","additionalProperties":false,"required":["id","status"],"properties":{"id":{"type":"integer"},"contact_channel_id":{"type":"integer","nullable":true},"lead_id":{"type":"integer","nullable":true},"email":{"type":"string","format":"email","description":"Current address only if it still matches the retained verification identity"},"provider_observed_at":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["pending","executing","billable","not_billable","provider_unknown","failed"]},"billable":{"type":"boolean"},"provider":{"type":"string"},"native_status":{"type":"string"},"verdict":{"type":"string"},"failure_code":{"type":"string"},"result_reference":{"type":"object","additionalProperties":true},"completed_at":{"type":"string","format":"date-time"}}},"ContactEnrichmentQuote":{"type":"object","required":["selected_count","already_current_count","reusable_count","provider_required_count","unavailable_count","maximum_billable_outcomes","unit_rate_cents","maximum_charge_cents","currency","price_book_version","available","spend"],"properties":{"quote_digest":{"type":"string","pattern":"^[a-f0-9]{64}$"},"selected_count":{"type":"integer"},"already_current_count":{"type":"integer"},"reusable_count":{"type":"integer"},"provider_required_count":{"type":"integer"},"unavailable_count":{"type":"integer"},"maximum_billable_outcomes":{"type":"integer"},"resource":{"type":"string","enum":["contact_profile_enrichment"]},"unit_rate_cents":{"type":"string"},"maximum_charge_cents":{"type":"integer"},"currency":{"type":"string","enum":["USD"]},"price_book_version":{"type":"string"},"available":{"type":"boolean"},"reason":{"type":"string","nullable":true},"spend":{"$ref":"#/components/schemas/SpendProjection"}}},"SpendProjection":{"type":"object","required":["schema","status","route","currency","maximum_charge_cents","funding","recovery_action"],"properties":{"schema":{"type":"string","const":"nitrosend.spend.v1"},"status":{"type":"string","enum":["ready","needs_funding","payment_pending","blocked","unavailable"]},"route":{"type":"string","enum":["direct_prepaid","included","postpaid","shopify","vercel","legacy"]},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"maximum_charge_cents":{"type":"integer","minimum":0},"balance":{"$ref":"#/components/schemas/SpendBalance"},"funding":{"type":"object","additionalProperties":true,"description":"Canonical account funding projection from Billing::Funding::Presenter."},"recovery_action":{"$ref":"#/components/schemas/SpendRecoveryAction"}}},"PaidActionIntentCreate":{"type":"object","required":["adapter_key","adapter_version","operation_idempotency_key","state_payload"],"properties":{"adapter_key":{"type":"string","minLength":1,"maxLength":100},"adapter_version":{"type":"string","minLength":1,"maxLength":32},"operation_idempotency_key":{"type":"string","minLength":1,"maxLength":128},"state_payload":{"type":"object","additionalProperties":true,"description":"Adapter-owned state, validated and encrypted before persistence."}}},"PaidActionIntent":{"type":"object","required":["id","schema","status","adapter","operation_idempotency_key","original_quote_fingerprint","expires_at"],"properties":{"id":{"type":"string","minLength":32,"maxLength":64,"description":"Opaque public continuation identifier."},"schema":{"type":"string","const":"nitrosend.paid_action_intent.v1"},"status":{"type":"string","enum":["open","awaiting_funding","ready_to_resume","consumed","cancelled","expired"]},"adapter":{"type":"object","required":["key","version"],"properties":{"key":{"type":"string"},"version":{"type":"string"}}},"operation_idempotency_key":{"type":"string"},"original_quote_fingerprint":{"type":"string","pattern":"^[0-9a-f]{64}$"},"current_quote_fingerprint":{"type":"string","pattern":"^[0-9a-f]{64}$"},"quote_changed":{"type":"boolean"},"state_payload":{"type":"object","additionalProperties":true},"quote":{"type":"object","additionalProperties":true},"expires_at":{"type":"string","format":"date-time"},"consumed_at":{"type":"string","format":"date-time","nullable":true},"cancelled_at":{"type":"string","format":"date-time","nullable":true}}},"SpendBalance":{"type":"object","required":["available_cents","reserved_cents","shortfall_cents"],"properties":{"available_cents":{"type":"integer"},"reserved_cents":{"type":"integer","minimum":0},"shortfall_cents":{"type":"integer","minimum":0}}},"SpendRecoveryAction":{"type":"object","additionalProperties":false,"properties":{"type":{"type":"string","enum":["add_funds","retry_add_funds","complete_checkout","wait_for_payment","ask_account_admin","manage_in_shopify","manage_in_marketplace","contact_support","unavailable"]},"reason":{"type":"string"},"operation":{"type":"string","enum":["add_funds"]},"url":{"type":"string","format":"uri"},"purchase_id":{"type":"integer"},"shortfall_cents":{"type":"integer","minimum":0},"minimum_cents":{"type":"integer","minimum":0},"maximum_cents":{"type":"integer","minimum":0},"recommended_cents":{"type":"integer","minimum":0},"preset_cents":{"type":"array","uniqueItems":true,"items":{"type":"integer","minimum":0}}}},"ContactEnrichmentFundingRequired":{"type":"object","required":["code","message","error","error_code","currency","required_cents","available_cents","reserved_cents","shortfall_cents","funding","recovery_action","spend"],"properties":{"code":{"type":"string","const":"insufficient_balance"},"message":{"type":"string"},"error":{"type":"boolean","const":true},"error_code":{"type":"string","const":"insufficient_balance"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"required_cents":{"type":"integer","minimum":0},"available_cents":{"type":"integer"},"reserved_cents":{"type":"integer","minimum":0},"shortfall_cents":{"type":"integer","minimum":0},"funding":{"type":"object","additionalProperties":true},"recovery_action":{"type":"object","additionalProperties":true},"spend":{"$ref":"#/components/schemas/SpendProjection"}}},"ContactEnrichmentDispatch":{"type":"object","required":["selected_count","queued_count","already_current_count","reusable_count","provider_required_count","unavailable_count","maximum_charge_cents","currency","price_book_version","idempotent_replay"],"properties":{"selected_count":{"type":"integer"},"queued_count":{"type":"integer"},"already_current_count":{"type":"integer"},"reusable_count":{"type":"integer"},"provider_required_count":{"type":"integer"},"unavailable_count":{"type":"integer"},"maximum_charge_cents":{"type":"integer"},"currency":{"type":"string","enum":["USD"]},"price_book_version":{"type":"string"},"idempotent_replay":{"type":"boolean"}}},"Contact":{"type":"object","properties":{"id":{"type":"integer"},"brand_id":{"type":"integer","nullable":true},"uuid":{"type":"string","format":"uuid"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"source":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"flag_emoji":{"type":"string","nullable":true,"description":"Unicode regional-indicator emoji pair derived from country_code (e.g. \"🇦🇺\"). Null when country_code is blank."},"data":{"type":"object","additionalProperties":true,"description":"Custom key-value data. The reserved key `tags` holds an array of\nstring labels used for segmentation and targeting. Reserved enrichment\nnamespaces such as `apollo`, `pdl`, `attio`, `hubspot`, `stripe`,\n`shopify`, and derived `nitro` may appear when integrations or\nenrichment jobs write source-scoped data.\n","example":{"tags":["vip","newsletter"],"plan":"pro"}},"subscribed_phone":{"type":"boolean"},"subscribed_email":{"type":"boolean"},"email":{"type":"string","format":"email","nullable":true,"description":"Convenience value for the preferred email channel. Full channel detail remains in channels[]."},"subscribed":{"type":"object","properties":{"email":{"type":"boolean"},"phone":{"type":"boolean"}},"description":"Denormalized subscription summary by channel family."},"verification_status":{"type":"string","enum":["verified","suppressed","unverified"]},"verification_result":{"type":"string","nullable":true,"enum":["valid","invalid","disposable","catchall","unknown",null],"description":"Newest list-verification result for the contact's email; null when never checked."},"enrichment_status":{"type":"string","enum":["enriched","not_enriched"]},"mailbox_provider":{"type":"string","enum":["gmail","apple","outlook","corporate","unknown"],"description":"Derived mailbox provider for the contact's primary email domain.\nKnown consumer domains map to gmail, apple, or outlook; any other\nvalid email domain maps to corporate; unknown means no email is present.\n"},"list_ids":{"type":"array","items":{"type":"integer"}},"last_interacted_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"engagement":{"type":"object","nullable":true,"description":"Aggregated email engagement rollup for this contact. All fields are\nnil-safe: when no rollup row exists yet, rating is \"never\", counts\nare 0, rates and timestamps are null.\n","properties":{"rating":{"type":"string","enum":["engaged","warm","cooling","dormant","never"],"description":"Five-tier engagement rating based on recency of opens and clicks."},"emails_sent":{"type":"integer"},"unique_opens":{"type":"integer"},"clicks":{"type":"integer"},"open_rate":{"type":"number","format":"float","nullable":true},"click_rate":{"type":"number","format":"float","nullable":true},"last_opened_at":{"type":"string","format":"date-time","nullable":true},"last_clicked_at":{"type":"string","format":"date-time","nullable":true}}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/ContactChannel"}}}},"ContactChannel":{"type":"object","properties":{"id":{"type":"integer"},"contact_id":{"type":"integer"},"kind":{"type":"string","enum":["email","phone"]},"value":{"type":"string"},"subscribed":{"type":"boolean"},"verified":{"type":"boolean"},"opt_in_at":{"type":"string","format":"date-time","nullable":true},"opt_out_at":{"type":"string","format":"date-time","nullable":true},"sent_count":{"type":"integer"},"fail_count":{"type":"integer"},"data":{"type":"object","additionalProperties":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ImageAsset":{"type":"object","properties":{"media_kind":{"type":"string","enum":["image"]},"media_url":{"type":"string","format":"uri"},"image_url":{"type":"string","format":"uri"},"signed_id":{"type":"string"},"filename":{"type":"string"},"content_type":{"type":"string"},"byte_size":{"type":"integer"},"width":{"type":"integer","nullable":true,"description":"Intrinsic pixel width when detectable."},"height":{"type":"integer","nullable":true,"description":"Intrinsic pixel height when detectable."}}},"ContactList":{"type":"object","properties":{"id":{"type":"integer"},"account_id":{"type":"integer"},"brand_id":{"type":"integer","nullable":true},"name":{"type":"string"},"contacts_count":{"type":"integer"},"segment_id":{"type":"integer","nullable":true},"stale":{"type":"boolean"},"last_populated_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ListDeleteWarning":{"type":"object","properties":{"campaign_names":{"type":"array","items":{"type":"string"}},"flow_names":{"type":"array","items":{"type":"string"}}}},"BulkListContactsRequest":{"type":"object","required":["action","emails"],"properties":{"action":{"type":"string","enum":["add","remove"],"description":"Add existing contacts to the list or remove them from it."},"emails":{"type":"array","minItems":1,"maxItems":500,"items":{"type":"string","format":"email"}}}},"BulkListContactsResponse":{"type":"object","properties":{"action":{"type":"string","enum":["add","remove"]},"list_id":{"type":"integer"},"added":{"type":"integer","description":"Contacts newly added for add actions"},"removed":{"type":"integer","description":"Contacts removed for remove actions"},"already_in_list":{"type":"array","items":{"type":"string","format":"email"}},"not_in_list":{"type":"array","items":{"type":"string","format":"email"}},"not_found":{"type":"array","items":{"type":"string","format":"email"}},"invalid_emails":{"type":"array","items":{"type":"string"}}}},"DirectUploadCreateRequest":{"type":"object","required":["blob"],"properties":{"purpose":{"type":"string","enum":["import","image","media_asset","source","email_html"],"description":"Use `import` for CSV contacts, `image` or `media_asset` for images, `source` for documents to read, or `email_html` for a complete HTML email up to 1 MiB."},"blob":{"type":"object","required":["filename","byte_size","checksum"],"properties":{"filename":{"type":"string","example":"contacts.csv"},"byte_size":{"type":"integer","example":1048576},"checksum":{"type":"string","description":"Base64-encoded MD5 checksum for Active Storage direct upload."},"content_type":{"type":"string","example":"text/csv"},"metadata":{"type":"object","additionalProperties":true}}}}},"DirectUpload":{"type":"object","properties":{"signed_id":{"type":"string","description":"Submit this value to endpoints that consume direct uploads."},"filename":{"type":"string"},"byte_size":{"type":"integer"},"content_type":{"type":"string","nullable":true},"direct_upload":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"headers":{"type":"object","additionalProperties":{"type":"string"}}}}}},"ImportPolicy":{"type":"object","description":"Import limits for the authenticated account, derived from its deliverability standing. Clients render these values and never recompute them.","required":["standing","max_rows","max_file_size_bytes","max_file_size_mb","max_active_imports","create_rate_limit_per_minute","direct_upload_rate_limit_per_minute","write_modes"],"properties":{"standing":{"type":"string","description":"The account standing the limits derive from.","example":"trusted"},"max_rows":{"type":"integer","nullable":true,"description":"Row ceiling for one import. Null means no row ceiling for this standing.","example":null},"max_file_size_bytes":{"type":"integer","example":2147483648},"max_file_size_mb":{"type":"integer","example":2048},"max_active_imports":{"type":"integer","example":10},"create_rate_limit_per_minute":{"type":"integer","example":10},"direct_upload_rate_limit_per_minute":{"type":"integer","example":30},"write_modes":{"type":"array","items":{"type":"string","enum":["real","shadow","dry_run"]}}}},"ImportSpec":{"type":"object","required":["resource","parser","fields","guardrails"],"properties":{"resource":{"type":"string","enum":["contacts","leads"]},"parser":{"type":"string","enum":["default"]},"ui":{"type":"object","additionalProperties":true},"required_rules":{"type":"object","additionalProperties":true},"fields":{"type":"array","description":"Default contacts consent targets use polarity-explicit labels.\n`email_status` aliases: Email marketing, Subscribed, Subscription status,\nopt_in, opt in, opt-in, subscribed_email, email_status.\n`email_opt_out` aliases: Unsubscribed, Opted out, opt_out, opt out, email_opt_out.\n`opt_in_at` aliases: Opt In Date, consent date, opt_in_at.\nHeader matching ignores case, surrounding whitespace and a leading BOM.\nBare Status requires explicit mapping; it is never a consent alias.\nA date-valued Opt-in column must be remapped to Opt In Date or Skip.\n","items":{"type":"object","additionalProperties":true}},"guardrails":{"$ref":"#/components/schemas/ImportPolicy"}}},"ImportGuardrail":{"type":"object","description":"How this import stands against the account's standing row limit.","required":["tier","status","standing","max_rows"],"properties":{"tier":{"type":"string","enum":["auto","contact_us"],"description":"auto when the row count is within the standing limit; contact_us when it is above it and the import halted."},"status":{"type":"string","enum":["ok","contact_sales"],"description":"Client-facing guardrail status vocabulary."},"standing":{"type":"string","description":"The account standing the limit derives from.","example":"probation"},"max_rows":{"type":"integer","nullable":true,"description":"Row ceiling for the standing. Null means no row ceiling.","example":250000}}},"Import":{"type":"object","properties":{"id":{"type":"integer"},"resource":{"type":"string","enum":["contacts","leads"]},"parser":{"type":"string","enum":["default"]},"status":{"type":"string","enum":["pending","processing","failed","canceled","complete","contact_us"]},"total_rows":{"type":"integer","nullable":true},"success_rows":{"type":"integer","nullable":true},"failed_rows":{"type":"integer","nullable":true},"email_rows":{"type":"object","nullable":true,"description":"Email row results from committed import writes; retries do not double-count ranges. Null for imports without recorded results.","properties":{"subscribed":{"type":"integer"},"unsubscribed":{"type":"integer"},"blocked":{"type":"integer"}}},"warning_rows":{"type":"integer","description":"Rows with ingest-time warnings (at most one per row), including skipped optional channels/email consent, ignored historical dates or conflicting declarations resolved to unsubscribe. These diagnostics may remain if a later bulk flush fails; success_rows credits committed writes only."},"progress":{"type":"object","description":"Canonical live-progress block (the single progress representation). `pct` is the only percent source; a null `pct` means indeterminate.","properties":{"status":{"type":"string","enum":["pending","running","complete","failed"]},"pct":{"type":"number","nullable":true},"stages":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"count":{"type":"integer"},"state":{"type":"string","enum":["done","active","pending","failed"]}}}}}},"import_errors":{"type":"array","description":"Row-level errors as `[line_number, message, source]`. `invalid_consent` rejects unusable status before buffering when an email is usable; other valid rows continue. A failed bulk flush is a batch failure, not a row error for every buffered row.","items":{"type":"array","items":{"oneOf":[{"type":"integer"},{"type":"string"}]}}},"import_warnings":{"type":"array","description":"Bounded samples as `[line_number, message, reason]`. All warning messages for a row are combined; the first channel/parser reason remains primary. Consent reasons include `conflicting_consent`, `invalid_opt_in_date` and `email_consent_skipped`. Existing single-cause reasons are unchanged.","items":{"type":"array","items":{"oneOf":[{"type":"integer"},{"type":"string"}]}}},"columns":{"type":"object","additionalProperties":true,"nullable":true},"options":{"type":"object","additionalProperties":true,"nullable":true},"assigned_list_ids":{"type":"array","items":{"type":"integer"}},"assigned_lists":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}}},"guardrail":{"$ref":"#/components/schemas/ImportGuardrail"},"flows_not_started":{"type":["object","null"],"description":"Live flows this import's committed writes matched but did not start, because options.start_flows was off. Null when none matched.","required":["flows","message","next_step"],"properties":{"flows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}}},"message":{"type":"string"},"next_step":{"type":"string"}}},"started_at":{"type":"string","format":"date-time","nullable":true},"ended_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"Export":{"type":"object","properties":{"id":{"type":"integer"},"resource":{"type":"string","enum":["contacts","leads"]},"format":{"type":"string","enum":["csv"]},"status":{"type":"string","enum":["pending","processing","complete","failed"]},"total_rows":{"type":"integer","nullable":true},"rows_written":{"type":"integer","description":"Rows written so far; the live numerator against total_rows."},"error_message":{"type":"string","nullable":true},"ready":{"type":"boolean","description":"True once the export is complete and the file is available."},"download_path":{"type":"string","nullable":true,"description":"Path to download the CSV; present only when `ready` is true."},"progress":{"type":"object","description":"Live job-progress block, updated as the export streams. `status`\nnormalizes the job lifecycle, `pct` is the completion percentage\n(null while the row count is still unknown), and `stages` is the\nordered Queued to Building to Ready funnel.\n","properties":{"status":{"type":"string","enum":["pending","running","complete","failed"]},"pct":{"type":"number","nullable":true,"description":"Completion percentage, or null when indeterminate."},"stages":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"count":{"type":"integer","nullable":true},"state":{"type":"string","enum":["done","active","pending","failed"]}}}}}},"started_at":{"type":"string","format":"date-time","nullable":true},"ended_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"SavedView":{"type":"object","properties":{"id":{"type":"integer"},"surface":{"type":"string","enum":["contacts","sending","activity"]},"name":{"type":"string"},"visibility":{"type":"string","enum":["private","shared"]},"filters":{"$ref":"#/components/schemas/SegmentFilterExpression"},"layout":{"$ref":"#/components/schemas/SavedViewLayout","nullable":true},"owner":{"type":"boolean","description":"True when the current user is the creator of this view"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"SavedViewLayout":{"type":"object","nullable":true,"description":"Table layout preset for contacts surface views. Only present when\nsurface = contacts.\n","properties":{"columns":{"type":"array","items":{"type":"string"},"description":"Ordered list of column keys to display"},"sort":{"type":"object","properties":{"field":{"type":"string","description":"Column key to sort by"},"dir":{"type":"string","enum":["asc","desc"],"description":"Sort direction"}}}}},"Segment":{"type":"object","properties":{"id":{"type":"integer"},"account_id":{"type":"integer"},"brand_id":{"type":"integer","nullable":true},"name":{"type":"string"},"description":{"type":["string","null"],"description":"A one-line description of a system segment's rules, for showing under its\nname, e.g. \"Rated engaged (opened or clicked within 14 days), with 10+\nunique opens\". Day windows follow the account's engagement rating\nthresholds. Null for user segments.\n"},"origin":{"type":"string","enum":["user","system"],"description":"Who owns this segment. `user` (default) — created and managed by the user;\n`system` — curated by the platform (Champions, Loyal, At-Risk, Dormant, New,\nSuppressed, Recently unsubscribed, Bounced).\nSystem segments cannot be renamed or deleted via the API.\n"},"filters":{"$ref":"#/components/schemas/SegmentFilterExpression"},"cached_count":{"type":"integer","nullable":true,"description":"Last asynchronously refreshed contact count for this segment."},"count_computed_at":{"type":"string","format":"date-time","nullable":true,"description":"When `cached_count` was last refreshed."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"SegmentFilterExpression":{"oneOf":[{"$ref":"#/components/schemas/SegmentFilters"},{"$ref":"#/components/schemas/FlatAndSegmentFilterExpression"},{"$ref":"#/components/schemas/BooleanSegmentFilterGroup"}],"description":"Request-side audience filter grammar. Use a flat array for ordinary\nAND filters, `{ \"operator\": \"and\", \"children\": [...] }` for the legacy\nexpression wrapper, or `{ \"op\": \"and\"|\"or\"|\"not\", \"conditions\": [...] }`\nfor nested boolean logic. NOT groups must contain exactly one condition.\n"},"FlatAndSegmentFilterExpression":{"type":"object","required":["operator","children"],"additionalProperties":false,"properties":{"operator":{"type":"string","enum":["and"]},"not":{"type":"boolean","enum":[false],"default":false,"description":"Legacy flat-AND wrapper does not carry NOT; use BooleanSegmentFilterGroup for NOT."},"children":{"$ref":"#/components/schemas/SegmentFilters"}}},"SegmentFilterNode":{"oneOf":[{"$ref":"#/components/schemas/AttributeSegmentFilter"},{"$ref":"#/components/schemas/EventSegmentFilter"},{"$ref":"#/components/schemas/BooleanSegmentFilterGroup"}]},"BooleanSegmentFilterGroup":{"type":"object","required":["op","conditions"],"additionalProperties":false,"properties":{"op":{"type":"string","enum":["and","or","not"]},"conditions":{"type":"array","maxItems":25,"items":{"$ref":"#/components/schemas/SegmentFilterNode"},"description":"Nested filter nodes. NOT groups must contain exactly one condition."}}},"SegmentFilters":{"type":"array","description":"Segment filters are validated fail-closed. Unknown filter names,\nglobally invalid predicates, type-incompatible predicates, bad date\nvalues, invalid enum values, and unsupported rolling-window filters\nreturn a 422 `invalid_filter` error instead of silently widening an\naudience.\n","items":{"oneOf":[{"$ref":"#/components/schemas/AttributeSegmentFilter"},{"$ref":"#/components/schemas/EventSegmentFilter"}]}},"SegmentPreview":{"type":"object","properties":{"count":{"type":"integer","description":"Live count of contacts matching the supplied filters."},"sample":{"type":"array","description":"Bounded contact sample for quick verification.","items":{"type":"object","properties":{"id":{"type":"integer"},"email":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}}},"overlap":{"type":"array","description":"Bounded overlap with existing segments.","items":{"type":"object","properties":{"segment_id":{"type":"integer"},"name":{"type":"string"},"overlap_count":{"type":"integer"}}}}}},"AttributeSegmentFilter":{"type":"object","required":["name","predicate","value"],"properties":{"name":{"type":"string","description":"Filter name from `nitro://schema`: contact_first_name, contact_last_name,\ncontact_phone_number, contact_email, contact_country,\ncontact_subscribed_phone, contact_subscribed_email,\ncontact_created_at, contact_last_interacted_at,\ncontact_source, contact_tag,\ncontact_engagement_rating, contact_emails_sent, contact_last_opened_at,\ncontact_last_clicked_at, contact_unique_opens, contact_clicks,\ncontact_open_rate, contact_click_rate, contact_suppressed,\ncontact_suppression_reason, contact_bounced, contact_complained,\ncontact_soft_bounce_count, contact_unsubscribed_at, contact_list.\nCataloged custom and\nenrichment fields are exposed as contact_data_\u003cpath\u003e, with dots\nreplaced by underscores (for example, data.attio.lifecycle_stage\nbecomes contact_data_attio_lifecycle_stage).\n"},"predicate":{"type":"string","description":"Ransack predicate: eq, not_eq, cont, not_cont, start, end,\ngt, lt, gteq, lteq, present, blank, true, false, in, not_in,\nwithin_days, not_within_days. Read `/v1/my/flows/spec` or\n`nitro://schema` for the predicates allowed by each filter type.\n"},"value":{"description":"Filter value — string, number, boolean, array of strings for\nin/not_in predicates (e.g. [\"engaged\",\"warm\"] for\ncontact_engagement_rating in), or array of list ids for contact_list.\n"}}},"EventSegmentFilter":{"type":"object","required":["type","event","predicate"],"oneOf":[{"required":["type","event","predicate"],"properties":{"predicate":{"type":"string","enum":["performed","not_performed"]}}},{"required":["type","event","predicate","value"],"properties":{"predicate":{"type":"string","enum":["count_at_least","count_at_most"]}}}],"not":{"required":["within_days","since"]},"properties":{"type":{"type":"string","enum":["event"]},"event":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$","description":"Custom or known event name, e.g. first_send, project_created, checkout."},"predicate":{"type":"string","enum":["performed","not_performed","count_at_least","count_at_most"]},"value":{"type":"integer","minimum":1,"description":"Required for count_at_least and count_at_most."},"within_days":{"type":"integer","minimum":1,"description":"Optional rolling event recency window."},"since":{"type":"string","format":"date-time","description":"Optional absolute event recency cutoff."}}},"Campaign":{"type":"object","properties":{"id":{"type":"integer"},"account_id":{"type":"integer"},"brand_id":{"type":"integer","nullable":true},"status":{"type":"string","enum":["draft","active","paused","completed"]},"approval_state":{"type":"string"},"draft_revision_id":{"type":"integer","nullable":true},"draft_revision_digest":{"type":"string","nullable":true},"draft_approval_state":{"type":"string","enum":["pending_review","approved","rejected"],"nullable":true},"active_revision_id":{"type":"integer","nullable":true},"active_revision_digest":{"type":"string","nullable":true},"has_unpublished_changes":{"type":"boolean"},"channel":{"type":"string","enum":["email","sms"]},"name":{"type":"string"},"data":{"type":"object","additionalProperties":true},"scheduled_at":{"type":"string","format":"date-time","nullable":true},"sent_count":{"type":"integer"},"dashboard_url":{"type":"string","format":"uri","nullable":true,"description":"Canonical dashboard URL with the /my route prefix."},"preview_url":{"type":"string","format":"uri","nullable":true,"description":"Signed, expiring public preview URL for the current template version."},"recipient_snapshot":{"type":"object","nullable":true,"description":"Last send snapshot. Values are captured at send time and are not a live audience estimate.","properties":{"requested_recipients":{"type":"integer","nullable":true},"dispatched_recipients":{"type":"integer","nullable":true},"blocked_recipients":{"type":"integer","nullable":true},"requested_send_units":{"type":"integer","nullable":true},"dispatched_send_units":{"type":"integer","nullable":true},"units_per_recipient":{"type":"integer","nullable":true},"send_token":{"type":"string","nullable":true},"started_at":{"type":"string","format":"date-time","nullable":true},"completed_at":{"type":"string","format":"date-time","nullable":true}}},"last_send_recipients":{"type":"integer","nullable":true,"description":"Alias for the last dispatched recipient snapshot stored in data.recipients."},"delivery":{"oneOf":[{"$ref":"#/components/schemas/CampaignDeliverySummary"},{"type":"null"}],"description":"Present while a campaign has a current send token; use `/delivery` to poll, refresh progress, and receive polling metadata."},"engagement":{"$ref":"#/components/schemas/Engagement"},"revenue":{"$ref":"#/components/schemas/RevenueReport"},"editable":{"type":"boolean","readOnly":true,"description":"True when the campaign's content/audience/template can be edited.\nFalse for live, paused, completed, cancelled, archived, and for\nscheduled campaigns within 5 minutes of their scheduled_at. When\nfalse, PUT update accepts only name-only payloads and status\ntransitions (Resume / Cancel); anything else returns 422\n`campaign_locked`. Use POST /duplicate to fork into a new draft.\n"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"trigger":{"$ref":"#/components/schemas/FlowTrigger"},"template":{"oneOf":[{"$ref":"#/components/schemas/Template"},{"type":"null"}]},"templates":{"type":"array","items":{"$ref":"#/components/schemas/Template"}},"experiment":{"$ref":"#/components/schemas/CampaignExperiment"}}},"CampaignDeliverySummary":{"type":"object","required":["campaign_send_token","status","recipients","sent","failed","pending"],"properties":{"capacity_recovery":{"$ref":"#/components/schemas/DeliveryCapacityRecovery"},"campaign_send_token":{"type":"string","nullable":true},"status":{"type":"string","enum":["not_started","awaiting_approval","sending","paused","completed","failed","cancelled"]},"recipients":{"type":"integer","description":"Recipient count captured for the active send."},"sent":{"type":"integer"},"failed":{"type":"integer"},"pending":{"type":"integer"}}},"CampaignDeliveryProgress":{"type":"object","required":["campaign_send_token","status","recipients","sent","failed","pending","terminal","poll_after_seconds"],"properties":{"experiment":{"$ref":"#/components/schemas/CampaignExperiment"},"capacity_recovery":{"$ref":"#/components/schemas/DeliveryCapacityRecovery"},"stop_reason":{"type":"string","nullable":true,"description":"Why a stopped send stopped, such as email_under_review for one held by the safety check."},"safety_review":{"type":"object","nullable":true,"description":"For a send the safety check held, blocked or couldn't read: what the account may be told (the reason and fix as a person reads them), the fix to paste to an agent, and what it is offered.\n","properties":{"how_to_fix":{"type":"string"},"category":{"type":"string"},"agent_prompt":{"type":"string"},"recovery_actions":{"type":"array","items":{"$ref":"#/components/schemas/SafetyRecoveryAction"}},"details":{"type":"object","description":"For a send it couldn't read, the images and other changes (as SendRefusalDetail details)."}}},"campaign_send_token":{"type":"string","nullable":true},"status":{"type":"string","enum":["not_started","awaiting_approval","sending","paused","completed","failed","cancelled"]},"recipients":{"type":"integer","description":"Recipient count captured for the active send."},"sent":{"type":"integer"},"failed":{"type":"integer"},"pending":{"type":"integer"},"terminal":{"type":"boolean","description":"True when clients can stop polling."},"poll_after_seconds":{"type":"integer","nullable":true,"description":"Suggested polling delay for active sends."}}},"MailActionDescription":{"type":"object","additionalProperties":false,"description":"A Mail Action Protocol 0.3 description. The canonical MailSchema core schema is authoritative; this schema restates its shape.\n","required":["@context","@type","@id","profile","type","issuedAt","expiresAt","inLanguage","service","recipient","subject","terms","details","operations","human"],"properties":{"@context":{"type":"string","enum":["https://mailschema.org/contexts/map-0.3.jsonld"]},"@type":{"type":"string","enum":["MailAction"]},"@id":{"type":"string","format":"uri","description":"Identifies the interaction."},"profile":{"type":"string","enum":["https://mailschema.org/profiles/map/0.3"]},"type":{"type":"object","additionalProperties":false,"required":["id","version","contractDigest"],"properties":{"id":{"type":"string","format":"uri"},"version":{"type":"string"},"contractDigest":{"type":"string","pattern":"^sha-256:[0-9a-f]{64}$"}}},"issuedAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"inLanguage":{"type":"string"},"service":{"type":"object","additionalProperties":false,"required":["id"],"properties":{"id":{"type":"string","format":"uri","description":"The service's HTTPS origin."},"tenant":{"type":"string","format":"uri"}}},"recipient":{"type":"string","format":"email"},"subject":{"type":"object","additionalProperties":false,"required":["id","title"],"properties":{"id":{"type":"string","format":"uri"},"title":{"type":"string"}}},"terms":{"type":"object","additionalProperties":false,"required":["id","version"],"properties":{"id":{"type":"string","format":"uri"},"version":{"type":"string","description":"Opaque; a decision names it exactly."}}},"details":{"type":"object","additionalProperties":true,"description":"Defined by the type contract's details schema."},"operations":{"type":"array","minItems":1,"maxItems":32,"items":{"type":"object","required":["id"],"properties":{"id":{"type":"string"},"capability":{"type":"object"}}}},"human":{"type":"object","additionalProperties":false,"required":["url"],"properties":{"url":{"type":"string","format":"uri"}}}}},"SendApproval":{"type":"object","additionalProperties":false,"required":["id","campaign_id","state","can_decide","delivery_status","content","mail_action"],"properties":{"id":{"type":"integer"},"campaign_id":{"type":"integer"},"can_decide":{"type":"boolean","description":"Whether the signed-in person may decide it, as the account owner or a direct account admin."},"state":{"type":"string","enum":["pending","approved","declined","expired","withdrawn"],"description":"`withdrawn` means the send stopped before anyone decided. After approval, `delivery_status` tells a send in progress from a finished one.\n"},"decided_at":{"type":"string","format":"date-time"},"delivery_status":{"type":"string","enum":["pending","in_progress","completed","failed","cancelled"]},"content":{"type":"object","additionalProperties":false,"required":["subject","html"],"properties":{"subject":{"type":"string"},"preheader":{"type":"string"},"html":{"type":"string","description":"The exact email the approval sends."}}},"bcc":{"type":"string","description":"The address that gets a copy of every email in this send. Each copy consumes an email credit and sending capacity."},"mail_action":{"$ref":"#/components/schemas/MailActionDescription","description":"The Campaign Send Approval 0.1 description of this send's exact terms."}}},"MessageSendResult":{"allOf":[{"$ref":"#/components/schemas/Message"},{"type":"object","required":["ignored_fields"],"properties":{"ignored_fields":{"type":"array","items":{"type":"string"},"description":"Top-level request fields Nitrosend doesn't support, sorted. They were ignored; empty when there were none.\n"}}}]},"TestSendResult":{"type":"object","required":["sent","results"],"properties":{"outcome":{"type":"string","enum":["sent","partial","pending","held","failed","dry_run","delivered"],"description":"Dispatch outcome. New accepted sends return sent. Legacy saved results may use delivered; neither confirms inbox placement."},"sent":{"type":"integer","description":"Number of tests accepted by the sending provider."},"pending":{"type":"integer"},"held":{"type":"integer","description":"Tests awaiting content review; not sent and not automatically replayed after approval."},"failed":{"type":"integer"},"dry_run":{"type":"boolean"},"results":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"success":{"type":"boolean","description":"The sending provider accepted this test; recipient delivery is separate."},"status":{"type":"string","enum":["sent","delivered","pending","held","failed"],"description":"held awaits content review and was not sent; delivered is the legacy acceptance label."},"code":{"type":"string"},"message":{"type":"string","description":"Human-readable dispatch or provider-feedback detail."},"error":{"type":"string","description":"Why this recipient's test was not sent."},"hold_id":{"type":"integer","description":"Exact content review case for this test."},"plan_url":{"type":"string","format":"uri","description":"Where to choose a plan. Present when code is test_send_cap_reached: a Setup mode account has used its 20 test recipients for the rolling 24 hours."},"how_to_fix":{"type":"string","description":"Explicit recovery guidance; approval alone does not send a test."},"agent_prompt":{"type":"string","description":"The reason and fix to paste to an agent","when the account may be told them.":null},"recovery_actions":{"type":"array","items":{"$ref":"#/components/schemas/SafetyRecoveryAction"}},"details":{"type":"object","description":"For a test the safety check couldn't read, each image that failed and the other changes to make.","properties":{"images":{"type":"array","items":{"type":"object"}},"changes":{"type":"array","items":{"type":"object"}}}},"message_id":{"type":"integer"},"provider_id":{"type":"string"}}}}}},"Message":{"type":"object","properties":{"id":{"type":"integer"},"channel":{"type":"string","enum":["email","sms"]},"to":{"type":"string"},"recipients":{"type":"object","description":"Full normalized email envelope, visible only to authorized account readers. Returned for email messages.","properties":{"to":{"type":"array","items":{"type":"string","format":"email"}},"cc":{"type":"array","items":{"type":"string","format":"email"}},"bcc":{"type":"array","items":{"type":"string","format":"email"}}}},"subject":{"type":"string","nullable":true},"status":{"type":"string","enum":["queued","sent","failed"]},"provider_id":{"type":"string","nullable":true},"rfc_message_id":{"type":"string","nullable":true,"description":"Actual email Message-ID recorded after provider acceptance; null until available. Use it for In-Reply-To and References, without deriving it from provider_id."},"flow_id":{"type":"integer","nullable":true,"description":"Source flow ID (null for transactional)"},"source_type":{"type":"string","nullable":true,"enum":["campaign","flow","test"],"description":"campaign, flow, test, or null (transactional)"},"source_name":{"type":"string","nullable":true,"description":"Name of source campaign or flow"},"status_reason_code":{"type":"string","nullable":true,"description":"Stable reason for a queued or failed dispatch, or the provider feedback on a sent email test."},"status_reason":{"type":"string","nullable":true,"description":"Human-readable dispatch or email-test delivery explanation. Recipient-server acceptance does not confirm inbox placement."},"status_reason_category":{"type":"string","nullable":true,"enum":["content_review","account","internal","recipient","provider","rate_limit","delivery"],"description":"Broad category for status_reason."},"admission_retry_at":{"type":"string","format":"date-time","nullable":true,"description":"Next automatic attempt to finish admission for a message queued for a content check."},"failure_how_to_fix":{"type":"string","nullable":true,"description":"Available remediation for email refused during asynchronous admission."},"failure_code":{"type":"string","nullable":true,"description":"Stable machine-readable failure reason; present only when status is failed."},"failure_reason":{"type":"string","nullable":true,"description":"Human-readable failure explanation; present only when status is failed."},"failure_category":{"type":"string","nullable":true,"enum":["content_review","account","internal","recipient","provider","delivery"],"description":"Broad category for failure_reason; present only when status is failed."},"sent_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"Suppression":{"type":"object","description":"Account suppression row with bounded source-event diagnostics.","properties":{"id":{"type":"integer"},"email":{"type":"string","format":"email"},"reason":{"type":"string","enum":["hard_bounce","soft_bounce","complaint","manual","admin","unsubscribe","verification","marketing_withheld","unconfirmed"]},"scope":{"type":"string","enum":["account_scoped","brand_scoped"]},"brand_id":{"type":"integer","nullable":true,"description":"Brand affected by a brand-specific stop."},"active":{"type":"boolean"},"contact_id":{"type":"integer","nullable":true},"source_provider":{"type":"string","nullable":true},"source_event_id":{"type":"string","nullable":true},"provider_diagnostic":{"type":"string","nullable":true,"description":"Bounded diagnostic text extracted from the provider feedback event, when retained."},"bounce_type":{"type":"string","nullable":true,"enum":["hard","soft"]},"bounce_subtype":{"type":"string","nullable":true},"complaint_feedback_type":{"type":"string","nullable":true},"event_occurred_at":{"type":"string","format":"date-time","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"WebhookEventType":{"type":"string","enum":["email.sent","email.delivered","email.bounced","email.complained","email.opened","email.clicked","email.failed","email.received","campaign.completed","campaign.failed","campaign.stopped","flow.paused","sending.paused","sending.limit_approaching","sending.limit_reached","import.completed","import.failed","domain.verified","domain.verification_lost","domain.dns_degraded","webhook.disabled"]},"Webhook":{"type":"object","properties":{"id":{"type":"integer"},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEventType"}},"enabled":{"type":"boolean"},"status":{"type":"string","enum":["active","failing","disabled"],"description":"`failing` while deliveries fail; an endpoint failing for 3 days is turned off."},"failing_since":{"type":"string","format":"date-time","nullable":true},"secret":{"type":"string","description":"Standard Webhooks signing secret (`whsec_...`). Masked unless revealed."},"last_delivery":{"type":"object","nullable":true,"properties":{"id":{"type":"integer"},"event_type":{"$ref":"#/components/schemas/WebhookEventType"},"status":{"type":"string","enum":["pending","delivered","failed"]},"attempts":{"type":"integer"},"last_response_status":{"type":"integer","nullable":true},"updated_at":{"type":"string","format":"date-time"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"WebhookWriteRequest":{"type":"object","properties":{"url":{"type":"string","format":"uri","maxLength":2048,"description":"HTTPS URL that resolves only to public addresses, without credentials."},"events":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/WebhookEventType"}},"enabled":{"type":"boolean"}}},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"integer"},"event_id":{"type":"string","format":"uuid","description":"Sent as `webhook-id` (`evt_\u003cevent_id\u003e`), stable across retries."},"event_type":{"$ref":"#/components/schemas/WebhookEventType"},"status":{"type":"string","enum":["pending","delivered","failed"]},"attempts":{"type":"integer"},"last_response_status":{"type":"integer","nullable":true},"last_error":{"type":"string","nullable":true},"next_attempt_at":{"type":"string","format":"date-time"},"payload":{"$ref":"#/components/schemas/WebhookEventPayload"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"WebhookEventPayload":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"$ref":"#/components/schemas/WebhookEventType"},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"message_id":{"type":"integer","nullable":true,"description":"The id `POST /v1/my/messages` returned. Null on test events."},"to":{"type":"string"},"subject":{"type":"string","nullable":true},"idempotency_key":{"type":"string","nullable":true,"description":"The caller's Idempotency-Key, when one was sent."},"tags":{"type":"object","additionalProperties":{"type":"string"},"description":"The caller's delivery-option tags."},"thread_id":{"type":"string","nullable":true,"description":"The email's thread, `m` and the id of its first message, as `GET /v1/my/messages/lookup` reports it. Null on test events."},"rfc_message_id":{"type":"string","nullable":true,"description":"The email's Message-ID, in angle brackets; null until it is sent."},"test":{"type":"boolean","description":"Present and true on test events."},"sent_at":{"type":"string","format":"date-time","description":"email.sent"},"bounce":{"type":"object","description":"email.bounced","properties":{"type":{"type":"string","enum":["hard","soft"]},"subtype":{"type":"string","nullable":true,"description":"The provider's bounce subtype, e.g. NoEmail or MailboxFull."}}},"complaint":{"type":"object","description":"email.complained","properties":{"feedback_type":{"type":"string","nullable":true,"description":"e.g. abuse"}}},"url":{"type":"string","description":"email.clicked"},"failure":{"type":"object","description":"email.failed","properties":{"code":{"type":"string"},"reason":{"type":"string"},"category":{"type":"string"}}}}}}},"WebhookReceivedEventPayload":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"type":"string","enum":["email.received"]},"timestamp":{"type":"string","format":"date-time","description":"When the message arrived."},"data":{"type":"object","properties":{"message_id":{"type":"integer","nullable":true,"description":"The send this message answers, as `POST /v1/my/messages` returned it. Null when it answers none, and on test events."},"idempotency_key":{"type":"string","nullable":true,"description":"The answered send's Idempotency-Key, when the caller sent one."},"tags":{"type":"object","additionalProperties":{"type":"string"},"description":"The answered send's delivery-option tags; empty when it answers none."},"from":{"type":"string"},"to":{"type":"string","description":"The inbox address it was sent to."},"subject":{"type":"string","nullable":true},"text":{"type":"string","nullable":true,"description":"Plain-text body","at most 64 KiB.":null},"html":{"type":"string","nullable":true,"description":"HTML body","at most 64 KiB.":null},"truncated":{"type":"boolean","description":"True when either body was cut to 64 KiB."},"auto_submitted":{"type":"boolean","description":"True for automatic replies such as out-of-office notices."},"attachments":{"type":"array","description":"Every file the message carried, in order, including files that are not available. Empty when it carried none.","items":{"type":"object","properties":{"id":{"type":"integer"},"filename":{"type":"string"},"content_type":{"type":"string"},"size":{"type":"integer","description":"Bytes."},"scanned":{"type":"boolean","description":"True only when a virus scan found the file clean. Use `downloadable` to decide whether it can be fetched."},"scan_status":{"type":"string","enum":["pending","clean","infected","failed","not_scanned"],"description":"The file's scan verdict, as the conversations API reports it."},"downloadable":{"type":"boolean","description":"True when the conversations API will serve the file."},"download_requires_confirmation":{"type":"boolean","description":"True for a file no scan covered: fetch it with `acknowledge_unscanned=true`."},"availability_reason":{"type":"string","description":"Present only when `downloadable` is false. Why the file is unavailable: `unsafe` (a threat was found), `too_large` (over the per-file limit), `message_limit` (over the per-message size limit), `storage_failed`, `storage_limit`, `invalid`, `scan_failed` or `scanning`. Treat any other value as unavailable too."}}}},"attachments_omitted":{"type":"integer","minimum":1,"description":"How many more files the message carried than `attachments` lists. Files past the per-message attachment limit (50) are not kept. Absent when every file is listed."},"conversation_id":{"type":"integer","nullable":true,"description":"For `GET /v1/my/conversations/{id}`. Null on test events."},"conversation_message_id":{"type":"integer","nullable":true,"description":"Null on test events."},"thread_id":{"type":"string","nullable":true,"description":"The thread of the send it answers, as `GET /v1/my/messages/lookup` reports it. Null when it answers none."},"rfc_message_id":{"type":"string","nullable":true,"description":"Its own Message-ID, in angle brackets."},"test":{"type":"boolean","description":"Present and true on test events."}}}}},"CampaignCompletedWebhookData":{"type":"object","required":["campaign_id","campaign_name","campaign_send_id","recipients","completed_at"],"properties":{"campaign_id":{"type":"integer"},"campaign_name":{"type":"string","nullable":true},"campaign_send_id":{"type":"integer","nullable":true},"recipients":{"type":"integer","nullable":true,"description":"Recipients the send planned."},"completed_at":{"type":"string","format":"date-time","nullable":true}}},"CampaignFailedWebhookData":{"type":"object","required":["campaign_id","campaign_name","campaign_send_id","requested_recipients","sent_count","failure_reason","next_action"],"properties":{"campaign_id":{"type":"integer"},"campaign_name":{"type":"string","nullable":true},"campaign_send_id":{"type":"integer","nullable":true},"requested_recipients":{"type":"integer","nullable":true},"sent_count":{"type":"integer","nullable":true},"failure_reason":{"type":"string","description":"A public reason code, e.g. campaign_delivery_failed."},"next_action":{"type":"string","description":"What to do before sending again."}}},"CampaignStoppedWebhookData":{"type":"object","required":["campaign_id","campaign_name","metric","rate","threshold","total_sends","hard_bounces","complaints","next_action"],"properties":{"campaign_id":{"type":"integer"},"campaign_name":{"type":"string","nullable":true},"metric":{"type":"string","nullable":true,"description":"Bounce rate or Complaint rate."},"rate":{"type":"number","nullable":true,"description":"The measured rate in percent."},"threshold":{"type":"number","nullable":true,"description":"The stop threshold in percent."},"total_sends":{"type":"integer","nullable":true},"hard_bounces":{"type":"integer","nullable":true},"complaints":{"type":"integer","nullable":true},"next_action":{"type":"string","nullable":true}}},"FlowPausedWebhookData":{"type":"object","required":["flow_id","flow_name","metric","rate","threshold"],"properties":{"flow_id":{"type":"integer"},"flow_name":{"type":"string","nullable":true},"metric":{"type":"string","nullable":true,"description":"Bounce rate or Complaint rate."},"rate":{"type":"number","nullable":true,"description":"The measured rate in percent."},"threshold":{"type":"number","nullable":true,"description":"The pause threshold in percent."}}},"SendingPausedWebhookData":{"type":"object","required":["reason","sending_paused","occurred_at"],"properties":{"reason":{"type":"string","nullable":true,"description":"Why, e.g. critical_bounce_rate. Null when the pause is not explained."},"sending_paused":{"type":"boolean"},"occurred_at":{"type":"string","format":"date-time","nullable":true}}},"SendingLimitWebhookData":{"type":"object","required":["state","label","detail","usage_percent","capacity","retry_at","upgrade_url"],"properties":{"state":{"type":"string","enum":["approaching","reached"]},"label":{"type":"string"},"detail":{"type":"string"},"usage_percent":{"type":"integer","description":"Share of the allowance used."},"capacity":{"type":"object","required":["limit","remaining","window_seconds"],"properties":{"limit":{"type":"integer","description":"Sends allowed per window."},"remaining":{"type":"integer"},"window_seconds":{"type":"integer","description":"The rolling window","86400.0":null}}},"retry_at":{"type":"string","format":"date-time","nullable":true,"description":"When capacity frees up","once reached.":null},"upgrade_url":{"type":"string","nullable":true,"description":"Where an owner on the free plan can upgrade."}}},"ImportCompletedWebhookData":{"type":"object","required":["resource","import_id","list_name","success_rows","failed_rows","total_rows"],"properties":{"resource":{"type":"string","nullable":true,"enum":["contacts","leads",null]},"import_id":{"type":"integer"},"list_name":{"type":"string","nullable":true},"success_rows":{"type":"integer","nullable":true},"failed_rows":{"type":"integer","nullable":true},"total_rows":{"type":"integer","nullable":true}}},"ImportFailedWebhookData":{"type":"object","required":["import_id","reason","failed_rows"],"properties":{"import_id":{"type":"integer","nullable":true},"reason":{"type":"string","nullable":true},"failed_rows":{"type":"integer","nullable":true}}},"DomainVerifiedWebhookData":{"type":"object","required":["domain_id","domain"],"properties":{"domain_id":{"type":"integer"},"domain":{"type":"string"}}},"DomainVerificationLostWebhookData":{"type":"object","required":["domain_id","domain","failing"],"properties":{"domain_id":{"type":"integer"},"domain":{"type":"string"},"failing":{"type":"array","items":{"type":"string"},"description":"The DNS record families that failed, e.g. dkim."}}},"DomainDnsDegradedWebhookData":{"type":"object","required":["domain_id","domain","failing","classification","action"],"properties":{"domain_id":{"type":"integer","nullable":true},"domain":{"type":"string"},"failing":{"type":"array","items":{"type":"string"},"description":"The DNS record families that failed, e.g. dkim."},"classification":{"type":"string","nullable":true},"action":{"type":"string","nullable":true}}},"WebhookDisabledWebhookData":{"type":"object","required":["webhook_id","url","failing_since"],"properties":{"webhook_id":{"type":"integer"},"url":{"type":"string","description":"The endpoint URL without credentials or query."},"failing_since":{"type":"string","format":"date-time","nullable":true}}},"ChatMessage":{"type":"object","properties":{"id":{"type":"integer"},"role":{"type":"string","enum":["user","assistant","tool","system"]},"content":{"type":"string","description":"Credential-shaped values are redacted before display."},"tool_calls":{"type":"array","description":"Usually in the order NitroLLM proposed them. Older messages, or a turn interrupted mid-save, may list calls out of order.","items":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string"},"name":{"type":"string"},"input":{"type":"object","additionalProperties":true},"safe":{"type":"boolean"},"status":{"type":"string","enum":["pending","approved","executing","completed","rejected","error","cancelled","uncertain"]},"approval_token":{"type":"string","description":"Binds a proposal to its execution and exact arguments. Commands also require the originating authenticated user."},"preview":{"type":"object","description":"What a proposed Brand Kit save (nitro_set_brand_kit) changes, for its approval card.","properties":{"changes":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string","description":"How to show the value, such as color, font, number, string, logo or document."},"from":{"description":"The current value, or null."},"to":{"description":"The proposed value."},"source":{"type":"string","enum":["scan","message","file","suggested"],"description":"Where the proposed value came from: a website scan, the person's message, a file or image they attached, or NitroLLM's suggestion."},"source_host":{"type":"string","description":"For scan: the scanned site's host."},"source_name":{"type":"string","description":"For file: the attached file's or image's name."}}}}}},"result":{"description":"Recorded tool outcome; queued does not mean sent."}}}},"actions":{"type":"array","description":"Buttons shown under the reply.","items":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["link","chat_action","action"],"description":"link opens route or href; chat_action sends message as the person's next message; action asks the app to act on key."},"label":{"type":"string"},"icon":{"type":"string"},"route":{"type":"object","additionalProperties":true,"description":"For link: the app route (name and params)."},"href":{"type":"string","description":"For link: an absolute URL or app path instead of a route."},"message":{"type":"string","description":"For chat_action."},"key":{"type":"string","enum":["upgrade","connect_agent"],"description":"For action: upgrade opens the plan picker; connect_agent opens the guide to connect, or open, the person's own agent. Sent on a Free account's reply when it has no AI actions left."}}}},"attachments":{"type":"array","description":"Images (from the brand's image library) and files the person added to the message.","items":{"type":"object","properties":{"kind":{"type":"string","enum":["image","file"]},"id":{"type":"string","description":"A file's reference (src_...). Files only."},"url":{"type":"string","format":"uri","description":"The image's library URL. Images only."},"filename":{"type":"string"},"content_type":{"type":"string","enum":["image/png","image/jpeg","image/webp","application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","text/markdown"]},"byte_size":{"type":"integer"},"width":{"type":"integer","nullable":true,"description":"Images only."},"height":{"type":"integer","nullable":true,"description":"Images only."}}}},"sequence":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}},"ChatSession":{"type":"object","properties":{"id":{"type":"integer"},"account_id":{"type":"integer"},"brand_id":{"type":"integer"},"title":{"type":"string"},"status":{"type":"string","enum":["active","closed","failed"]},"started_at":{"type":"string","format":"date-time"},"last_message_at":{"type":"string","format":"date-time"},"message_count":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ChatSessionDetail":{"allOf":[{"$ref":"#/components/schemas/ChatSession"},{"type":"object","properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/ChatMessage"}}}}]},"EmailContentFormat":{"type":"string","enum":["designed","plain","html"],"description":"Durable email presentation. New templates default to designed; omitted\nedits preserve the stored value. A supplied value must equal the stored\nformat for edits or the authorized selected source format for copies;\nnewly authored Flow content can select designed or plain. AI composition\nretains its own authorized source-format contract. Null, invalid and\nmismatched edits fail validation.\nPlain uses body as author text and generates a minimal HTML part. HTML\nstores the complete source in design.html and derives text by default.\nBoth formats use the existing merge, tracking and compliance behavior.\nOnly email templates support plain and html.\n"},"Template":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","nullable":true},"flow_id":{"type":"integer","nullable":true},"action_id":{"type":"integer","nullable":true},"version":{"type":"integer"},"subject":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"content_format":{"$ref":"#/components/schemas/EmailContentFormat"},"plain_text_mode":{"type":"string","enum":["derived","custom"]},"block_usage":{"type":"object","description":"Library templates only (flow_id null), which can be linked as blocks. What editing this template changes in the emails linking it.","properties":{"emails":{"type":"integer","description":"Emails linking it."},"publishes":{"type":"integer","description":"Emails in live or paused flows that publish the edit."},"drafts":{"type":"integer","description":"Emails in flows that get the edit in a draft for a person to publish (a change waiting to be published","or an A/B split).":null},"unchanged":{"type":"integer","description":"Emails that keep their content (campaigns no longer unapproved drafts","and archived or cancelled flows).":null}}},"preheader":{"type":"string","nullable":true},"from_name":{"type":"string","nullable":true},"from_email":{"type":"string","nullable":true},"reply_to":{"type":"string","nullable":true},"design":{"oneOf":[{"$ref":"#/components/schemas/EmailDesign"},{"$ref":"#/components/schemas/HtmlEmailSource"},{"type":"null"}]},"variables":{"type":"object","additionalProperties":true},"generation_provenance":{"$ref":"#/components/schemas/GenerationProvenance"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"GenerationProvenance":{"type":"object","description":"Candidate-bound generation evidence. Save endpoints accept only\n`state: candidate` values returned by the generation endpoint. Resource\nresponses may return `state: accepted` as read-only history.\n","required":["state","event_id"],"properties":{"state":{"type":"string","enum":["candidate","accepted"]},"event_id":{"type":"integer"},"candidate_locator":{"type":"string"},"generated_slice_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"acceptance_id":{"type":"integer"},"saved_authored_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"edit_relation":{"type":"string","enum":["identical","edited"]}},"additionalProperties":false},"EmailLibraryTemplate":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"category":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"description":{"type":"string"},"subject":{"type":"string","description":"Suggested subject line"},"preheader":{"type":"string","description":"Suggested preheader"},"design":{"$ref":"#/components/schemas/EmailDesign"},"preview_html":{"type":"string","nullable":true},"branded_design":{"allOf":[{"$ref":"#/components/schemas/EmailDesign"}],"description":"Same layout with palette overrides stripped so brand colors apply"},"branded_preview_html":{"type":"string","nullable":true}}},"PublicEmailCatalogTemplate":{"type":"object","required":["id","name","category","tags","description","subject","preheader","design"],"properties":{"id":{"type":"string"},"revision":{"type":"string","pattern":"^[a-f0-9]{64}$","description":"Digest of the concrete public design."},"collection":{"type":"string","enum":["brand_studies"],"description":"Present for a brand concept study; originals retain their existing response shape."},"study":{"type":"object","required":["brand","concept","source_url"],"properties":{"brand":{"type":"string"},"concept":{"type":"boolean","enum":[true]},"adapted":{"type":"boolean"},"source_url":{"type":"string","format":"uri"}},"additionalProperties":false},"name":{"type":"string"},"category":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"description":{"type":"string"},"subject":{"type":"string"},"preheader":{"type":"string"},"design":{"$ref":"#/components/schemas/EmailDesign"}},"additionalProperties":false},"GuestFlowDemo":{"type":"object","required":["status"],"description":"One anonymous flow demo. The scanned brand is accepted automatically\nand shown while the flow is generated. A demo with no state on the\nserver reads as expired.\n","properties":{"status":{"type":"string","enum":["scanning","generating","ready","failed","expired"]},"revision":{"type":"integer","description":"Advances with each brand edit or generation retry. Absent when expired."},"domain":{"type":"string"},"goal":{"type":"string"},"brand":{"type":"object","additionalProperties":true,"description":"Scanned Brand Kit fields, present once the scan has completed."},"logo_url":{"type":"string","description":"Scanned logo","when one was found.":null},"flow":{"type":"object","additionalProperties":true,"description":"The generated draft for the current revision, present when ready."},"failed_stage":{"type":"string","enum":["scan","generate"],"description":"Present when failed. A failed scan cannot be retried; start again."},"message":{"type":"string","description":"Visitor copy, present when failed or expired."},"error_code":{"type":"string","enum":["flow_demo_attempts_exhausted"],"description":"Present when a generation failed on the demo's last attempt: it cannot be retried, and `message` offers an account instead."}}},"TemplateSummary":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","nullable":true},"version":{"type":"integer"},"content_format":{"$ref":"#/components/schemas/EmailContentFormat"},"preview_html":{"type":"string","nullable":true,"description":"Rendered preview, present only with ?include_previews=1"},"subject":{"type":"string","nullable":true},"preheader":{"type":"string","nullable":true},"flow_id":{"type":"integer","nullable":true},"section_count":{"type":"integer"},"section_types":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Flow":{"type":"object","properties":{"id":{"type":"integer"},"account_id":{"type":"integer"},"brand_id":{"type":"integer","nullable":true},"status":{"type":"string","enum":["draft","live","paused","archived","cancelled"]},"approval_state":{"type":"string"},"name":{"type":"string"},"goal":{"type":"string","nullable":true},"trigger":{"$ref":"#/components/schemas/FlowTriggerOutput"},"steps":{"type":"array","items":{"$ref":"#/components/schemas/FlowStepOutput"}},"reply_readiness":{"type":["object","null"],"description":"Local receiving readiness for reply-enabled flows. Null when the feature is off; never provisions or calls providers.","required":["ready","message","routes"],"properties":{"ready":{"type":"boolean"},"message":{"type":"string"},"retry_at":{"type":["string","null"],"format":"date-time"},"resume_plan":{"$ref":"#/components/schemas/FlowResumePlan"},"routes":{"type":"array","items":{"type":"object","properties":{"action_name":{"type":"string"},"address":{"type":["string","null"]},"state":{"type":"string"},"message":{"type":"string"},"inbox_id":{"type":"integer"},"sending_identity_id":{"type":"integer"},"retry_at":{"type":"string","format":"date-time"}}}}}},"sent_count":{"type":"integer"},"engagement":{"$ref":"#/components/schemas/Engagement"},"revenue":{"$ref":"#/components/schemas/RevenueReport"},"draft_revision_id":{"type":"integer","nullable":true},"draft_revision_digest":{"type":"string","nullable":true},"draft_approval_state":{"type":"string","enum":["pending_review","approved","rejected"],"nullable":true},"active_revision_id":{"type":"integer","nullable":true},"active_revision_digest":{"type":"string","nullable":true},"has_unpublished_changes":{"type":"boolean"},"unpublished_change":{"type":["object","null"],"description":"Null when what was last saved is what runs. Otherwise a live or\npaused flow's latest saved revision is not live yet. On a read of\none flow and on a save response, `blockers` says why: each check\nthat refuses to publish it, and on a save response the refusal\nthat save received (including Safe Mode for an API key, and\n`plan_required` in Setup mode, listed whatever else refuses). When\nno check explains it, a note that the change isn't live leads,\nfollowed by Safe Mode if it's on. The flow list leaves `blockers`\nout, as does a read of one flow with `include_blockers=false`; read\nthe flow for them.\n","required":["revision_id","saved_at"],"properties":{"revision_id":{"type":"integer"},"saved_at":{"type":"string","format":"date-time"},"blockers":{"type":"array","items":{"type":"object","required":["check","message"],"properties":{"check":{"type":"string"},"message":{"type":"string"},"how_to_fix":{"type":"string"},"recovery_actions":{"type":"array","items":{"$ref":"#/components/schemas/SafetyRecoveryAction"}},"agent_prompt":{"type":"string","description":"Each held email's fix to paste to an agent, joined."},"disclosures":{"type":"array","description":"Each held flow email and its case.","items":{"type":"object","properties":{"action":{"type":"string"},"review_id":{"type":"integer"},"category":{"type":"string"},"agent_prompt":{"type":"string"}}}}}}}}},"saves_publish":{"type":"boolean","description":"True when a save with `publish: true` publishes the change (a live\nor paused flow). False when a save stays a draft, as for a draft or\narchived flow.\n"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"templates":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}}},"FlowResumePlan":{"type":"object","required":["flow_id","status","open_journey_count","contact_count","waiting_journey_count","scheduled_journey_count","has_unpublished_changes","requires_choice","allowed_modes","recommended_mode"],"properties":{"flow_id":{"type":"integer"},"status":{"type":"string","enum":["draft","live","paused","archived","cancelled"]},"open_journey_count":{"type":"integer","minimum":0},"contact_count":{"type":"integer","minimum":0},"waiting_journey_count":{"type":"integer","minimum":0},"scheduled_journey_count":{"type":"integer","minimum":0},"has_unpublished_changes":{"type":"boolean"},"draft_approval_state":{"type":"string","enum":["pending_review","approved","rejected"],"nullable":true},"requires_choice":{"type":"boolean"},"allowed_modes":{"type":"array","items":{"type":"string","enum":["new_contacts_only","continue_existing"]}},"recommended_mode":{"type":"string","enum":["new_contacts_only"]}}},"FlowTemplate":{"type":"object","description":"Lean flow template card for index listings.","properties":{"id":{"type":"string","description":"Template slug (e.g. `welcome`)"},"type_label":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"icon":{"type":"string","description":"Font Awesome icon name for the template's card, without the `fa-` prefix."},"needs_list":{"type":"boolean","description":"Whether creating it takes `trigger.contact_list_id`, the brand list it starts on."},"brand_writable":{"type":"boolean","description":"Whether POST /v1/my/flows/generate can write this template for the brand."},"email_count":{"type":"integer"},"step_count":{"type":"integer"}}},"FlowTemplateDetail":{"allOf":[{"$ref":"#/components/schemas/FlowTemplate"},{"type":"object","description":"Full flow template including the graph, ready for POST /v1/my/flows.","properties":{"trigger":{"type":"object","additionalProperties":true,"description":"Trigger definition (pass as-is to POST /v1/my/flows trigger param)"},"steps":{"type":"array","description":"Step definitions (pass as-is to POST /v1/my/flows steps param). Each email\nstep carries its `key`, which becomes its action name, and, for a template\nan agent can select, its `job` and `objective`.\n","items":{"type":"object","additionalProperties":true}}}}]},"EngagementBucket":{"type":"object","description":"Engagement for a cohort of emails: every email of the resource (or, nested as\n`account`, every email of the brand), counting all their engagement whenever it\narrived. An email is one message the provider accepted; test sends are excluded.\nEach email counts at most once toward `opens` however many times it was opened\nand however many observers (tracking pixel, provider webhook) reported it.\n","required":["sent","delivered","opens","total_opens","open_rate"],"properties":{"sent":{"type":"integer","description":"Emails the provider accepted in this bucket (test sends excluded)."},"delivered":{"type":"integer","description":"Provider-confirmed deliveries, excluding final bounces. Missing feedback is not delivery confirmation."},"non_bounced":{"type":"integer","description":"Accepted emails minus known bounces; the denominator of open and click rates."},"unconfirmed":{"type":"integer","description":"Accepted emails without a confirmed delivery or final bounce. Never treat these as bounces or retry sends from this count."},"opens":{"type":"integer","description":"Non-bounced emails with at least one observed open. Known scanners are\nexcluded; privacy tools can register opens automatically. This is not proof of a human read.\n"},"total_opens":{"type":"integer","description":"All counted open observations of non-bounced emails, including repeat opens, so\n`total_opens \u003e= opens`. A volume figure, never a rate numerator.\n"},"open_rate":{"type":["number","null"],"format":"float","description":"`opens / non_bounced`, a fraction between 0 and 1 rounded to 4 decimal places.\nNull without a denominator, and for the account bucket when fewer than\n`Report::Engagement::ACCOUNT_BASELINE_MIN_SENT` emails were sent.\n"}}},"Engagement":{"allOf":[{"$ref":"#/components/schemas/EngagementBucket"},{"type":"object","required":["pending","account"],"properties":{"pending":{"type":"boolean","description":"True when this response does not carry the record's counted numbers: a campaign\nwhose latest send has finished and whose emails are still being counted (read it\nagain in a few seconds), or a response, such as a create, update or send, that does\nnot count them. The counts are then 0 and the rates null; do not show them.\n"},"account":{"$ref":"#/components/schemas/EngagementBucket"}}}]},"EngagementCohortBucket":{"type":"object","description":"Engagement of a cohort of emails: the messages the provider accepted (test sends\nexcluded), each counted once however many times or by however many observers\n(tracking pixel, provider webhook) it was opened or clicked. Rates are fractions\nbetween 0 and 1 rounded to 4 decimal places, null without a denominator.\n","required":["sent","delivered","bounced","opens","total_opens","clicks","total_clicks","forwards","delivered_rate","open_rate","click_rate","bounce_rate"],"properties":{"sent":{"type":"integer","description":"Emails the provider accepted."},"delivered":{"type":"integer","description":"Provider-confirmed deliveries excluding final bounces."},"non_bounced":{"type":"integer","description":"`sent - bounced`; the open and click rate denominator."},"unconfirmed":{"type":"integer","description":"`sent - bounced - delivered`; missing feedback is neither a confirmed delivery nor a bounce."},"bounced":{"type":"integer","description":"Emails that bounced."},"opens":{"type":"integer","description":"Non-bounced emails opened at least once. Known scanners excluded; automatic privacy image loads can count. Not proof of human readership."},"total_opens":{"type":"integer","description":"Counted open observations including repeats; never a rate numerator."},"clicks":{"type":"integer","description":"Non-bounced emails clicked at least once; `clicks \u003c= non_bounced`."},"total_clicks":{"type":"integer","description":"Counted click observations of non-bounced emails."},"forwards":{"type":"integer","description":"Non-bounced emails with a recorded forward."},"delivered_rate":{"type":["number","null"],"format":"float","description":"`delivered / sent`."},"open_rate":{"type":["number","null"],"format":"float","description":"`opens / non_bounced`."},"click_rate":{"type":["number","null"],"format":"float","description":"`clicks / non_bounced`."},"bounce_rate":{"type":["number","null"],"format":"float","description":"`bounced / sent`."}}},"MessageSendsEngagement":{"type":"object","required":["interval","summary","series","has_sends"],"properties":{"interval":{"type":"string","enum":["hour","day","month"],"description":"Series bucket size (`hour` for today, `month` for all time, otherwise `day`)."},"summary":{"$ref":"#/components/schemas/EngagementCohortBucket"},"series":{"type":"array","description":"One entry per interval of the window (zero-filled), plus any later interval with sends; entries add up to `summary`.\n","items":{"allOf":[{"type":"object","required":["bucket_start"],"properties":{"bucket_start":{"type":"string","format":"date-time"}}},{"$ref":"#/components/schemas/EngagementCohortBucket"}]}},"has_sends":{"type":"boolean","description":"Whether the source has a counted non-test email (outside the window too). Emails are counted a few seconds after they are sent."}}},"MessageSendsRow":{"type":"object","required":["source_type","row_key","source_name","total","sent","failed","queued","delivered","opened","clicked","open_rate","click_rate"],"properties":{"source_type":{"type":"string","enum":["campaign","flow","transactional","test"]},"row_key":{"type":"string"},"source_id":{"type":["integer","null"],"description":"Campaign or flow id; null for transactional and test rows."},"source_name":{"type":"string"},"date":{"type":["string","null"],"format":"date","description":"Creation day of a transactional or test row."},"subject":{"type":["string","null"]},"recipients":{"type":["string","null"]},"recipients_count":{"type":"integer"},"total":{"type":"integer","description":"Messages in the row (every status and channel) within the window."},"sent":{"type":"integer","description":"Messages of the row the provider accepted (every channel)."},"failed":{"type":"integer"},"queued":{"type":"integer"},"latest_failure_code":{"type":["string","null"]},"latest_failure_reason":{"type":["string","null"]},"latest_failure_category":{"type":["string","null"]},"last_sent_at":{"type":["string","null"],"format":"date-time"},"delivered":{"type":"integer","description":"The row's provider-confirmed deliveries (0 on test and failed-only rows)."},"non_bounced":{"type":"integer","description":"Accepted non-test emails minus known bounces."},"unconfirmed":{"type":"integer","description":"Accepted non-test emails without a final provider outcome."},"opened":{"type":"integer","description":"Non-bounced emails of the row opened at least once; privacy image loads can count."},"clicked":{"type":"integer","description":"Non-bounced emails of the row clicked at least once."},"open_rate":{"type":"number","description":"Percentage (0-100, 1 dp) of `non_bounced`; 0 without a denominator."},"click_rate":{"type":"number","description":"Percentage (0-100, 1 dp) of `non_bounced`; 0 without a denominator."},"delivery":{"type":"object","additionalProperties":true,"description":"Send progress of a campaign row with an active send (same projection as the campaign delivery endpoints)."}}},"MessageSendsCounts":{"type":"object","required":["all","campaign","flow","transactional","test","time"],"description":"Message counts for the filter pills, over the same window as the rows.","properties":{"all":{"type":"integer","description":"Messages of every source in the `since` window (with `failed`)."},"campaign":{"type":"integer"},"flow":{"type":"integer"},"transactional":{"type":"integer"},"test":{"type":"integer"},"time":{"type":"object","description":"Messages of the selected source (with `failed`) per window.","required":["all","today","7d","30d","3m"],"properties":{"all":{"type":"integer"},"today":{"type":"integer"},"7d":{"type":"integer"},"30d":{"type":"integer"},"3m":{"type":"integer"}}}}},"MessageSendsResponse":{"type":"object","required":["rows","counts","engagement"],"properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/MessageSendsRow"}},"counts":{"$ref":"#/components/schemas/MessageSendsCounts"},"engagement":{"$ref":"#/components/schemas/MessageSendsEngagement"}}},"RevenueMessageBreakdown":{"type":"object","properties":{"message_id":{"type":"integer"},"subject":{"type":"string","nullable":true},"sent_at":{"type":"string","format":"date-time","nullable":true},"currency":{"type":"string","nullable":true,"description":"Dominant attributed order currency for this message row."},"mixed_currency":{"type":"boolean","description":"True when attributed orders included more than one currency before dominant-currency filtering."},"delivered":{"type":"integer"},"attributed_orders":{"type":"integer"},"attributed_revenue_cents":{"type":"integer","description":"Net attributed revenue in cents from the orders ledger."},"revenue_per_recipient":{"type":"number","format":"float","nullable":true},"conversion_rate":{"type":"number","format":"float","nullable":true},"attributed_aov":{"type":"number","format":"float","nullable":true}}},"RevenueReport":{"type":"object","description":"Attributed revenue from the orders ledger. This block is omitted when\nthe brand has no connected Shopify or Stripe revenue source.\n","properties":{"attribution_label":{"type":"string","example":"Attributed revenue. Last click, 7-day window."},"currency":{"type":"string","nullable":true,"description":"Dominant attributed order currency used for revenue math. Null when no attributed orders carry a currency."},"mixed_currency":{"type":"boolean","description":"True when attributed orders included more than one currency before dominant-currency filtering."},"attributed_revenue_cents":{"type":"integer","description":"Net attributed revenue in cents from the orders ledger."},"delivered":{"type":"integer"},"attributed_orders":{"type":"integer"},"revenue_per_recipient":{"type":"number","format":"float","nullable":true,"description":"Net attributed revenue in major currency units divided by delivered recipients."},"conversion_rate":{"type":"number","format":"float","nullable":true,"description":"Attributed paid orders divided by delivered recipients."},"attributed_aov":{"type":"number","format":"float","nullable":true,"description":"Net attributed revenue in major currency units divided by attributed paid orders."},"message_breakdown":{"type":"array","items":{"$ref":"#/components/schemas/RevenueMessageBreakdown"}}}},"ProfileEnrichmentAudience":{"type":"object","description":"Exactly one same-Brand selection. Existing identity and profile ownership are preserved.","oneOf":[{"required":["contact_ids"],"not":{"required":["lead_ids"]}}],"properties":{"contact_ids":{"type":"array","minItems":1,"maxItems":100,"uniqueItems":true,"items":{"type":"integer"}}}},"FlowTrigger":{"type":"object","properties":{"id":{"type":"integer"},"flow_id":{"type":"integer"},"event":{"type":"string"},"audience_type":{"type":"string","nullable":true,"enum":["lists","segment","all_contacts"],"description":"Explicit campaign audience target; null means no audience selected."},"segment_id":{"type":"integer","nullable":true},"contact_list_id":{"type":"integer","nullable":true,"deprecated":true,"description":"Deprecated — use contact_list_ids"},"contact_list_ids":{"type":"array","items":{"type":"integer"},"description":"Contact list IDs targeted by this trigger"},"exclude_segment_ids":{"type":"array","items":{"type":"integer"},"description":"Segment IDs whose matching contacts are excluded from the recipient set"},"exclude_contact_list_ids":{"type":"array","items":{"type":"integer"},"description":"Contact list IDs whose members are excluded from the recipient set"},"data":{"type":"object","additionalProperties":true,"nullable":true},"triggered_count":{"type":"integer"},"last_triggered_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"FlowTriggerInput":{"type":"object","properties":{"stop_on_reply":{"type":"boolean","default":false,"description":"Stop only the enrollment whose tracked email received a proven human reply. Requires monitored receiving."},"reply_source":{"$ref":"#/components/schemas/ReplySource"},"exit_events":{"type":"array","maxItems":20,"items":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"description":"New same-brand/contact events after journey entry stop future steps. Pinned in the approved revision; cannot recall a step already executing."},"event":{"type":"string","description":"Built-in: contact_add, keyword, message, list_add, list_remove,\nproduct_view, checkout, cart_add, cart_remove, cart_abandoned,\nbrowse_abandoned. Custom: any lowercase alphanumeric with underscores.\nSome built-in names are reserved for Nitrosend's own flows and\ncan't be selected.\n"},"audience_type":{"type":"string","nullable":true,"enum":["lists","segment","all_contacts"],"description":"Explicit campaign audience target; null means no audience selected."},"segment_id":{"type":"integer","nullable":true},"contact_list_id":{"type":"integer","nullable":true,"deprecated":true,"description":"Deprecated — use contact_list_ids"},"contact_list_ids":{"type":"array","items":{"type":"integer"},"description":"Contact list IDs to target"},"exclude_segment_ids":{"type":"array","items":{"type":"integer"},"description":"Segment IDs whose matching contacts are excluded from the recipient set; pass [] to clear"},"data":{"type":"object","additionalProperties":true}}},"FlowTriggerOutput":{"description":"Trigger as returned by Flow::Format.dump","type":"object","properties":{"stop_on_reply":{"type":"boolean"},"reply_source":{"$ref":"#/components/schemas/ReplySource"},"exit_events":{"type":"array","items":{"type":"string"}},"event":{"type":"string"},"segment_id":{"type":"integer","nullable":true},"contact_list_id":{"type":"integer","nullable":true},"exclude_segment_ids":{"type":"array","items":{"type":"integer"},"description":"Segment IDs whose matching contacts are excluded from the recipient set"},"data":{"type":"object","additionalProperties":true,"nullable":true}}},"FlowStepInput":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["email","sms","wait","split","classify_reply","reply","emit_event","webhook","subscribe","unsubscribe"]},"categories":{"type":"array","minItems":2,"maxItems":6,"items":{"$ref":"#/components/schemas/ReplyCategory"}},"branches":{"type":"object","description":"Every declared category key and other must have an explicit path. A branch node ends its sequence.","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/FlowStepInput"}}},"reply_all":{"type":"boolean","default":false},"cc":{"type":"array","items":{"type":"string","format":"email"}},"bcc":{"type":"array","items":{"type":"string","format":"email"}},"subject":{"type":"string","description":"Email step: subject line"},"body":{"type":"string","description":"SMS body or email plain text"},"content_format":{"type":"string","enum":["designed","plain"]},"plain_text_mode":{"type":"string","enum":["derived","custom"]},"preheader":{"type":"string","description":"Email step: preheader"},"from_name":{"type":"string"},"from_email":{"type":"string"},"reply_to":{"type":"string","format":"email","description":"Email step: one email address; blank uses the brand's. Checked when it changes: a malformed value returns 422."},"design":{"$ref":"#/components/schemas/EmailDesign"},"duration":{"type":"integer","minimum":0,"description":"Wait step: seconds, positive unless send_at is configured"},"send_at":{"type":"string","pattern":"^(?:[01][0-9]|2[0-3]):[0-5][0-9]$","description":"First local occurrence at/after the original duration. Resume does not restart the delay. DST gaps use the first valid instant; folds use the first eligible occurrence."},"time_zone":{"type":"string","description":"IANA time zone for send_at. Defaults from the account owner or Etc/UTC and is pinned in the approved runtime."},"filters":{"$ref":"#/components/schemas/SegmentFilterExpression","description":"Split step: condition filters"},"yes":{"type":"array","items":{"$ref":"#/components/schemas/FlowStepInput"},"description":"Split step: yes branch"},"no":{"type":"array","items":{"$ref":"#/components/schemas/FlowStepInput"},"description":"Split step: no branch"},"event_name":{"type":"string","description":"Emit event step: event to fire"},"forward_event_data":{"type":"boolean","default":false},"event_data":{"type":"object","additionalProperties":true},"transactional":{"type":"boolean","default":false}}},"FlowStepOutput":{"description":"Step as returned by Flow::Format.dump","type":"object","properties":{"type":{"type":"string","enum":["email","sms","wait","split","classify_reply","reply","emit_event","webhook","subscribe","unsubscribe"]},"categories":{"type":"array","items":{"$ref":"#/components/schemas/ReplyCategory"}},"branches":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/FlowStepOutput"}}},"reply_all":{"type":"boolean"},"cc":{"type":"array","items":{"type":"string","format":"email"}},"bcc":{"type":"array","items":{"type":"string","format":"email"}},"subject":{"type":"string"},"body":{"type":"string"},"content_format":{"$ref":"#/components/schemas/EmailContentFormat","description":"Persisted presentation for an email step; defaults to designed."},"preheader":{"type":"string"},"duration":{"type":"integer"},"send_at":{"type":"string"},"time_zone":{"type":"string"},"filters":{"type":"array","items":{"type":"object"}},"yes":{"type":"array","items":{"$ref":"#/components/schemas/FlowStepOutput"}},"no":{"type":"array","items":{"$ref":"#/components/schemas/FlowStepOutput"}},"event_name":{"type":"string"},"forward_event_data":{"type":"boolean"}}},"ReplySource":{"oneOf":[{"type":"object","required":["type"],"additionalProperties":false,"properties":{"type":{"type":"string","enum":["any"]}}},{"type":"object","required":["type","id"],"additionalProperties":false,"properties":{"type":{"type":"string","enum":["flow","campaign","message"]},"id":{"type":"integer","minimum":1,"description":"Existing resource in the same brand."}}}]},"ReplyCategory":{"type":"object","required":["key","label","description"],"additionalProperties":false,"properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$","description":"Stable branch key; other is reserved."},"label":{"type":"string","minLength":1,"maxLength":60},"description":{"type":"string","minLength":1,"maxLength":500}}},"Event":{"type":"object","properties":{"id":{"type":"integer"},"account_id":{"type":"integer"},"contact_id":{"type":"integer"},"user_id":{"type":"integer"},"event":{"type":"string"},"amount":{"type":"number","format":"double","nullable":true},"data":{"type":"object","additionalProperties":true},"idempotency_key":{"type":"string","nullable":true},"resource_uid":{"type":"string","nullable":true},"resource_name":{"type":"string","nullable":true},"resource_url":{"type":"string","nullable":true},"test":{"type":"boolean"},"generated":{"type":"boolean"},"chain_depth":{"type":"integer"},"ip":{"type":"string","nullable":true},"user_agent":{"type":"string","nullable":true},"browser":{"type":"string","nullable":true},"os":{"type":"string","nullable":true},"device_type":{"type":"string","nullable":true},"referrer":{"type":"string","nullable":true},"utm_source":{"type":"string","nullable":true},"utm_medium":{"type":"string","nullable":true},"utm_term":{"type":"string","nullable":true},"utm_content":{"type":"string","nullable":true},"utm_campaign":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"SharedSubdomain":{"type":"object","required":["id","name","sending_domain_id","sending_domain_name","account_id","account_name","brand_id","brand_sid","brand_name","active","dns_verified"],"properties":{"id":{"type":"integer"},"name":{"type":"string","description":"The recipient's visible From domain."},"sending_domain_id":{"type":"integer"},"sending_domain_name":{"type":"string"},"account_id":{"type":"integer"},"account_name":{"type":"string"},"brand_id":{"type":"integer"},"brand_sid":{"type":"string"},"brand_name":{"type":"string"},"active":{"type":"boolean","description":"Domain permission is current; DNS verification remains a separate requirement."},"revoked_at":{"type":["string","null"],"format":"date-time"},"dns_verified":{"type":"boolean"}}},"SubdomainSharingSummary":{"type":"object","required":["parent","destinations","destinations_truncated","subdomains","pagination"],"properties":{"parent":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"destinations":{"type":"array","maxItems":100,"items":{"type":"object","properties":{"account_id":{"type":"integer"},"account_name":{"type":"string"},"brand_id":{"type":"integer"},"brand_sid":{"type":"string"},"brand_name":{"type":"string"}}}},"destinations_truncated":{"type":"boolean"},"subdomains":{"type":"array","maxItems":25,"items":{"$ref":"#/components/schemas/SharedSubdomain"}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"total_pages":{"type":"integer"},"total_count":{"type":"integer"}}}}},"Domain":{"type":"object","properties":{"id":{"type":"integer"},"brand_id":{"type":"integer","nullable":true},"name":{"type":"string"},"provider":{"type":"string","default":"ses"},"default_from_domain":{"type":"string","description":"Domain Nitrosend will use for visible From addresses when this sending domain is selected."},"subdomain_sharing_available":{"type":"boolean","description":"The current principal can manage sharing on this verified apex."},"shared_subdomain":{"type":"object","description":"Present only for a shared child, including after permission ends. DNS status is independent.","properties":{"active":{"type":"boolean"},"parent_domain":{"type":["string","null"]},"message":{"type":["string","null"]}}},"sender_authorization_reason":{"type":"string","enum":["missing_sender_domain","exact_inbox","exact_mailbox","shared_domain_requires_exact_inbox","shared_domain_not_verified","platform_domain","sender_domain_not_authorized","sending_domain","unaligned_apex_supported","author_identity_not_verified","author_domain_unaligned","author_domain","sender_domain_mismatch"],"description":"Machine-readable reason the default visible From domain is or is not authorized."},"outstanding":{"type":["object","null"],"description":"What still stands between this domain and sending, as the next step, and when Nitrosend checks again automatically. Null once the domain and its From domain are verified and DNS is healthy. Verify reads DNS without delaying that check; one that finds the records newly in place makes it due at once.","required":["code","action_required","items","message","next_check_at"],"properties":{"code":{"type":"string","enum":["dns_records","provider_confirmation","domain_review","domain_permission"],"description":"dns_records: DNS records still need adding or fixing. provider_confirmation: DNS is in place and the email provider has not confirmed the domain yet. domain_review: a Nitrosend review holds the domain. domain_permission: the subdomain no longer has its owner's permission to send or receive."},"action_required":{"type":"boolean","description":"True when the customer has to act; false when the domain verifies on its own."},"items":{"type":"array","description":"The DNS records or provider checks still outstanding, per domain.","items":{"type":"object","required":["domain","check"],"properties":{"domain":{"type":"string","description":"The sending domain or its From domain."},"check":{"type":"string","description":"A DNS family (verification, spf, dkim, dmarc, mx, return_path, tracking) for dns_records, or a provider check (verification, dkim, mail_from, tenant_association)."}}}},"message":{"type":"string","description":"Customer-facing explanation","including the next automatic check.":null},"next_check_at":{"type":["string","null"],"format":"date-time","description":"When Nitrosend next checks this domain automatically; null when nothing is scheduled."}}},"integration_id":{"type":"integer","nullable":true},"status":{"type":"string","enum":["pending","verified"]},"dmarc_policy":{"type":"string","enum":["none","quarantine","reject"],"description":"Effective observed DMARC policy persisted by Nitrosend; defaults to none until observed."},"dmarc_recommended_policy":{"type":"string","enum":["none","quarantine","reject"],"description":"Nitrosend's recommended DMARC policy rung."},"dmarc_observed_policy":{"type":"string","enum":["none","quarantine","reject"],"nullable":true,"description":"Last live DMARC policy observed by Nitrosend."},"dns_records":{"$ref":"#/components/schemas/DomainDnsRecords","nullable":true},"inbound_setup":{"allOf":[{"$ref":"#/components/schemas/DomainInboundSetup"}],"nullable":true},"dns_health":{"type":"object","additionalProperties":true,"nullable":true},"dns_setup_status":{"type":"string","enum":["unchecked","incomplete","ready","verified"]},"verified_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"sending_health":{"description":"The domain's sending over the last 30 UTC send days against the 30 days before. Null for a domain on your own email provider, whose results reach Nitrosend only through your provider's webhooks.","oneOf":[{"$ref":"#/components/schemas/DomainSendingHealth"},{"type":"null"}]}}},"DomainSendingHealth":{"type":"object","description":"Counts every provider-accepted recipient sent from this domain (both domains of a pair and their inboxes; connected mailboxes and test sends excluded), by UTC send day, today included. Delivery, bounce and complaint results are counted on the day the email was sent, so the newest days can still gain late results, complaints especially.","required":["days","sent","delivery_rate","bounce_rate","complaint_rate"],"properties":{"days":{"type":"integer","enum":[30]},"sent":{"$ref":"#/components/schemas/DomainSendingHealthCount"},"delivery_rate":{"description":"Delivered ÷ sent. Higher is good.","allOf":[{"$ref":"#/components/schemas/DomainSendingHealthRate"}]},"bounce_rate":{"description":"Hard bounces ÷ sent. Lower is good.","allOf":[{"$ref":"#/components/schemas/DomainSendingHealthRate"}]},"complaint_rate":{"description":"Spam complaints ÷ sent (\"not spam\" reports excluded). Lower is good.","allOf":[{"$ref":"#/components/schemas/DomainSendingHealthRate"}]}}},"DomainSendingHealthCount":{"type":"object","required":["value","previous","change_percent","tone"],"properties":{"value":{"type":"integer","description":"Emails sent in the last 30 days."},"previous":{"type":"integer","description":"Emails sent in the 30 days before."},"change_percent":{"type":["integer","null"],"description":"Change against the previous 30 days, in whole percent. Null when nothing was sent then."},"tone":{"type":["string","null"],"enum":["good","neutral",null],"description":"More sends is good; fewer is neutral. Null when change_percent is null."}}},"DomainSendingHealthRate":{"type":"object","required":["value","previous","change_points","tone"],"properties":{"value":{"type":["number","null"],"description":"Fraction of the last 30 days' sends, to 4 places. Null when nothing was sent."},"previous":{"type":["number","null"],"description":"The same fraction for the 30 days before. Null when nothing was sent then."},"change_points":{"type":["number","null"],"description":"Change in percentage points, to 1 place (2 for complaint_rate). Null when either period sent nothing."},"tone":{"type":["string","null"],"enum":["good","bad","neutral",null],"description":"Whether the change is good for the domain; neutral when it rounds to 0. Null when change_points is null."}}},"EntriSessionResponse":{"type":"object","required":["domain","entri"],"properties":{"domain":{"$ref":"#/components/schemas/Domain"},"entri":{"type":"object","required":["application_id","token","prefilled_domain","user_id","dns_records","manual_dns_records"],"properties":{"application_id":{"type":"string"},"token":{"type":"string"},"prefilled_domain":{"type":"string"},"user_id":{"type":"string"},"dns_records":{"type":"array","items":{"$ref":"#/components/schemas/EntriDnsRecord"}},"manual_dns_records":{"$ref":"#/components/schemas/DomainDnsRecords"}}}}},"EntriSessionRequest":{"type":"object","properties":{"apex_mx_override":{"type":"boolean","default":false,"description":"Explicitly include the prepared company-inbox MX cutover in this session."},"apex_mx_confirmation":{"type":"string","description":"Exact apex domain name being approved. Required when apex_mx_override is true."}}},"EntriSessionValidationError":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"blockers":{"type":"array","items":{"type":"string"},"description":"Machine-readable reasons the apex MX cutover cannot proceed."}}}]},"DomainDnsRecords":{"type":"object","properties":{"sending_dns_records":{"type":"array","items":{"$ref":"#/components/schemas/DomainDnsRecord"}},"receiving_dns_records":{"type":"array","items":{"$ref":"#/components/schemas/DomainDnsRecord"}}},"additionalProperties":true},"DomainDnsRecord":{"type":"object","properties":{"record_type":{"type":"string"},"name":{"type":"string"},"relative_name":{"type":"string","description":"Record name relative to the registrable domain, as most registrars' Host field expects; `@` for the apex."},"value":{"type":"string"},"priority":{"type":"string","nullable":true},"valid":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"required":{"type":"boolean","nullable":true},"mail_forwarding":{"allOf":[{"$ref":"#/components/schemas/DomainMailForwarding"}],"nullable":true}}},"DomainMailForwarding":{"type":"object","required":["enabled","route_type","destination_type","legacy_mx_records","setup_note"],"properties":{"enabled":{"type":"boolean"},"route_type":{"type":"string","enum":["legacy_forward_all","unmatched_forward"]},"destination_type":{"type":"string","enum":["legacy_mx","smtp_relay"]},"legacy_mx_records":{"type":"array","items":{"$ref":"#/components/schemas/MxRecord"}},"setup_note":{"type":"string"}}},"DomainInboundSetupRequest":{"type":"object","additionalProperties":false,"required":["inbound_setup"],"properties":{"inbound_setup":{"type":"object","additionalProperties":false,"required":["method"],"properties":{"method":{"type":"string","enum":["provider_forwarding","mx"]},"provider":{"type":"string","enum":["google_workspace","microsoft_365","zoho","other"],"description":"Required when method is provider_forwarding."},"local_part":{"type":"string","description":"Select an exact existing address, or request creation subject to the current inbox allowance."},"inbox_id":{"type":"integer","description":"Existing inbox on this domain. Required for an ambiguous setup when local_part is omitted."},"display_name":{"type":"string","nullable":true},"prepare":{"type":"boolean","default":false,"description":"Prepare apex receiving before opening the existing Entri MX connection. Does not change DNS."},"no_existing_mail_service":{"type":"boolean","default":false,"description":"Explicit first-mailbox choice. Rejected when public MX or a saved route identifies an existing mail service."}}}}},"DomainInboundSetup":{"type":"object","required":["method","status"],"properties":{"method":{"type":"string","enum":["none","provider_forwarding","mx"]},"status":{"type":"string","enum":["not_configured","pending","active","attention"]},"requires_inbox_selection":{"type":"boolean","description":"Several inboxes exist and no specific inbox was selected."},"mx_scope":{"type":"string","enum":["apex","subdomain"],"nullable":true},"inbox":{"allOf":[{"$ref":"#/components/schemas/DomainInboundInbox"}],"nullable":true},"provider_forwarding":{"allOf":[{"$ref":"#/components/schemas/DomainProviderForwarding"}],"nullable":true},"apex_mx":{"allOf":[{"$ref":"#/components/schemas/DomainApexMxSetup"}],"nullable":true}}},"DomainInboundInbox":{"type":"object","required":["id","address","status"],"properties":{"id":{"type":"integer"},"address":{"type":"string","format":"email"},"display_name":{"type":"string","nullable":true,"maxLength":255},"status":{"type":"string","enum":["active","disabled","archived"]}}},"DomainProviderForwarding":{"type":"object","required":["provider","forwarding_address"],"properties":{"provider":{"type":"string","enum":["google_workspace","microsoft_365","zoho","other"]},"forwarding_address":{"type":"string","format":"email","readOnly":true},"probe_sent_at":{"type":"string","format":"date-time","nullable":true},"verified_at":{"type":"string","format":"date-time","nullable":true}}},"DomainApexMxSetup":{"type":"object","required":["prepared","configured","approval_required","legacy_mx_records"],"properties":{"mode":{"type":"string","enum":["standalone","forward_all"]},"preparation":{"type":"object","properties":{"state":{"type":"string","enum":["queued","preparing","probing","ready","failed"]},"message":{"type":"string"},"failure_code":{"type":"string"}}},"prepared":{"type":"boolean"},"configured":{"type":"boolean"},"approval_required":{"type":"boolean"},"approval_expires_at":{"type":"string","format":"date-time","nullable":true},"legacy_provider_label":{"type":"string","nullable":true},"legacy_mx_records":{"type":"array","items":{"$ref":"#/components/schemas/MxRecord"}},"setup_note":{"type":"string","nullable":true}}},"MxRecord":{"type":"object","required":["host","preference"],"properties":{"host":{"type":"string"},"preference":{"type":"integer"}}},"EntriDnsRecord":{"type":"object","properties":{"type":{"type":"string"},"host":{"type":"string"},"value":{"type":"string"},"ttl":{"type":"integer"},"priority":{"type":"integer","nullable":true}}},"Integration":{"type":"object","properties":{"id":{"type":"integer"},"provider":{"type":"string","enum":["mailgun","ses","postmark","resend","sendgrid","gmail","microsoft365","smtp","twilio","attio","hubspot","mailchimp","activecampaign","stripe","shopify","apollo"]},"category":{"type":"string","enum":["email","sms","crm","revenue","ecommerce","data"]},"active":{"type":"boolean"},"primary":{"type":"boolean"},"status":{"type":"string","enum":["pending","connected","error"]},"connected_at":{"type":"string","format":"date-time","nullable":true},"last_tested_at":{"type":"string","format":"date-time","nullable":true},"error_message":{"type":"string","nullable":true},"config_summary":{"type":"object","additionalProperties":true,"properties":{"mailbox_address":{"type":"string","format":"email","description":"Exact address authorized by a connected mailbox."},"account_type":{"type":"string","enum":["workspace","personal"],"description":"Google mailbox type when available."},"reply_sync_enabled_at":{"type":"string","format":"date-time","description":"Gmail: when reply sync was last turned on. Absent while it is off. Only mail that arrived after it is read."},"verification_pending":{"type":"boolean","description":"SMTP address verification code is outstanding."},"smtp_host":{"type":"string"},"smtp_port":{"type":"integer"},"imap_host":{"type":"string"},"imap_port":{"type":"integer"},"imap_username":{"type":"string"},"sent_folder":{"type":"string"},"junk_folder":{"type":"string"},"sending_domain_id":{"type":"integer","nullable":true},"sending_identity_id":{"type":"integer"},"sender_ready":{"type":"boolean"},"selected_sender":{"type":"boolean"},"connect_url":{"type":"string","format":"uri","description":"Dashboard connection and reconnect action."},"last_synced_at":{"type":"string","format":"date-time","nullable":true,"description":"Mailboxes: last completed provider page of mailbox acceptance and correlated reply ingestion, not proof of delivery. Contact-sync integrations: when the last sync run completed."},"api_host":{"type":"string","description":"ActiveCampaign: the account's API host, from the API URL it was connected with."},"contacts_reconciled_at":{"type":"string","format":"date-time","description":"ActiveCampaign: when the last full contact sync started. Runs in between read only contacts ActiveCampaign changed."},"list_mapping_count":{"type":"integer","description":"Contact-sync integrations: provider lists (and, for ActiveCampaign, tags) kept as Nitrosend lists."},"event_capabilities":{"type":"object","description":"Supported evidence only. Request acceptance is not delivery proof.","properties":{"acceptance":{"type":"boolean"},"replies":{"type":"boolean"},"delivery":{"type":"boolean"},"complaints":{"type":"boolean"}}}}},"secret_hints":{"type":"object","additionalProperties":{"type":"string","nullable":true}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"SmtpFeedbackPayload":{"oneOf":[{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["test"]}}},{"type":"object","additionalProperties":false,"required":["type","message_id","recipient","occurred_at"],"properties":{"type":{"type":"string","enum":["delivered","bounced","complained"]},"message_id":{"type":"string","maxLength":255,"description":"Original RFC Message-ID, with or without surrounding angle brackets."},"recipient":{"type":"string","format":"email","maxLength":254},"occurred_at":{"type":"string","format":"date-time","description":"Outcome time, no more than five minutes in the future."},"status":{"type":"string","pattern":"^[45]\\.\\d{1,3}\\.\\d{1,3}$","description":"Required only for bounced events. Recipient failures suppress; policy failures remain delivery_failed observations."},"nitrosend_message_id":{"type":"integer","format":"int64","minimum":1,"maximum":9223372036854775807,"description":"Optional original X-Nitro-Message-Id, supplied together with dispatch_token to correlate an outcome before the send result is persisted."},"dispatch_token":{"type":"string","maxLength":2048,"description":"Original X-Nitro-Dispatch header, supplied together with nitrosend_message_id."}},"allOf":[{"if":{"properties":{"type":{"const":"bounced"}}},"then":{"required":["status"]},"else":{"not":{"required":["status"]}}}],"dependentRequired":{"nitrosend_message_id":["dispatch_token"],"dispatch_token":["nitrosend_message_id"]}}]},"SmtpFeedbackSetup":{"type":"object","required":["url","signing_secret","signing_format","events"],"properties":{"url":{"type":"string","format":"uri"},"signing_secret":{"type":"string","description":"Connection-specific whsec_ key; never included in integration lists or broadcasts."},"signing_format":{"type":"string","enum":["standard_webhooks"]},"events":{"type":"array","maxItems":20,"items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["test","delivered","bounced","complained"]},"status":{"type":"string","enum":["pending","processing","processed","ignored","failed"]},"received_at":{"type":"string","format":"date-time"},"processed_at":{"type":"string","format":"date-time","nullable":true},"message_id":{"type":"string","nullable":true},"recipient":{"type":"string","nullable":true},"error_message":{"type":"string","nullable":true}}}}}},"ShopifyMerchantCredentialRequest":{"type":"object","required":["shopify"],"properties":{"shopify":{"type":"object","additionalProperties":false,"required":["shop","client_id","client_secret"],"properties":{"shop":{"type":"string","description":"Permanent myshopify.com domain or shop slug."},"client_id":{"type":"string","writeOnly":true,"description":"Client ID for the merchant-owned Shopify app."},"client_secret":{"type":"string","format":"password","writeOnly":true,"description":"Client secret for the merchant-owned Shopify app."}}}}},"IntegrationWriteRequest":{"type":"object","required":["integration"],"properties":{"integration":{"oneOf":[{"$ref":"#/components/schemas/MailgunIntegrationInput"},{"$ref":"#/components/schemas/SesIntegrationInput"},{"$ref":"#/components/schemas/PostmarkIntegrationInput"},{"$ref":"#/components/schemas/ResendIntegrationInput"},{"$ref":"#/components/schemas/SendgridIntegrationInput"},{"$ref":"#/components/schemas/ActiveCampaignIntegrationInput"}]}}},"IntegrationSyncConfiguration":{"type":"object","required":["integration_id","provider","sync_contract"],"properties":{"integration_id":{"type":"integer"},"provider":{"type":"string"},"sync_contract":{"$ref":"#/components/schemas/IntegrationSyncContract"}}},"IntegrationSyncContract":{"type":"object","required":["version","objects","mirror_lists"],"properties":{"version":{"type":"integer","enum":[1]},"mirror_lists":{"type":"boolean"},"updated_at":{"type":"string","format":"date-time","nullable":true},"objects":{"type":"array","maxItems":25,"items":{"$ref":"#/components/schemas/IntegrationSyncObjectSelection"}}}},"IntegrationSyncObjectSelection":{"type":"object","required":["object_slug","mode"],"properties":{"object_id":{"type":"string"},"object_slug":{"type":"string","maxLength":180},"label":{"type":"string","maxLength":120},"mode":{"type":"string","enum":["addressable","related"]},"enabled":{"type":"boolean","default":true},"field_policy":{"type":"string","enum":["all_supported","selected"]},"selected_fields":{"type":"array","maxItems":200,"items":{"type":"string","maxLength":180}},"excluded_fields":{"type":"array","maxItems":200,"items":{"type":"string","maxLength":180}},"relationship":{"type":"object","properties":{"attribute_slug":{"type":"string"},"target_object_slug":{"type":"string","enum":["people","users"]}}},"trait_mapping":{"$ref":"#/components/schemas/IntegrationSyncTraitMapping"},"managed_audience_mapping_key":{"type":"string"},"mirror_lists":{"type":"boolean"}}},"IntegrationSyncTraitMapping":{"type":"object","required":["kind","stage_attribute","closed_stage_values"],"properties":{"kind":{"type":"string","enum":["deal_pipeline"]},"stage_attribute":{"type":"string","maxLength":180},"closed_stage_values":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","maxLength":120}},"amount_attribute":{"type":"string","maxLength":180},"currency_attribute":{"type":"string","maxLength":180}}},"IntegrationSyncConfigurationWriteRequest":{"type":"object","required":["sync_contract"],"properties":{"sync_contract":{"$ref":"#/components/schemas/IntegrationSyncContract"}}},"IntegrationSyncDiscovery":{"type":"object","required":["provider","version","objects","truncated"],"properties":{"provider":{"type":"string"},"version":{"type":"integer","enum":[1]},"truncated":{"type":"boolean"},"objects":{"type":"array","maxItems":100,"items":{"type":"object","required":["object_id","object_slug","eligible","attributes"],"properties":{"object_id":{"type":"string"},"object_slug":{"type":"string"},"singular_noun":{"type":"string"},"plural_noun":{"type":"string"},"eligible":{"type":"boolean"},"recommended_mode":{"type":"string","enum":["addressable","related"],"nullable":true},"ineligible_reason":{"type":"string","nullable":true},"attributes_truncated":{"type":"boolean"},"attributes":{"type":"array","maxItems":500,"items":{"$ref":"#/components/schemas/IntegrationSyncDiscoveredAttribute"}},"relationship_attributes":{"type":"array","maxItems":500,"items":{"$ref":"#/components/schemas/IntegrationSyncDiscoveredAttribute"}}}}}}},"IntegrationSyncDiscoveredAttribute":{"type":"object","required":["attribute_id","attribute_slug","type","classification"],"properties":{"attribute_id":{"type":"string"},"attribute_slug":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"classification":{"type":"string","enum":["canonical_scalar","fact_only","relationship"]},"required":{"type":"boolean"},"unique":{"type":"boolean"},"multiselect":{"type":"boolean"},"target_object_slugs":{"type":"array","items":{"type":"string"}},"options":{"type":"array","maxItems":100,"items":{"type":"string","maxLength":120}}}},"MailgunIntegrationInput":{"type":"object","required":["provider","api_key","domain"],"properties":{"provider":{"type":"string","enum":["mailgun"]},"api_key":{"type":"string"},"domain":{"type":"string","description":"Mailgun sending domain"},"region":{"type":"string","nullable":true,"description":"Optional Mailgun region hint"},"active":{"type":"boolean","default":true}}},"SesIntegrationInput":{"type":"object","required":["provider","access_key_id","secret_access_key","region"],"properties":{"provider":{"type":"string","enum":["ses"]},"access_key_id":{"type":"string"},"secret_access_key":{"type":"string"},"region":{"type":"string","description":"AWS SES region","e.g. us-east-1":null},"active":{"type":"boolean","default":true}}},"PostmarkIntegrationInput":{"type":"object","required":["provider","server_token","account_token"],"properties":{"provider":{"type":"string","enum":["postmark"]},"server_token":{"type":"string","description":"Postmark server token for sending email"},"account_token":{"type":"string","description":"Postmark account token for domains API access"},"active":{"type":"boolean","default":true}}},"ResendIntegrationInput":{"type":"object","required":["provider","api_key"],"properties":{"provider":{"type":"string","enum":["resend"]},"api_key":{"type":"string"},"active":{"type":"boolean","default":true}}},"SendgridIntegrationInput":{"type":"object","required":["provider","api_key"],"properties":{"provider":{"type":"string","enum":["sendgrid"]},"api_key":{"type":"string"},"active":{"type":"boolean","default":true}}},"ActiveCampaignIntegrationInput":{"type":"object","required":["provider","api_url","api_key"],"properties":{"provider":{"type":"string","enum":["activecampaign"]},"api_url":{"type":"string","format":"uri","description":"The API URL from ActiveCampaign Settings \u003e Developer, like https://youraccount.api-us1.com. Only https on an ActiveCampaign API host is accepted."},"api_key":{"type":"string","writeOnly":true},"active":{"type":"boolean","default":true}}},"Plan":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"active":{"type":"boolean"},"change_timing":{"type":"string","nullable":true,"enum":["immediate","renewal"],"description":"Available on account-scoped base offers; uses the same rule as subscription change scheduling."},"change_at":{"type":"string","format":"date-time","nullable":true},"change_blockers":{"type":"array","description":"Account-scoped base-plan capacity reasons preventing a voluntary change. Cancellation and return to Free remain available; no resources are deleted.","items":{"type":"object","required":["resource","used","limit","message"],"properties":{"resource":{"type":"string","enum":["brands","domains","seats","inboxes"]},"used":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":0},"message":{"type":"string"}}}},"probation_recipient_cap_24h":{"type":"integer","minimum":0,"description":"Same allowance as Standard. A one-time initial bulk observation can briefly defer bulk dispatch, not individual transactional mail."},"standard_recipient_cap_24h":{"type":"integer","minimum":0},"trusted_recipient_cap_24h":{"type":"integer","minimum":0,"description":"Full allowance on earning Trusted; zero represents a contracted unlimited allowance. Credits and safety remain separate."},"entitlements":{"$ref":"#/components/schemas/BillingEntitlements"}}},"HtmlEmailSource":{"type":"object","required":["html"],"additionalProperties":false,"properties":{"html":{"type":"string","description":"Complete UTF-8 email HTML up to 1 MiB for content_format html."}}},"EmailDesign":{"type":"object","description":"Email template design document","additionalProperties":false,"properties":{"version":{"type":"integer","minimum":1},"sections":{"type":"array","items":{"$ref":"#/components/schemas/EmailSection"}},"theme":{"type":"object","description":"Theme overrides merged on top of brand theme","additionalProperties":false,"properties":{"brand_color":{"type":"string"},"bg_color":{"type":"string"},"text_color":{"type":"string"},"font_body":{"type":"string"},"font_heading":{"type":"string"},"heading_size":{"type":"integer"},"body_size":{"type":"integer"},"radius":{"type":"integer"},"spacing_density":{"type":"string","enum":["compact","normal","spacious"]},"button_background_color":{"type":"string"},"button_text_color":{"type":"string"},"button_padding":{"type":"string"},"logo_url":{"type":"string"},"company_name":{"type":"string"},"physical_address":{"type":"string"},"social_links":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"platform":{"type":"string"},"url":{"type":"string"}}}}}}}},"EmailAccessibilityLint":{"type":"object","description":"Advisory accessibility lint result for rendered email previews","properties":{"product_bindings":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"available":{"type":"integer"},"displayed":{"type":"integer"},"truncated":{"type":"boolean"}}}},"valid":{"type":"boolean","description":"Always true while accessibility lint is advisory-only"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/EmailAccessibilityWarning"}}}},"EmailAccessibilityWarning":{"type":"object","properties":{"level":{"type":"string","example":"warning"},"rule":{"type":"string","example":"image_alt_text"},"message":{"type":"string"},"suggested_fix":{"type":"string"},"count":{"type":"integer"},"min_ratio":{"type":"number","format":"float"}}},"EmailSection":{"type":"object","required":["type"],"properties":{"binding":{"type":"object","additionalProperties":false,"required":["path"],"description":"Product sections only. An event path (event.*) is a pure projection from the original flow trigger event at send time; product binds an object or an explicit array index; products/gallery require limit (1–50); campaign drafts require fixed products for event paths, and reusable templates may retain them for flows; no expression evaluation. A products grid may instead bind catalog.best_sellers or catalog.new_arrivals with a limit (1–50), in campaigns and flows. Nitrosend fills its items from the brand's synced Shopify catalog each time the email's content is saved (best sellers rank paid orders from the last 30 days and top up with new arrivals; only active products with a link); nothing is looked up at send time. Flow emails also refresh once a day under the account's agent rules (with Safe Mode on, a person publishes the refresh), except flows with an A/B split, which keep the products from their last save, and flows with a change waiting to be published, which refresh again once it is published or replaced. Bound grids/galleries are top-level. Empty event arrays render nothing. A catalog grid with no products to show saves empty, and publishing or sending the email is refused until the email is edited and saved again with products in the catalog, or the binding is removed for fixed items; the daily refresh never empties a grid and keeps its current products instead. Missing names/actual links and unsafe values fail validation.","properties":{"path":{"type":"string","pattern":"^(?:event(?:\\.[a-zA-Z_][a-zA-Z0-9_]*)+|catalog\\.(?:best_sellers|new_arrivals))$"},"index":{"type":"integer","minimum":0,"maximum":49},"limit":{"type":"integer","minimum":1,"maximum":50}}},"block":{"type":"object","additionalProperties":false,"required":["template_id"],"description":"Top-level sections only. Links the section to a block, a library template (flow_id null) of the same brand. Each save writes the block's current sections in its place, each carrying this link and the key naming that occurrence; a link without a key is given one. Editing the block re-saves every email linking it, and live flows publish the change under the account's agent rules (with Safe Mode on, a person publishes it). A flow with a change waiting to be published or an A/B split gets the change in its draft instead, and a campaign changes only while it is an unapproved draft. Changes sent in linked sections are written over (a block with no sections leaves them as sent); to change one email's copy on its own, remove block from its sections. A link to anything else is dropped and its sections are kept; library templates keep no links.","properties":{"template_id":{"type":"integer","minimum":1},"key":{"type":"string","pattern":"^[0-9a-f]{8}$"}}},"type":{"type":"string","enum":["header","hero","text","image","button","columns","product","products","gallery","social","divider","spacer","footer"]},"props":{"type":"object","additionalProperties":true,"description":"Section-specific properties (see email component spec)"},"styles":{"type":"object","additionalProperties":false,"properties":{"background_color":{"type":"string"},"section_background_color":{"type":"string"},"padding":{"type":"string"},"align":{"type":"string","enum":["left","center","right"]},"scale":{"type":"string","enum":["display","poster"]},"font_size":{"type":"integer"},"text_color":{"type":"string"},"shape":{"type":"string","enum":["square","rounded","arch","circle"]},"remove_gap":{"type":"boolean"},"border_radius":{"type":"integer"}}}}},"EmailComponentSpec":{"type":"object","description":"Full schema for email design sections. Each component has type,\ndescription, props (with types, required flags, defaults), and tips.\n","required":["version","components","style_attributes","preview_document","variables","filters","theme_attributes","design_guidelines","renderer_version"],"additionalProperties":false,"properties":{"version":{"type":"integer"},"design_guidelines":{"type":"string"},"renderer_version":{"type":"string","description":"The @nitrosend/email-renderer version sent email is rendered with. The editor checks its own renderer against it."},"components":{"type":"array","items":{"type":"object","required":["type","description","props"],"additionalProperties":false,"properties":{"type":{"type":"string"},"description":{"type":"string"},"tips":{"type":"array","items":{"type":"string"}},"props":{"type":"object","additionalProperties":{"type":"object","required":["type"],"additionalProperties":false,"properties":{"type":{"type":"string"},"required":{"type":"boolean"},"default":{},"description":{"type":"string"},"enum":{"type":"array","items":{"type":"string"}},"items":{"type":"object","additionalProperties":{"type":"object","required":["type","description"],"additionalProperties":false,"properties":{"type":{"type":"string"},"description":{"type":"string"}}}},"server_owned":{"type":"boolean"},"unset_when_empty":{"type":"boolean","description":"An empty value is allowed in a draft; delivery leaves the section out."},"theme_key":{"type":"string"}}}}}}},"style_attributes":{"type":"array","description":"Standard per-section style attribute registry.","items":{"type":"object","required":["key","label","type","target","applies_to","description"],"additionalProperties":false,"properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["color","spacing","enum","number","boolean"]},"applies_to":{},"default":{},"theme_fallback":{"type":"string"},"description":{"type":"string"},"min":{"type":"integer"},"max":{"type":"integer"},"values":{"type":"array","items":{"type":"string"}},"target":{"type":"object","required":["el"],"additionalProperties":false,"properties":{"el":{"type":"string","enum":["section","content","shape"]},"attr":{"type":"string"}}}}}},"preview_document":{"type":"object","required":["parameter","description","example"],"additionalProperties":false,"properties":{"parameter":{"type":"string"},"description":{"type":"string"},"example":{"type":"object","additionalProperties":true}}},"variables":{"type":"object","description":"Merge variables grouped by source namespace.","additionalProperties":{"type":"array","items":{"type":"object","required":["name","description"],"properties":{"name":{"type":"string"},"description":{"type":"string"}},"additionalProperties":false}}},"filters":{"type":"array","items":{"type":"object","required":["name","syntax","description"],"additionalProperties":false,"properties":{"name":{"type":"string"},"syntax":{"type":"string"},"description":{"type":"string"}}}},"theme_attributes":{"type":"array","description":"Brand Kit theme attribute registry (single source of truth for the editor).","items":{"type":"object","required":["key","label","type","category","surfaces"],"additionalProperties":false,"properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["color","font","number","enum","spacing","string","image","array"]},"default":{},"category":{"type":"string","enum":["color","font","visual_identity","identity"]},"slot":{"type":"string"},"surfaces":{"type":"array","items":{"type":"string"}},"min":{"type":"integer"},"max":{"type":"integer"},"values":{"type":"array","items":{"type":"string"}},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"}}}},"transform_table":{"type":"object","additionalProperties":{"type":"string"}},"column":{"type":"boolean"},"storage":{"type":"string"},"placeholder":{"type":"string"},"value_resolver":{"type":"string"},"server_owned":{"type":"boolean"},"description":{"type":"string"}}}}}},"FlowSpec":{"type":"object","description":"Schema for flow step types, trigger events, and segment filter names.\nEach trigger's variables.filters declares current-event attribute filters\navailable only in that trigger's flow splits. Use the normal attribute\nshape, for example name: event.plan_pitch_allowed, predicate: true,\nvalue: true. Top-level filters remain ordinary audience/history filters.\nNote: the raw response includes internal fields (icon, visible, inputs,\noutputs, alias) used by the flow editor UI — these can be ignored by\nAPI consumers.\n","properties":{"filters":{"type":"object","additionalProperties":{"type":"object","properties":{"title":{"type":"string"},"group":{"type":"string"},"alias":{"type":"string","description":"Internal field binding."},"summary":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","enum","list","event"]},"predicates":{"type":"array","items":{"type":"string"}},"enum_values":{"type":"array","items":{"type":"string"}},"event_name_source":{"type":"string"},"recency_options":{"type":"array","items":{"type":"string"}},"sort_key":{"type":"string","description":"Optional contacts index sort key backed by this filter."},"sort_column":{"type":"string","description":"Internal SQL column used for server-side sorting."}}}},"triggers":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"event":{"type":"string"},"description":{"type":"string","description":"What fires the trigger."},"variables":{"type":"object","properties":{"paths":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","description":"Declared event payload path."},"type":{"type":"string","enum":["string","integer","number","boolean","object","array"]}}}},"filters":{"$ref":"#/components/schemas/FlowSpec/properties/filters"}}}}}},"filter_limits":{"type":"object","description":"Limits every filter tree is held to on save. A tree past either limit is refused with invalid_filter.","properties":{"max_depth":{"type":"integer","description":"The deepest level a node may sit at. An explicit root group ({ op, conditions })\nis level 0 and its conditions level 1; each nested group or NOT adds one level.\nA legacy bare-array root puts its items at level 0.\n"},"max_conditions_per_group":{"type":"integer","description":"The most conditions one group may hold."}}},"steps":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"summary":{"type":"string"},"params":{"type":"object","additionalProperties":{"type":"object","properties":{"label":{"type":"string"},"type":{"type":"string"},"required":{"type":"boolean"},"default":{},"description":{"type":"string"}}}}}}}}}}},"x-nitrosend-chat-channel":{"version":2,"description":"Private authenticated ActionCable ChatChannel. The browser submits a new prompt, never conversation history. Server transcripts are authoritative. Execution commands are scoped to the originating user, account and brand. Old clients must reload.","commands":{"send_message":{"required":["prompt","execution_id"],"properties":{"prompt":{"type":"string","maxLength":16000},"execution_id":{"type":"string","format":"uuid","description":"Stable for retries of the same submission."},"session_id":{"type":"integer"},"page_context":{"type":"object","description":"Allowlisted page and entity ID; server verifies brand ownership. Inbox conversation context survives the assistant handoff.","properties":{"page":{"type":"string"},"entity_type":{"type":"string","enum":["campaign","flow","template","contact","conversation"]},"entity_id":{"type":"integer","minimum":1}}}}},"approve_tool":{"required":["execution_id","tool_use_id","approval_token"]},"reject_tool":{"required":["execution_id","tool_use_id","approval_token"]},"cancel_turn":{"required":["execution_id"]},"resume":{"description":"Provide execution_id or session_id to restore a server snapshot."}},"events":{"execution_snapshot":{"required":["execution_id","chat_session_id","revision","status","messages","tool_calls","assistant_message_id"],"status":["queued","running","awaiting_approval","cancelling","completed","cancelled","failed","needs_readback"],"properties":{"assistant_message_id":{"type":["integer","null"],"description":"The reply id stored on the turn; null while none is stored. It can name a reply outside the 50 messages sent, which is then not among them."}},"description":"Replaces local display state. All execution events carry an execution_id and revision; older events must be ignored."}}}}