{"openapi":"3.1.0","info":{"title":"Mailly API","version":"1.0.0","description":"Mailly email API: verification codes, billing, transactional and marketing sending, inboxes, contacts, audiences, workflows, and templates. All endpoints use Bearer API key authentication unless marked security: [] (public)."},"security":[{"bearerAuth":[]}],"tags":[{"name":"public","description":"Public endpoints (no API key; some use a separate secret or signed token)"},{"name":"verification","description":"Send and verify verification codes"},{"name":"billing","description":"Balance, charges, and usage logs"},{"name":"sending","description":"Sending and sent mail"},{"name":"domains","description":"Sender domains and DNS setup"},{"name":"inbox","description":"Inbound mail and threads"},{"name":"campaigns","description":"Marketing campaigns"},{"name":"contacts","description":"Contacts and suppression"},{"name":"audiences","description":"Static audiences and dynamic segments"},{"name":"workflows","description":"Lifecycle workflows and events"},{"name":"templates","description":"Email templates"},{"name":"delivery","description":"Delivery events and webhooks"},{"name":"governance","description":"Unsubscribe, preferences, and suppression"},{"name":"agents","description":"Inbox agent conversations"},{"name":"admin","description":"Admin endpoints (admin role required)"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Mailly API key\uff08Authorization: Bearer <key>\uff09"}},"schemas":{},"parameters":{}},"paths":{"\/verify-code-login":{"post":{"tags":["public"],"security":[],"summary":"Sign in with a verification code","description":"Signs in with an email verification code and sets the Better Auth session cookie on success (new users are registered automatically).","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"email":{"type":"string","description":"Sign-in email"},"code":{"type":"string","description":"Verification code"}},"additionalProperties":{},"required":["email","code"]}}}},"responses":{"200":{"description":"Signed in (session set via Set-Cookie)","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"],"additionalProperties":{}}}}},"400":{"description":"Invalid request body or code mismatch","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Account is disabled","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Code not found or expired","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Too many verification attempts","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/cli\/auth\/init":{"post":{"tags":["public"],"security":[],"summary":"Start CLI device authorization","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"deviceToken":{"type":"string","description":"32-128 character hexadecimal token generated by the CLI"}},"additionalProperties":{},"required":["deviceToken"]}}}},"responses":{"200":{"description":"Registered, awaiting authorization","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deviceToken":{"type":"string"},"expiresIn":{"type":"number"},"interval":{"type":"number"}},"required":["success","deviceToken","expiresIn","interval"],"additionalProperties":{}}}}},"400":{"description":"Invalid deviceToken","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"deviceToken already used","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/cli\/auth\/poll":{"post":{"tags":["public"],"security":[],"summary":"Poll CLI authorization status","description":"Returns 202 while pending; when approved, returns apiKey and deletes the KV record once; returns 410 when expired.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"deviceToken":{"type":"string","description":"32-128 character hexadecimal token generated by the CLI"}},"additionalProperties":{},"required":["deviceToken"]}}}},"responses":{"200":{"description":"Approved (returns apiKey)","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"status":{"type":"string"},"apiKey":{"type":"string"},"email":{"type":"string"},"error":{"type":"string"}},"required":["success"],"additionalProperties":{}}}}},"202":{"description":"Waiting for user authorization","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"status":{"type":"string"},"apiKey":{"type":"string"},"email":{"type":"string"},"error":{"type":"string"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid deviceToken","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"status":{"type":"string"},"apiKey":{"type":"string"},"email":{"type":"string"},"error":{"type":"string"}},"required":["success"],"additionalProperties":{}}}}},"410":{"description":"Authorization request not found or expired","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"status":{"type":"string"},"apiKey":{"type":"string"},"email":{"type":"string"},"error":{"type":"string"}},"required":["success"],"additionalProperties":{}}}}}}}},"\/cli\/auth\/approve":{"post":{"tags":["public"],"security":[],"summary":"Approve CLI authorization from the web app","description":"Requires a Better Auth session cookie (not an API key).","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"deviceToken":{"type":"string","description":"32-128 character hexadecimal token generated by the CLI"}},"required":["deviceToken"],"additionalProperties":{}}}}},"responses":{"200":{"description":"Approved","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"email":{"type":"string"}},"required":["success","email"],"additionalProperties":{}}}}},"400":{"description":"Invalid request body or deviceToken","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Not signed in","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Your email address is not verified yet","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"This authorization request was already handled","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"410":{"description":"Authorization request not found or expired","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"This account does not have an API key yet","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/onboarding\/start":{"post":{"tags":["public"],"security":[],"summary":"Reserve a chosen inbox name before account registration or sign-in","description":"Shared by agents and the web page. Reserve name@mailly.site for 30 minutes. No account, receiving mailbox or mail access is created. Return 409 name_taken if registered or reserved. Give the verification URL to the human and keep the setup token private.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64}},"required":["name"],"additionalProperties":false}}}},"responses":{"200":{"description":"Give verification_url to the human; keep setup_token secret","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"request_id":{"type":"string"},"address":{"type":"string"},"verification_url":{"type":"string"},"status_url":{"type":"string"},"setup_token":{"type":"string"},"expires_in":{"type":"number"},"interval":{"type":"number"}},"required":["success","request_id","address","verification_url","status_url","setup_token","expires_in","interval"],"additionalProperties":{}}}}},"202":{"description":"Waiting for human approval","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Authentication required","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Not allowed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Address unavailable or request already handled","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"410":{"description":"Request expired","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Too many requests","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Temporarily unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/onboarding\/availability":{"get":{"tags":["public"],"security":[],"summary":"Check whether a name on the platform domain looks free","description":"Advisory check for the web page; it reserves nothing. Agents should call \/start directly and handle 409 name_taken.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"name","in":"query"}],"responses":{"200":{"description":"Whether the name can currently be reserved","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"available":{"type":"boolean"},"code":{"type":"string","enum":["invalid","short","reserved","taken"]}},"required":["success","name","address","available"],"additionalProperties":{}}}}},"202":{"description":"Waiting for human approval","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Authentication required","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Not allowed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Address unavailable or request already handled","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"410":{"description":"Request expired","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Too many requests","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Temporarily unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/onboarding\/{id}\/status":{"get":{"tags":["public"],"security":[],"summary":"Resume setup with its private setup token","description":"Authorization: Bearer <setup_token> only permits checking this setup. 202 before human confirmation; 200 ready returns the mailbox address and the account API key the human approved handing to the agent. Store the key in secure credential storage and never show it in chat or logs. Ready status can be retried for 10 minutes after confirmation.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Ready (with the API key) or denied","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"status":{"type":"string","enum":["ready","denied"]},"address":{"type":"object","properties":{"id":{"type":"string"},"address":{"type":"string"}},"required":["id","address"]},"api_key":{"type":"string"},"hint":{"type":"string"}},"required":["success","status"],"additionalProperties":{}}}}},"202":{"description":"Waiting for human approval","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Authentication required","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Not allowed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Address unavailable or request already handled","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"410":{"description":"Request expired","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Too many requests","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Temporarily unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/onboarding\/{id}":{"get":{"tags":["public"],"security":[],"summary":"Read the human setup page state","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Request state or completed operation","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"202":{"description":"Waiting for human approval","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Authentication required","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Not allowed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Address unavailable or request already handled","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"410":{"description":"Request expired","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Too many requests","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Temporarily unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/onboarding\/{id}\/email":{"post":{"tags":["public"],"security":[],"summary":"Email the human a setup verification link","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":254,"format":"email"}},"required":["email"]}}}},"responses":{"200":{"description":"Request state or completed operation","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"202":{"description":"Waiting for human approval","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Authentication required","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Not allowed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Address unavailable or request already handled","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"410":{"description":"Request expired","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Too many requests","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Temporarily unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/onboarding\/{id}\/verify":{"post":{"tags":["public"],"security":[],"summary":"Verify the emailed link without granting agent access","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":16,"maxLength":512}},"required":["token"]}}}},"responses":{"200":{"description":"Request state or completed operation","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"202":{"description":"Waiting for human approval","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Authentication required","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Not allowed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Address unavailable or request already handled","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"410":{"description":"Request expired","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Too many requests","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Temporarily unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/onboarding\/{id}\/decision":{"post":{"tags":["public"],"security":[],"summary":"Human confirmation: prepare an inbox without granting agent access","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"decision":{"type":"string","enum":["approve","deny"]},"confirmed":{"type":"boolean","enum":[true]}},"required":["decision","confirmed"],"additionalProperties":false}}}},"responses":{"200":{"description":"Request state or completed operation","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"202":{"description":"Waiting for human approval","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Authentication required","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Not allowed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Address unavailable or request already handled","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"410":{"description":"Request expired","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Too many requests","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Temporarily unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/draft-review\/view":{"get":{"tags":["public"],"security":[],"summary":"Read the draft a review link points to","description":"Authorization: Bearer <token from the review_url fragment>. Read-only: shows sender, recipients, subject and body of that one draft version. Sending and discarding need POST from the review page.","responses":{"200":{"description":"Draft to review","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"status":{"type":"string","enum":["pending","sending","failed"]},"revision":{"type":"number"},"from":{"type":"string"},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string"},"text":{"type":"string"},"expires_at":{"type":"number"},"can_discard":{"type":"boolean"}},"required":["success","status","revision","from","to","cc","subject","text","expires_at","can_discard"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing review token","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"402":{"description":"Not enough balance to send","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Not allowed from this page, or the account cannot send","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Unknown review link","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"The draft cannot be sent as shown","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"410":{"description":"The link expired or the draft was sent, discarded or edited","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Too many requests or a sending limit was reached","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"Sending failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Result unconfirmed; retrying is safe","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/draft-review\/send":{"post":{"tags":["public"],"security":[],"summary":"Send the reviewed draft","description":"Same approval as POST \/mail-drafts\/{id}\/approve for the exact version shown. Retrying after an unconfirmed result is safe and never sends twice.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0}},"required":["revision"],"additionalProperties":false}}}},"responses":{"200":{"description":"Draft to review, or the completed action","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing review token","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"402":{"description":"Not enough balance to send","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Not allowed from this page, or the account cannot send","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Unknown review link","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"The draft cannot be sent as shown","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"410":{"description":"The link expired or the draft was sent, discarded or edited","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Too many requests or a sending limit was reached","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"Sending failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Result unconfirmed; retrying is safe","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/draft-review\/discard":{"post":{"tags":["public"],"security":[],"summary":"Discard the reviewed draft without sending","description":"Same as POST \/mail-drafts\/{id}\/discard for the exact version shown.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0}},"required":["revision"],"additionalProperties":false}}}},"responses":{"200":{"description":"Draft to review, or the completed action","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing review token","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"402":{"description":"Not enough balance to send","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Not allowed from this page, or the account cannot send","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Unknown review link","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"The draft cannot be sent as shown","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"410":{"description":"The link expired or the draft was sent, discarded or edited","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Too many requests or a sending limit was reached","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"Sending failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Result unconfirmed; retrying is safe","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/unsubscribe":{"get":{"tags":["public"],"security":[],"summary":"Hosted unsubscribe confirmation page","description":"Landing page for the unsubscribe link in email footers; renders a confirmation form.","parameters":[{"schema":{"type":"string","description":"Signed unsubscribe token"},"required":true,"description":"Signed unsubscribe token","name":"token","in":"query"}],"responses":{"200":{"description":"Unsubscribe confirmation page","content":{"text\/html":{"schema":{"type":"string"}}}},"400":{"description":"Link is invalid or expired","content":{"text\/html":{"schema":{"type":"string"}}}}}},"post":{"tags":["public"],"security":[],"summary":"Unsubscribe (including RFC 8058 one-click)","description":"Accepts `token` (JSON body, form field, or query). On success, adds a suppression and records an unsubscribed delivery event.","responses":{"200":{"description":"Unsubscribe success page","content":{"text\/html":{"schema":{"type":"string"}}}},"400":{"description":"Link is invalid or expired","content":{"text\/html":{"schema":{"type":"string"}}}}}}},"\/provider-events\/ses":{"post":{"tags":["public"],"security":[],"summary":"AWS SNS\/SES delivery event endpoint","description":"Authenticated with a dedicated secret (`x-mailly-provider-secret` header or `?token=`); handles SNS SubscriptionConfirmation and SES delivery and unsubscribe events.","parameters":[{"schema":{"type":"string"},"required":false,"name":"token","in":"query"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"Type":{"type":"string"}},"additionalProperties":{},"description":"AWS SNS envelope"}},"text\/plain":{"schema":{"type":"string","description":"AWS SNS envelope (JSON text, as sent by SNS)"}}}},"responses":{"200":{"description":"Event processed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"matched":{"type":"number"},"duplicates":{"type":"number"},"confirmed":{"type":"boolean"},"ignored":{"type":"boolean"},"reason":{"type":"string"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid payload","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Provider secret mismatch","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"SNS confirmation request failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Not configured, or the event cannot be processed yet (retry later)","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbound-email\/validate":{"post":{"tags":["public"],"security":[],"summary":"Check whether a recipient address is assigned","description":"Called at the RCPT TO stage; authenticated with the `x-mailly-inbound-secret` header.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"address":{"type":"string","description":"Recipient address to check"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Check result","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"accepted":{"type":"boolean","description":"Whether a matching inbox exists"}},"required":["success","accepted"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Inbound secret mismatch","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Ingestion is not configured","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbound-email\/ingest":{"post":{"tags":["public"],"security":[],"summary":"Store an inbound email (raw MIME)","description":"Submitted at the DATA stage. `authentication` is the authentication metadata produced by the upstream SMTP service (sourceIp\/helo\/spf\/dkim\/dmarc\/policy\/results); missing or invalid metadata returns 503 so the upstream retries.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"from":{"type":"string","description":"Envelope sender"},"to":{"type":"array","items":{"type":"string"},"description":"RCPT TO recipient list"},"rawBase64":{"type":"string","description":"Full MIME message, base64-encoded"},"authentication":{"description":"SMTP authentication metadata"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Ingestion result","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"stored":{"type":"number","description":"Number of newly stored recipients"},"duplicates":{"type":"number","description":"Number of recipients skipped as duplicates or races"}},"required":["success","stored","duplicates"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Inbound secret mismatch","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"No matching inbox","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"413":{"description":"Email exceeds 10 MiB","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Not configured, or authentication metadata is missing or temporarily unavailable (the upstream should retry)","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/billing\/catalog":{"get":{"tags":["billing"],"summary":"Get USD balance top-up rules","security":[],"responses":{"200":{"description":"Public top-up packs and availability","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"enabled":{"type":"boolean"},"custom_topup":{"type":"object","properties":{"currency":{"type":"string","enum":["usd"]},"min_amount":{"type":"integer"},"max_amount":{"type":"integer"},"step":{"type":"integer"}},"required":["currency","min_amount","max_amount","step"]},"packs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"credits":{"type":"integer"},"amount":{"type":"integer"},"currency":{"type":"string"},"kind":{"type":"string","enum":["credits","usage"]}},"required":["id","name","credits","amount","currency","kind"]}}},"required":["success","enabled","custom_topup","packs"],"additionalProperties":{}}}}},"503":{"description":"Top-up configuration unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/billing\/checkout":{"post":{"tags":["billing"],"summary":"Create a custom-amount USD top-up order (amount in cents, minimum 500)","parameters":[{"schema":{"type":"string","pattern":"^[a-zA-Z0-9_-]{16,100}$"},"required":true,"name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"anyOf":[{"type":"object","properties":{"amount":{"type":"integer","minimum":500,"maximum":100000}},"required":["amount"],"additionalProperties":false},{"type":"object","properties":{"pack_id":{"type":"string","minLength":1,"maxLength":40}},"required":["pack_id"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Stripe Checkout URL","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"id":{"type":"string"},"url":{"type":"string"}},"required":["success","id","url"],"additionalProperties":{}}}}},"400":{"description":"Invalid top-up amount","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Top-up request conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Top-ups unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/billing\/purchases":{"get":{"tags":["billing"],"summary":"List the 50 most recent top-ups for the current account","responses":{"200":{"description":"Top-up history","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"purchases":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pack_name":{"type":"string"},"credits":{"type":"integer"},"amount":{"type":"integer"},"currency":{"type":"string"},"kind":{"type":"string","enum":["credits","usage"]},"status":{"type":"string","enum":["pending","paid","expired","failed"]},"created_at":{"type":"integer"},"paid_at":{"type":["integer","null"]}},"required":["id","pack_name","credits","amount","currency","kind","status","created_at","paid_at"]}}},"required":["success","purchases"],"additionalProperties":{}}}}}}}},"\/billing\/purchases\/{id}\/reconcile":{"post":{"tags":["billing"],"summary":"Check the payment status of the current account with Stripe","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Top-up status after the check","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"purchase":{"type":"object","properties":{"id":{"type":"string"},"pack_name":{"type":"string"},"credits":{"type":"integer"},"amount":{"type":"integer"},"currency":{"type":"string"},"kind":{"type":"string","enum":["credits","usage"]},"status":{"type":"string","enum":["pending","paid","expired","failed"]},"created_at":{"type":"integer"},"paid_at":{"type":["integer","null"]}},"required":["id","pack_name","credits","amount","currency","kind","status","created_at","paid_at"]}},"required":["success","purchase"],"additionalProperties":{}}}}},"404":{"description":"Top-up not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Unable to check the payment right now","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/billing\/purchases\/{id}":{"get":{"tags":["billing"],"summary":"Get the top-up status for the current account","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Top-up status","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"purchase":{"type":"object","properties":{"id":{"type":"string"},"pack_name":{"type":"string"},"credits":{"type":"integer"},"amount":{"type":"integer"},"currency":{"type":"string"},"kind":{"type":"string","enum":["credits","usage"]},"status":{"type":"string","enum":["pending","paid","expired","failed"]},"created_at":{"type":"integer"},"paid_at":{"type":["integer","null"]}},"required":["id","pack_name","credits","amount","currency","kind","status","created_at","paid_at"]}},"required":["success","purchase"],"additionalProperties":{}}}}},"404":{"description":"Top-up not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/billing\/entitlements":{"get":{"tags":["billing"],"summary":"View the current plan, usage this period, and shared balance","responses":{"200":{"description":"Plan and usage","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"entitlements":{"type":"object","properties":{"plan":{"type":["object","null"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"source":{"type":"string","enum":["subscription","free","grant","enterprise"]},"price_usd":{"type":"number"},"billing_interval":{"type":"string","enum":["month","year"]},"status":{"type":"string"},"period_start":{"type":"integer"},"period_end":{"type":"integer"},"subscription_period_end":{"type":"integer"},"cancel_at_period_end":{"type":"boolean"}},"required":["id","name","source","price_usd","billing_interval","status","period_start","period_end","subscription_period_end","cancel_at_period_end"]},"emails":{"type":["object","null"],"properties":{"used":{"type":"integer"},"quota":{"type":"integer"}},"required":["used","quota"]},"mailboxes":{"type":"object","properties":{"used":{"type":"integer"},"limit":{"type":"integer"}},"required":["used","limit"]},"custom_domains":{"type":"object","properties":{"used":{"type":"integer"},"limit":{"type":"integer"}},"required":["used","limit"]},"usage":{"type":"object","properties":{"currency":{"type":"string","enum":["USD"]},"prepaid_nano":{"type":"integer"},"email_price_nano":{"type":"integer"},"email_overage_nano":{"type":"integer"},"allowance":{"type":["object","null"],"properties":{"quota_nano":{"type":"integer"},"remaining_nano":{"type":"integer"},"period_end":{"type":"integer"}},"required":["quota_nano","remaining_nano","period_end"]}},"required":["currency","prepaid_nano","email_price_nano","email_overage_nano","allowance"]},"model":{"type":"object","properties":{"billing_enforced":{"type":"boolean"},"period_start":{"type":"integer"},"period_cost_nano":{"type":"integer"},"period_charged_nano":{"type":"integer"},"period_translation_cost_nano":{"type":"integer","description":"Part of period_cost_nano spent on email translation"},"executions":{"type":"object","properties":{"used":{"type":"integer"}},"required":["used"]}},"required":["billing_enforced","period_start","period_cost_nano","period_charged_nano","period_translation_cost_nano","executions"]}},"required":["plan","emails","mailboxes","custom_domains","usage","model"]},"plans":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"mailboxes":{"type":"integer"},"custom_domains":{"type":"integer"},"monthly_emails":{"type":"integer"},"daily_recipients":{"type":["integer","null"]},"price_usd":{"type":"number"},"billing_interval":{"type":"string","enum":["month","year"]},"usage_allowance_nano":{"type":"integer"},"available":{"type":"boolean"}},"required":["id","name","mailboxes","custom_domains","monthly_emails","daily_recipients","price_usd","billing_interval","usage_allowance_nano","available"]}},"sending":{"type":"object","properties":{"status":{"type":"string","enum":["active","paused"],"description":"When paused, all customer sends are rejected with workspace_sending_paused"},"reason":{"type":["string","null"],"enum":["auto_bounce","auto_complaint","manual",null]},"paused_at":{"type":["string","null"]},"daily_limit":{"type":["object","null"],"properties":{"limit":{"type":"integer"},"used":{"type":"integer"},"remaining":{"type":"integer"},"window_hours":{"type":"number","enum":[24]},"source":{"type":"string","enum":["new_workspace","override","free_plan"]},"applies_until":{"type":["string","null"]}},"required":["limit","used","remaining","window_hours","source","applies_until"],"description":"Rolling 24h recipient limit; sends over it are rejected with workspace_daily_limit_exceeded and not charged"}},"required":["status","reason","paused_at","daily_limit"]}},"required":["success","entitlements","plans"],"additionalProperties":{}}}}}}}},"\/billing\/subscription\/checkout":{"post":{"tags":["billing"],"summary":"Create a plan subscription Checkout","parameters":[{"schema":{"type":"string","pattern":"^[a-zA-Z0-9_-]{16,100}$"},"required":true,"name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"plan_id":{"type":"string","minLength":1,"maxLength":40}},"required":["plan_id"]}}}},"responses":{"200":{"description":"Stripe Checkout URL","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"id":{"type":"string"},"url":{"type":"string"}},"required":["success","id","url"],"additionalProperties":{}}}}},"409":{"description":"Subscription request conflict or already subscribed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Subscriptions unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/billing\/subscription\/checkouts\/{id}\/reconcile":{"post":{"tags":["billing"],"summary":"Check the subscription payment of the current account with Stripe","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Subscription Checkout status after the check","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"checkout":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","complete","expired"]}},"required":["id","status"]}},"required":["success","checkout"],"additionalProperties":{}}}}},"404":{"description":"Subscription request not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Unable to check right now","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/billing\/subscription\/portal":{"post":{"tags":["billing"],"summary":"Open Stripe billing management (cancel, change card, invoices)","responses":{"200":{"description":"Billing management URL","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"url":{"type":"string"}},"required":["success","url"],"additionalProperties":{}}}}},"404":{"description":"No subscription yet","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Billing management unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/send-code":{"post":{"tags":["verification"],"summary":"Send a verification code","description":"Sends a 6-digit verification code (valid for 5 minutes) to the given email; counts as 1 email of usage.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"email":{"type":"string","description":"Recipient email"}},"additionalProperties":{},"required":["email"]}}}},"responses":{"200":{"description":"Verification code sent","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"],"additionalProperties":{}}}}},"400":{"description":"Invalid request body or email format","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"402":{"description":"Insufficient balance","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Workspace sending is paused (workspace_sending_paused)","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Rolling 24h recipient limit","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Send failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/verify-code":{"post":{"tags":["verification"],"summary":"Verify a code","description":"Verifies an email verification code; no extra charge.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"email":{"type":"string","description":"Email to verify"},"code":{"type":"string","description":"6-digit verification code"}},"additionalProperties":{},"required":["email","code"]}}}},"responses":{"200":{"description":"Verified","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"],"additionalProperties":{}}}}},"400":{"description":"Invalid request body or code mismatch","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Code not found or expired","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Verification failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/balance":{"get":{"tags":["billing"],"summary":"Get balance","responses":{"200":{"description":"USD balance and sending status","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"balance":{"type":"number","description":"Available balance in USD (allowance plus top-ups)"},"currency":{"type":"string","enum":["USD"]},"prepaid_nano":{"type":"integer"},"allowance_nano":{"type":"integer"},"included_emails_remaining":{"type":"integer"},"sending":{"type":"object","properties":{"status":{"type":"string","enum":["active","paused"],"description":"When paused, all customer sends are rejected with workspace_sending_paused"},"reason":{"type":["string","null"],"enum":["auto_bounce","auto_complaint","manual",null]},"paused_at":{"type":["string","null"]},"daily_limit":{"type":["object","null"],"properties":{"limit":{"type":"integer"},"used":{"type":"integer"},"remaining":{"type":"integer"},"window_hours":{"type":"number","enum":[24]},"source":{"type":"string","enum":["new_workspace","override","free_plan"]},"applies_until":{"type":["string","null"]}},"required":["limit","used","remaining","window_hours","source","applies_until"],"description":"Rolling 24h recipient limit; sends over it are rejected with workspace_daily_limit_exceeded and not charged"}},"required":["status","reason","paused_at","daily_limit"]}},"required":["success","balance","currency","prepaid_nano","allowance_nano","included_emails_remaining"],"additionalProperties":{}}}}},"500":{"description":"Missing authentication context","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/me":{"get":{"tags":["account"],"summary":"Get the authenticated identity","description":"Returns the account email, the credential type and the scopes it carries. API keys carry every scope.","responses":{"200":{"description":"Authenticated identity","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"email":{"type":"string"},"credential_type":{"type":"string","enum":["api_key","oauth"]},"scopes":{"type":"array","items":{"type":"string"}},"client_id":{"type":["string","null"]}},"required":["success","email","credential_type","scopes","client_id"],"additionalProperties":{}}}}},"401":{"description":"Invalid credential","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/logs":{"get":{"tags":["billing"],"summary":"List usage logs","parameters":[{"schema":{"type":"string","description":"Page size, default 50, max 100"},"required":false,"description":"Page size, default 50, max 100","name":"limit","in":"query"},{"schema":{"type":"string","description":"Offset, default 0"},"required":false,"description":"Offset, default 0","name":"offset","in":"query"}],"responses":{"200":{"description":"Usage logs","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"logs":{"type":"array","items":{"type":"object","properties":{"log_id":{"type":"string"},"timestamp":{"type":"string"},"amount_deducted":{"type":"number"},"caller_email":{"type":"string"},"target_email":{"type":["string","null"]},"from_email":{"type":["string","null"]},"subject":{"type":["string","null"]},"send_mode":{"type":["string","null"]},"recipient_count":{"type":["number","null"]},"task_id":{"type":["string","null"]}},"additionalProperties":{}}},"limit":{"type":"number"},"offset":{"type":"number"}},"required":["success","logs","limit","offset"],"additionalProperties":{}}}}},"500":{"description":"Failed to list logs","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/logs\/download":{"get":{"tags":["billing"],"summary":"Download usage logs as CSV","responses":{"200":{"description":"CSV file download","content":{"text\/csv":{"schema":{"type":"string"}}}},"401":{"description":"Unauthenticated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Failed to generate the download","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/send-email":{"post":{"tags":["sending"],"summary":"Send email (transactional or marketing)","description":"Applies governance, then passes through to the queue service; supports single, batch, audience, campaign, scheduled, and template-variable sends. Billed per recipient.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"to":{"anyOf":[{"type":"string"},{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"object","properties":{"email":{"type":"string"},"externalId":{"description":"Business-side contact ID; overrides the external_id of an existing contact","type":"string"}},"required":["email"]}]}}],"description":"Recipients: an email, an array of emails, or an array of {email, externalId} objects; use exactly one of this, audience, or campaignKey"},"audience":{"type":"object","properties":{},"additionalProperties":{},"description":"Audience filter {include, exclude}"},"campaignKey":{"type":"string","description":"Campaign key that uses a frozen audience"},"campaignName":{"type":"string"},"subject":{"type":"string","description":"Email subject"},"html":{"type":"string","description":"HTML body"},"text":{"type":"string","description":"Plain-text body"},"fromEmail":{"type":"string","description":"From address (must be on a verified sending domain)"},"fromName":{"type":"string"},"replyTo":{"type":"string"},"cc":{"type":"string"},"bcc":{"type":"string"},"topic":{"type":"string","description":"Unsubscribe and frequency-cap topic"},"emailType":{"type":"string","enum":["transactional","lifecycle","marketing"]},"dryRun":{"type":"boolean","description":"Validate only, do not deliver"},"testSend":{"type":"boolean"},"scheduledAt":{"type":"number","description":"Scheduled send time in Unix seconds"},"frequencyCapDays":{"type":"number"},"frequencyCapMax":{"type":"number"},"topicExclusionDays":{"type":"number"},"recipientReason":{"type":"string"},"templateKey":{"type":"string"},"templateVersion":{"type":"number"},"sourceApp":{"type":"string"},"businessGoal":{"type":"string"},"utm":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"messageId":{"type":"string"},"inReplyTo":{"type":"string"},"references":{"type":"array","items":{"type":"string"}},"attachments":{"type":"array","items":{}},"variables":{"type":"object","additionalProperties":{},"description":"Inline {{var}} template variables"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Send result (passed through from the Queue service, JSON)"},"400":{"description":"Invalid request body","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Missing authentication context or server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"Upstream sending service error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/smtp-auth":{"post":{"tags":["sending"],"summary":"Verify SMTP credentials","description":"Verifies that username is the email bound to the current API key, for SMTP sending login.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"username":{"type":"string","description":"SMTP username (email)"}},"additionalProperties":{},"required":["username"]}}}},"responses":{"200":{"description":"Authenticated","content":{"application\/json":{"schema":{"type":"object","properties":{"authenticated":{"type":"boolean"},"username":{"type":"string"},"error":{"type":"string"}},"required":["authenticated"],"additionalProperties":{}}}}},"400":{"description":"Missing a valid username","content":{"application\/json":{"schema":{"type":"object","properties":{"authenticated":{"type":"boolean"},"username":{"type":"string"},"error":{"type":"string"}},"required":["authenticated"],"additionalProperties":{}}}}},"403":{"description":"Invalid credentials","content":{"application\/json":{"schema":{"type":"object","properties":{"authenticated":{"type":"boolean"},"username":{"type":"string"},"error":{"type":"string"}},"required":["authenticated"],"additionalProperties":{}}}}}}}},"\/email-status\/{taskId}":{"get":{"tags":["sending"],"summary":"Get batch task status","description":"Passes through the batch send task status from the Queue service.","parameters":[{"schema":{"type":"string","description":"Batch task ID"},"required":true,"description":"Batch task ID","name":"taskId","in":"path"}],"responses":{"200":{"description":"Task status (passed through from the Queue service, JSON)"},"400":{"description":"Missing taskId","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"Failed to get the task status","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/sender-domains":{"get":{"tags":["domains"],"summary":"List sending domains","description":"By default returns only domains that can send (verified in this workspace plus platform default domains); `include_unverified=1` returns all statuses.","parameters":[{"schema":{"type":"string","description":"Pass 1 to return domains in every status"},"required":false,"description":"Pass 1 to return domains in every status","name":"include_unverified","in":"query"}],"responses":{"200":{"description":"Domain list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"inboundMxHost":{"type":"string"},"domains":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","inboundMxHost","domains"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Lookup failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"post":{"tags":["domains"],"summary":"Submit a custom domain request","description":"Each domain is unique across the platform; after submission it waits for ownership review, and once approved you can configure sending and receiving.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"domain":{"type":"string","description":"Domain"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Submitted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"domain":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","message","domain"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"402":{"description":"Requires a mailbox plan","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Plan domain limit reached","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Domain already exists","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Submission failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/sender-domains\/{id}\/verify-inbound":{"post":{"tags":["domains"],"summary":"Check the inbound MX configuration","description":"Checks whether the highest-priority MX of the domain points to Mailly; on success inboundStatus=verified.","parameters":[{"schema":{"type":"string","description":"Domain record ID"},"required":true,"description":"Domain record ID","name":"id","in":"path"}],"responses":{"200":{"description":"Check result","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"ready":{"type":"boolean"},"domain":{"type":"string"},"inboundStatus":{"type":"string"},"expectedMx":{"type":"object","properties":{},"additionalProperties":{}},"records":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"message":{"type":"string"}},"required":["success","ready","domain","inboundStatus","message"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Domain not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Ownership not verified","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/sender-domains\/{id}\/setup-outbound":{"post":{"tags":["domains"],"summary":"Enable the SES sending identity","description":"Creates or reuses the SES domain identity and returns the DNS records to configure (DKIM CNAME, MAIL FROM MX\/SPF).","parameters":[{"schema":{"type":"string","description":"Domain record ID"},"required":true,"description":"Domain record ID","name":"id","in":"path"}],"responses":{"200":{"description":"Sending configuration status","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"ready":{"type":"boolean"},"domain":{"type":"string"},"outboundStatus":{"type":"string"}},"required":["success","ready","domain","outboundStatus"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Domain not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Ownership not verified or rejected","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"SES upstream error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"SES service unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/sender-domains\/{id}\/verify-outbound":{"post":{"tags":["domains"],"summary":"Check the SES sending records","description":"Queries SES for the DKIM and identity verification status and stores it.","parameters":[{"schema":{"type":"string","description":"Domain record ID"},"required":true,"description":"Domain record ID","name":"id","in":"path"}],"responses":{"200":{"description":"Check result","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"ready":{"type":"boolean"},"domain":{"type":"string"},"outboundStatus":{"type":"string"}},"required":["success","ready","domain","outboundStatus"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Domain not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Ownership not verified, sending not enabled, or rejected","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"SES upstream error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"SES service unavailable","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/sender-domains\/{id}\/apply-dns":{"post":{"tags":["domains"],"summary":"Write DNS records in one click","description":"Writes the DNS records Mailly needs directly into your zone using the Cloudflare token (saved or passed in this request); idempotent, and conflicting records are not overwritten. The body is optional.","parameters":[{"schema":{"type":"string","description":"Domain record ID"},"required":true,"description":"Domain record ID","name":"id","in":"path"}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","description":"Only cloudflare is supported for now"},"scope":{"type":"string","enum":["outbound","inbound","all"],"description":"Default all"},"apiToken":{"type":"string","description":"Cloudflare token for this request (takes precedence over the saved one)"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"DNS write result","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid request or no saved token","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Domain not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Ownership not verified or record conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Write failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"SES or Cloudflare upstream error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Encryption key is not configured","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/sender-domains\/admin\/all":{"get":{"tags":["admin"],"summary":"List all domain requests (admin)","responses":{"200":{"description":"Domain list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"domains":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","domains"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Requires admin permission","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Lookup failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/sender-domains\/admin\/{id}":{"patch":{"tags":["admin"],"summary":"Review domain ownership and sending status (admin)","description":"Reviews ownershipStatus and outboundStatus independently; the legacy status field is still accepted and updates both.","parameters":[{"schema":{"type":"string","description":"Domain record ID"},"required":true,"description":"Domain record ID","name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["verified","rejected"],"description":"Legacy compatibility field; do not send together with the new fields"},"ownershipStatus":{"type":"string","enum":["verified","rejected"]},"outboundStatus":{"type":"string","enum":["not_configured","pending","verified","rejected"]}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Reviewed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"domain":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","message","domain"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Requires admin permission","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Domain record not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Status conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Review failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/dns-provider\/cloudflare":{"get":{"tags":["domains"],"summary":"Cloudflare token status","description":"Returns only a short suffix hint, never the token itself.","responses":{"200":{"description":"Token status","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"status":{"type":"object","properties":{"provider":{"type":"string"},"configured":{"type":"boolean"},"tokenHint":{"type":["string","null"]},"updatedAt":{"type":["number","null"]}},"required":["provider","configured","tokenHint","updatedAt"],"additionalProperties":{}}},"required":["success","status"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Lookup failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"put":{"tags":["domains"],"summary":"Save a Cloudflare API token","description":"Verifies the token with the official Cloudflare API before saving (needs Zone \u2192 DNS \u2192 Edit) and stores it encrypted.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"apiToken":{"type":"string","description":"Cloudflare API Token"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Token saved","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"status":{"type":"object","properties":{"provider":{"type":"string"},"configured":{"type":"boolean"},"tokenHint":{"type":["string","null"]},"updatedAt":{"type":["number","null"]}},"required":["provider","configured","tokenHint","updatedAt"],"additionalProperties":{}}},"required":["success","status"],"additionalProperties":{}}}}},"400":{"description":"Missing token or Cloudflare verification failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Save failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Encryption key is not configured","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"delete":{"tags":["domains"],"summary":"Delete the Cloudflare token","responses":{"200":{"description":"Deleted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"status":{"type":"object","properties":{"provider":{"type":"string"},"configured":{"type":"boolean"},"tokenHint":{"type":["string","null"]},"updatedAt":{"type":["number","null"]}},"required":["provider","configured","tokenHint","updatedAt"],"additionalProperties":{}}},"required":["success","status"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Delete failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/operations-overview":{"get":{"tags":["billing"],"summary":"Operations overview counts","description":"Returns workspace-level counts such as unread threads, sends, active campaigns, and available sending domains.","parameters":[{"schema":{"type":"string","description":"Non-negative Unix timestamp in seconds; counts sends after this time"},"required":true,"description":"Non-negative Unix timestamp in seconds; counts sends after this time","name":"since","in":"query"}],"responses":{"200":{"description":"Overview counts","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"stats":{"type":"object","properties":{"unreadThreads":{"type":"number"},"sendsSince":{"type":"number"},"activeCampaigns":{"type":"number"},"outboundDomains":{"type":"number"}},"required":["unreadThreads","sendsSince","activeCampaigns","outboundDomains"],"additionalProperties":{}}},"required":["success","stats"],"additionalProperties":{}}}}},"400":{"description":"since is missing or invalid","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Failed to compute counts","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/sent-messages":{"get":{"tags":["sending"],"summary":"List sent messages","description":"Scoped to the workspace; supports enum filters for source\/status\/deliveryStatus, exact or fuzzy matching (per match) for recipient\/sender\/subject, q fuzzy search across fields (bodies excluded), and since\/until to limit the send time.","parameters":[{"schema":{"type":"string","description":"Default 50, max 200"},"required":false,"description":"Default 50, max 200","name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Source: api, web, campaign, workflow, template_test, inbox_reply"},"required":false,"description":"Source: api, web, campaign, workflow, template_test, inbox_reply","name":"source","in":"query"},{"schema":{"type":"string","description":"Transport status: reserved, queued, sending, sent, skipped, failed"},"required":false,"description":"Transport status: reserved, queued, sending, sent, skipped, failed","name":"status","in":"query"},{"schema":{"type":"string","description":"Delivery status: accepted, queued, sent, delivered, deferred, soft_bounced, hard_bounced, complained, unsubscribed, link_clicked"},"required":false,"description":"Delivery status: accepted, queued, sent, delivered, deferred, soft_bounced, hard_bounced, complained, unsubscribed, link_clicked","name":"deliveryStatus","in":"query"},{"schema":{"type":"string","description":"Recipient email; see match for the matching mode"},"required":false,"description":"Recipient email; see match for the matching mode","name":"recipient","in":"query"},{"schema":{"type":"string","description":"Sender email; see match for the matching mode"},"required":false,"description":"Sender email; see match for the matching mode","name":"sender","in":"query"},{"schema":{"type":"string","description":"Subject; see match for the matching mode"},"required":false,"description":"Subject; see match for the matching mode","name":"subject","in":"query"},{"schema":{"type":"string","description":"Matching mode for recipient\/sender\/subject: exact (default, case-insensitive full match) or fuzzy (contains)"},"required":false,"description":"Matching mode for recipient\/sender\/subject: exact (default, case-insensitive full match) or fuzzy (contains)","name":"match","in":"query"},{"schema":{"type":"string","description":"Sent-at lower bound (inclusive): Unix seconds or ISO 8601; a date alone means UTC midnight"},"required":false,"description":"Sent-at lower bound (inclusive): Unix seconds or ISO 8601; a date alone means UTC midnight","name":"since","in":"query"},{"schema":{"type":"string","description":"Sent-at upper bound (exclusive): Unix seconds or ISO 8601; a date alone means UTC midnight"},"required":false,"description":"Sent-at upper bound (exclusive): Unix seconds or ISO 8601; a date alone means UTC midnight","name":"until","in":"query"},{"schema":{"type":"string"},"required":false,"name":"campaignKey","in":"query"},{"schema":{"type":"string"},"required":false,"name":"taskId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"providerMessageId","in":"query"},{"schema":{"type":"string","description":"Fuzzy search across recipient, sender, subject, and message_id"},"required":false,"description":"Fuzzy search across recipient, sender, subject, and message_id","name":"q","in":"query"}],"responses":{"200":{"description":"Message list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"messages":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"total":{"type":"number"},"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"}},"required":["success","messages","total","limit","offset","hasMore"],"additionalProperties":{}}}}},"400":{"description":"Invalid enum filter or search parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/sent-messages\/{messageId}":{"get":{"tags":["sending"],"summary":"Sent message details (with body, attachments and related delivery events)","description":"message.content holds the html and text that were sent (before per-recipient unsubscribe links and the free-tier footer were added) and attachment metadata with download URLs. content.stored is false for messages sent before bodies were kept.","parameters":[{"schema":{"type":"string","description":"message_id"},"required":true,"description":"message_id","name":"messageId","in":"path"}],"responses":{"200":{"description":"Message details","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"object","properties":{},"additionalProperties":{}},"events":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","message","events"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Message not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/sent-messages\/{messageId}\/attachments\/{attachmentId}":{"get":{"tags":["sending"],"summary":"Download a sent message attachment","description":"With `disposition=inline`, image attachments are returned inline.","parameters":[{"schema":{"type":"string"},"required":true,"name":"messageId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"attachmentId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"disposition","in":"query"}],"responses":{"200":{"description":"Attachment binary content"},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Message or attachment not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/campaigns":{"post":{"tags":["campaigns"],"summary":"Create or prepare a campaign (frozen draft)","description":"Idempotent by campaignKey: an existing campaign must have identical content (otherwise 409). Marketing campaigns need the marketing footer configured first. Providing `audience` freezes an audience snapshot.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"campaignKey":{"type":"string"},"name":{"type":"string"},"emailType":{"type":"string","enum":["transactional","lifecycle","marketing"],"description":"Default marketing"},"senderEmail":{"type":"string"},"fromName":{"type":"string"},"replyTo":{"type":"string"},"topic":{"type":"string"},"subject":{"type":"string"},"html":{"type":"string"},"text":{"type":"string"},"frequencyCapDays":{"type":"number"},"frequencyCapMax":{"type":"number"},"topicExclusionDays":{"type":"number"},"recipientReason":{"type":"string"},"templateKey":{"type":"string"},"templateVersion":{"type":"number"},"audienceDefinition":{},"audience":{"type":"object","properties":{},"additionalProperties":{},"description":"Frozen audience selection"},"sourceApp":{"type":"string"},"utm":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"businessGoal":{"type":"string"}},"additionalProperties":{}}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"campaign":{"type":"object","properties":{},"additionalProperties":{}},"audienceSnapshot":{"type":["object","null"],"properties":{},"additionalProperties":{}}},"required":["success","campaign","audienceSnapshot"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"402":{"description":"Insufficient balance","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Campaign not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"campaignKey conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"get":{"tags":["campaigns"],"summary":"Campaign list","parameters":[{"schema":{"type":"string","description":"Default 50, max 100"},"required":false,"description":"Default 50, max 100","name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Campaign list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"campaigns":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"limit":{"type":"number"},"offset":{"type":"number"}},"required":["success","campaigns","limit","offset"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/campaigns\/contact-history":{"get":{"tags":["campaigns"],"summary":"Campaign delivery history for a recipient","parameters":[{"schema":{"type":"string","description":"Recipient email"},"required":false,"description":"Recipient email","name":"email","in":"query"},{"schema":{"type":"string","description":"Default 50, max 200"},"required":false,"description":"Default 50, max 200","name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Delivery history","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"email":{"type":"string"},"history":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"limit":{"type":"number"},"offset":{"type":"number"}},"required":["success","email","history","limit","offset"],"additionalProperties":{}}}}},"400":{"description":"Missing email","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/campaigns\/{campaignKey}":{"get":{"tags":["campaigns"],"summary":"Campaign details (funnel, report, and audience snapshot)","parameters":[{"schema":{"type":"string","description":"campaign stable key"},"required":true,"description":"campaign stable key","name":"campaignKey","in":"path"}],"responses":{"200":{"description":"Campaign details","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"campaign":{"type":"object","properties":{},"additionalProperties":{}},"recipientCounts":{"type":"object","additionalProperties":{"type":"number"}},"deliveryCounts":{"type":"object","additionalProperties":{"type":"number"}},"openedCount":{"type":"number"},"report":{"type":["object","null"],"properties":{},"additionalProperties":{}},"audienceSnapshot":{"type":["object","null"],"properties":{},"additionalProperties":{}}},"required":["success","campaign","recipientCounts","deliveryCounts","openedCount","report","audienceSnapshot"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Campaign not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/campaigns\/{campaignKey}\/audience":{"get":{"tags":["campaigns"],"summary":"Frozen audience members of a campaign","parameters":[{"schema":{"type":"string","description":"campaign stable key"},"required":true,"description":"campaign stable key","name":"campaignKey","in":"path"},{"schema":{"type":"string","description":"Default 100, max 500"},"required":false,"description":"Default 100, max 500","name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Audience snapshot and members","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"snapshot":{"type":"object","properties":{},"additionalProperties":{}},"members":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"limit":{"type":"number"},"offset":{"type":"number"}},"required":["success","snapshot","members","limit","offset"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Campaign not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/campaigns\/{campaignKey}\/recipients":{"get":{"tags":["campaigns"],"summary":"Campaign recipient list","parameters":[{"schema":{"type":"string","description":"campaign stable key"},"required":true,"description":"campaign stable key","name":"campaignKey","in":"path"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","description":"Default 100, max 500"},"required":false,"description":"Default 100, max 500","name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Recipient list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"campaignKey":{"type":"string"},"recipients":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"limit":{"type":"number"},"offset":{"type":"number"}},"required":["success","campaignKey","recipients","limit","offset"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Campaign not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/campaigns\/{campaignKey}\/recipients.csv":{"get":{"tags":["campaigns"],"summary":"Export recipients as CSV","parameters":[{"schema":{"type":"string","description":"campaign stable key"},"required":true,"description":"campaign stable key","name":"campaignKey","in":"path"}],"responses":{"200":{"description":"CSV file","content":{"text\/csv":{"schema":{"type":"string"}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Campaign not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/campaigns\/{campaignKey}\/content":{"patch":{"tags":["campaigns"],"summary":"Edit content while paused","description":"Updates subject\/html\/text; queued but undelivered messages are rebuilt with the new content_revision on resume.","parameters":[{"schema":{"type":"string","description":"campaign stable key"},"required":true,"description":"campaign stable key","name":"campaignKey","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"subject":{"type":"string"},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"changed":{"type":"boolean"},"campaign":{"type":"object","properties":{},"additionalProperties":{}},"deferredRecipientCount":{"type":"number"}},"required":["success","changed","campaign","deferredRecipientCount"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Campaign not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Content cannot be edited in the current state","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/campaigns\/{campaignKey}\/resend-unsent":{"post":{"tags":["campaigns"],"summary":"Resend to failed recipients","description":"Only in sending state; resends to failed recipients and includes frozen-audience members that were never claimed. `dryRun` returns only the list to resend.","parameters":[{"schema":{"type":"string","description":"campaign stable key"},"required":true,"description":"campaign stable key","name":"campaignKey","in":"path"}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"dryRun":{"type":"boolean"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Resend result","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"resend":{"type":"boolean"},"campaignKey":{"type":"string"},"unsentCount":{"type":"number"}},"required":["success","campaignKey","unsentCount"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"402":{"description":"Insufficient balance","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Campaign not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Only sending campaigns can resend","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Missing authentication context","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"Upstream sending service error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/campaigns\/{campaignKey}\/pause":{"post":{"tags":["campaigns"],"summary":"pause Campaign","description":"pause\/resume\/cancel\/complete transitions; cancel stops scheduled dispatch, and cancel\/complete clean up inline images.","parameters":[{"schema":{"type":"string","description":"campaign stable key"},"required":true,"description":"campaign stable key","name":"campaignKey","in":"path"}],"responses":{"200":{"description":"Transitioned","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"campaign":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","campaign"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Campaign not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"This action is not allowed in the current state","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Transition failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/campaigns\/{campaignKey}\/resume":{"post":{"tags":["campaigns"],"summary":"resume Campaign","description":"pause\/resume\/cancel\/complete transitions; cancel stops scheduled dispatch, and cancel\/complete clean up inline images.","parameters":[{"schema":{"type":"string","description":"campaign stable key"},"required":true,"description":"campaign stable key","name":"campaignKey","in":"path"}],"responses":{"200":{"description":"Transitioned","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"campaign":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","campaign"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Campaign not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"This action is not allowed in the current state","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Transition failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/campaigns\/{campaignKey}\/cancel":{"post":{"tags":["campaigns"],"summary":"cancel Campaign","description":"pause\/resume\/cancel\/complete transitions; cancel stops scheduled dispatch, and cancel\/complete clean up inline images.","parameters":[{"schema":{"type":"string","description":"campaign stable key"},"required":true,"description":"campaign stable key","name":"campaignKey","in":"path"}],"responses":{"200":{"description":"Transitioned","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"campaign":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","campaign"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Campaign not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"This action is not allowed in the current state","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Transition failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/campaigns\/{campaignKey}\/complete":{"post":{"tags":["campaigns"],"summary":"complete Campaign","description":"pause\/resume\/cancel\/complete transitions; cancel stops scheduled dispatch, and cancel\/complete clean up inline images.","parameters":[{"schema":{"type":"string","description":"campaign stable key"},"required":true,"description":"campaign stable key","name":"campaignKey","in":"path"}],"responses":{"200":{"description":"Transitioned","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"campaign":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","campaign"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Campaign not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"This action is not allowed in the current state","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Transition failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/marketing-settings":{"get":{"tags":["governance"],"summary":"Get the marketing footer brand name and mailing address","responses":{"200":{"description":"Marketing footer settings","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"settings":{"type":["object","null"],"properties":{"brandName":{"type":"string"},"postalAddress":{"type":"string"}},"additionalProperties":{}}},"required":["success","settings"],"additionalProperties":{}}}}}}},"put":{"tags":["governance"],"summary":"Configure the marketing footer brand name and mailing address","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"brandName":{"type":"string","description":"Brand name, up to 200 characters, single line"},"postalAddress":{"type":"string","description":"Mailing address, up to 500 characters, at most two lines"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Marketing footer settings","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"settings":{"type":["object","null"],"properties":{"brandName":{"type":"string"},"postalAddress":{"type":"string"}},"additionalProperties":{}}},"required":["success","settings"],"additionalProperties":{}}}}},"400":{"description":"Validation failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/events":{"post":{"tags":["workflows"],"summary":"Report a workflow event","description":"Stores the event idempotently, then triggers or exits workflows; a duplicate event returns 200 and a new event returns 201.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string","description":"Stable event ID (idempotency key); retries must reuse it"},"event_name":{"type":"string","description":"Event name (matched against trigger and exit conditions)"},"occurred_at":{"type":"string","description":"Event time, ISO-8601"},"contact":{"type":"object","properties":{"external_contact_id":{"type":"string","description":"Stable business-side contact ID"},"email":{"type":"string","description":"Contact email"},"attributes":{"description":"Contact attributes, JSON up to 32KB","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["external_contact_id","email"],"description":"Contact"},"properties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Event properties, JSON up to 64KB"}},"additionalProperties":{},"required":["event_id","event_name","occurred_at","contact"],"description":"Workflow event input"}}}},"responses":{"200":{"description":"Duplicate event (idempotent)","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"duplicate":{"type":"boolean"},"event":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","duplicate","event"],"additionalProperties":{}}}}},"201":{"description":"Accepted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"duplicate":{"type":"boolean"},"event":{"type":"object","properties":{},"additionalProperties":{}},"triggeredRunIds":{"type":"array","items":{"type":"string"}},"exitedRunIds":{"type":"array","items":{"type":"string"}}},"required":["success","duplicate","event"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Event conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Processing failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/events\/batch":{"post":{"tags":["workflows"],"summary":"Report workflow events in bulk","description":"body is an array of events or {events: [...]}, 1-100 items; returns a result per item, 207 overall.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"event_id":{"type":"string","description":"Stable event ID (idempotency key); retries must reuse it"},"event_name":{"type":"string","description":"Event name (matched against trigger and exit conditions)"},"occurred_at":{"type":"string","description":"Event time, ISO-8601"},"contact":{"type":"object","properties":{"external_contact_id":{"type":"string","description":"Stable business-side contact ID"},"email":{"type":"string","description":"Contact email"},"attributes":{"description":"Contact attributes, JSON up to 32KB","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["external_contact_id","email"],"description":"Contact"},"properties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Event properties, JSON up to 64KB"}},"additionalProperties":{},"required":["event_id","event_name","occurred_at","contact"],"description":"Workflow event input"}}},"additionalProperties":{}}}}},"responses":{"207":{"description":"Batch result","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"received":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","received","results"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/events\/{eventId}":{"get":{"tags":["workflows"],"summary":"Event details (with triggered runs)","parameters":[{"schema":{"type":"string","description":"Event event_id"},"required":true,"description":"Event event_id","name":"eventId","in":"path"}],"responses":{"200":{"description":"Event details","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"event":{"type":"object","properties":{},"additionalProperties":{}},"runs":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","event","runs"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Event not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/events\/{eventId}\/replay":{"post":{"tags":["workflows"],"summary":"Replay a failed event","parameters":[{"schema":{"type":"string","description":"Event event_id"},"required":true,"description":"Event event_id","name":"eventId","in":"path"}],"responses":{"200":{"description":"Replay result","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"event":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","event"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Event not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Only failed events can be replayed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Processing failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/contacts":{"get":{"tags":["contacts"],"summary":"Contact list","parameters":[{"schema":{"type":"string","description":"Default 100, max 200"},"required":false,"description":"Default 100, max 200","name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Excludes deleted by default"},"required":false,"description":"Excludes deleted by default","name":"status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"tag","in":"query"}],"responses":{"200":{"description":"Contact list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"contacts":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"limit":{"type":"number"},"offset":{"type":"number"},"total":{"type":"number"},"hasMore":{"type":"boolean"}},"required":["success","contacts","limit","offset","total","hasMore"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/contacts\/batch":{"post":{"tags":["contacts"],"summary":"Create or update contacts in bulk","description":"body is an array of contacts or {contacts: [...]}, 1-1000 items; returns a result per item, and 207 overall if any fail.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"contacts":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"externalId":{"type":"string"},"name":{"type":"string"},"attributes":{"type":"object","additionalProperties":{}},"tags":{"type":"array","items":{"type":"string"}}},"additionalProperties":{},"description":"Contact fields"}}},"additionalProperties":{}}}}},"responses":{"200":{"description":"All succeeded","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"received":{"type":"number"},"succeeded":{"type":"number"},"failed":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","received","succeeded","failed","results"],"additionalProperties":{}}}}},"207":{"description":"Partially failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"received":{"type":"number"},"succeeded":{"type":"number"},"failed":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","received","succeeded","failed","results"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/contacts\/import":{"post":{"tags":["contacts"],"summary":"Import contacts from CSV","description":"Content-Type must be text\/csv or application\/csv, and the body is raw CSV.","responses":{"200":{"description":"All succeeded","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"received":{"type":"number"},"succeeded":{"type":"number"},"failed":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","received","succeeded","failed","results"],"additionalProperties":{}}}}},"207":{"description":"Partially failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"received":{"type":"number"},"succeeded":{"type":"number"},"failed":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","received","succeeded","failed","results"],"additionalProperties":{}}}}},"400":{"description":"Invalid Content-Type or CSV","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/contacts\/{externalContactId}":{"put":{"tags":["contacts"],"summary":"Create or update a contact (upsert)","parameters":[{"schema":{"type":"string","description":"Stable key of the external contact"},"required":true,"description":"Stable key of the external contact","name":"externalContactId","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"externalId":{"type":"string"},"name":{"type":"string"},"attributes":{"type":"object","additionalProperties":{}},"tags":{"type":"array","items":{"type":"string"}}},"additionalProperties":{},"description":"Contact fields"}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"created":{"type":"boolean"},"contact":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","created","contact"],"additionalProperties":{}}}}},"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"created":{"type":"boolean"},"contact":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","created","contact"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Contact not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"get":{"tags":["contacts"],"summary":"Contact details","parameters":[{"schema":{"type":"string","description":"Stable key of the external contact"},"required":true,"description":"Stable key of the external contact","name":"externalContactId","in":"path"}],"responses":{"200":{"description":"Contact details","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"contact":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","contact"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Contact not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"delete":{"tags":["contacts"],"summary":"Soft-delete a contact (also adds a workspace suppression)","parameters":[{"schema":{"type":"string","description":"Stable key of the external contact"},"required":true,"description":"Stable key of the external contact","name":"externalContactId","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"suppressionId":{"type":"string"},"contact":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","suppressionId","contact"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Contact not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/contacts\/{externalContactId}\/suppress":{"post":{"tags":["contacts"],"summary":"Suppress a contact (adds a workspace suppression)","parameters":[{"schema":{"type":"string","description":"Stable key of the external contact"},"required":true,"description":"Stable key of the external contact","name":"externalContactId","in":"path"}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","enum":["unsubscribed","hard_bounce","complaint","manual"]},"source":{"type":"string"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Suppressed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"suppressionId":{"type":"string"},"contact":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","suppressionId","contact"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Contact not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/contacts\/{externalContactId}\/audiences":{"get":{"tags":["contacts"],"summary":"Audiences the contact belongs to","parameters":[{"schema":{"type":"string","description":"Stable key of the external contact"},"required":true,"description":"Stable key of the external contact","name":"externalContactId","in":"path"}],"responses":{"200":{"description":"Audience memberships","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"externalId":{"type":"string"},"audiences":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","externalId","audiences"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Contact not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/contacts\/{externalContactId}\/history":{"get":{"tags":["contacts"],"summary":"Contact delivery history (including alias emails)","parameters":[{"schema":{"type":"string","description":"Stable key of the external contact"},"required":true,"description":"Stable key of the external contact","name":"externalContactId","in":"path"},{"schema":{"type":"string","description":"Default 100, max 500"},"required":false,"description":"Default 100, max 500","name":"limit","in":"query"}],"responses":{"200":{"description":"Delivery history","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"contact":{"type":"object","properties":{},"additionalProperties":{}},"emailAliases":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"deliveries":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"campaignDeliveries":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"workflowSends":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"transactionalSends":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"limit":{"type":"number"}},"required":["success","contact","emailAliases","deliveries","campaignDeliveries","workflowSends","transactionalSends","limit"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Contact not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/contacts\/{externalContactId}\/timeline":{"get":{"tags":["contacts"],"summary":"Contact event timeline","parameters":[{"schema":{"type":"string","description":"Stable key of the external contact"},"required":true,"description":"Stable key of the external contact","name":"externalContactId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Event timeline","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"limit":{"type":"number"},"events":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","limit","events"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Contact not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/audiences\/preview":{"post":{"tags":["audiences"],"summary":"Preview audience resolution","description":"Resolves an {audiences, contacts, exclude\u2026} selection without saving it and returns the count and a sample.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"include":{"type":"object","properties":{},"additionalProperties":{}},"exclude":{"type":"object","properties":{},"additionalProperties":{}},"contacts":{"type":"array","items":{"type":"string"}},"audiences":{"type":"array","items":{"type":"string"}},"sampleLimit":{"type":"number","description":"Sample size, default 20, max 100"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Resolution result","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"selection":{"type":"object","properties":{},"additionalProperties":{}},"count":{"type":"number"},"sample":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"directRecipientCount":{"type":"number"},"includedContactCount":{"type":"number"},"excludedContactCount":{"type":"number"},"audiences":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","selection","count","sample"],"additionalProperties":{}}}}},"400":{"description":"Invalid selection","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Referenced audience not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/audiences":{"post":{"tags":["audiences"],"summary":"Create an audience","description":"type=static may include members (external contact IDs, up to 1000); type=dynamic requires filter.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"key":{"type":"string","description":"stable key"},"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string","enum":["static","dynamic"]},"filter":{"type":"object","properties":{},"additionalProperties":{},"description":"Filter for dynamic audiences"},"members":{"type":"array","items":{"type":"string"},"description":"External contact IDs (static only)"}},"additionalProperties":{}}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"audience":{"type":"object","properties":{},"additionalProperties":{}},"memberCount":{"type":"number"}},"required":["success","audience","memberCount"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Member contact not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Key already exists","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"get":{"tags":["audiences"],"summary":"Audience list","parameters":[{"schema":{"type":"string","description":"Default 100, max 200"},"required":false,"description":"Default 100, max 200","name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Audience list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"audiences":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"limit":{"type":"number"},"offset":{"type":"number"}},"required":["success","audiences","limit","offset"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/audiences\/{audienceKey}\/preview":{"get":{"tags":["audiences"],"summary":"Preview member samples of an existing audience","parameters":[{"schema":{"type":"string","description":"audience stable key"},"required":true,"description":"audience stable key","name":"audienceKey","in":"path"},{"schema":{"type":"string","description":"Default 20, max 100"},"required":false,"description":"Default 20, max 100","name":"sampleLimit","in":"query"}],"responses":{"200":{"description":"Member preview","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"audience":{"type":"object","properties":{},"additionalProperties":{}},"count":{"type":"number"},"sample":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","audience","count","sample"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Audience not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/audiences\/{audienceKey}":{"get":{"tags":["audiences"],"summary":"Audience details","parameters":[{"schema":{"type":"string","description":"audience stable key"},"required":true,"description":"audience stable key","name":"audienceKey","in":"path"}],"responses":{"200":{"description":"Audience details","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"audience":{"type":"object","properties":{},"additionalProperties":{}},"memberCount":{"type":["number","null"]}},"required":["success","audience","memberCount"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Audience not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"put":{"tags":["audiences"],"summary":"Update an audience","parameters":[{"schema":{"type":"string","description":"audience stable key"},"required":true,"description":"audience stable key","name":"audienceKey","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"filter":{"type":"object","properties":{},"additionalProperties":{},"description":"Dynamic audiences only"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"audience":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","audience"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Audience not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"delete":{"tags":["audiences"],"summary":"Delete an audience","parameters":[{"schema":{"type":"string","description":"audience stable key"},"required":true,"description":"audience stable key","name":"audienceKey","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Audience not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/audiences\/{audienceKey}\/members":{"post":{"tags":["audiences"],"summary":"Add or replace static audience members","parameters":[{"schema":{"type":"string","description":"audience stable key"},"required":true,"description":"audience stable key","name":"audienceKey","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"externalIds":{"type":"array","items":{"type":"string"},"description":"External contact IDs, up to 1000"},"mode":{"type":"string","enum":["add","replace"],"description":"Default add"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Members updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"audienceKey":{"type":"string"},"memberCount":{"type":"number"}},"required":["success","audienceKey","memberCount"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Audience or contact not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/audiences\/{audienceKey}\/members\/{externalContactId}":{"delete":{"tags":["audiences"],"summary":"Remove a static audience member","parameters":[{"schema":{"type":"string"},"required":true,"name":"audienceKey","in":"path"},{"schema":{"type":"string","description":"External contact ID"},"required":true,"description":"External contact ID","name":"externalContactId","in":"path"}],"responses":{"200":{"description":"Removed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Audience, contact, or membership not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/workflows":{"post":{"tags":["workflows"],"summary":"Create a workflow (draft)","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"workflowKey":{"type":"string"},"name":{"type":"string"},"definition":{"description":"Workflow definition (trigger\/steps\/exitOn\/reentry)"}},"additionalProperties":{}}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"workflow":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","workflow"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"workflowKey already exists","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"get":{"tags":["workflows"],"summary":"Workflow list","responses":{"200":{"description":"Workflow list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"workflows":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","workflows"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/workflows\/{workflowKey}":{"get":{"tags":["workflows"],"summary":"Workflow details (with version history)","parameters":[{"schema":{"type":"string","description":"workflow stable key"},"required":true,"description":"workflow stable key","name":"workflowKey","in":"path"}],"responses":{"200":{"description":"Workflow details","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"workflow":{"type":"object","properties":{},"additionalProperties":{}},"versions":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","workflow","versions"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Workflow not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/workflows\/{workflowKey}\/draft":{"put":{"tags":["workflows"],"summary":"Update a workflow draft definition","parameters":[{"schema":{"type":"string","description":"workflow stable key"},"required":true,"description":"workflow stable key","name":"workflowKey","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"definition":{"description":"Workflow definition JSON"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"workflow":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","workflow"],"additionalProperties":{}}}}},"400":{"description":"Invalid definition","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Workflow not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Archived templates cannot be edited","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/workflows\/{workflowKey}\/publish":{"post":{"tags":["workflows"],"summary":"Publish a new workflow version","description":"inFlightPolicy is required once a version has been published; V1 supports only continue.","parameters":[{"schema":{"type":"string","description":"workflow stable key"},"required":true,"description":"workflow stable key","name":"workflowKey","in":"path"}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"inFlightPolicy":{"type":"string","enum":["continue","migrate"],"description":"Policy for in-progress runs"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Published","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"workflow":{"type":"object","properties":{},"additionalProperties":{}},"versionId":{"type":"string"}},"required":["success","workflow","versionId"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters or template binding validation failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Workflow not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Archived templates cannot be published","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/workflows\/{workflowKey}\/pause":{"post":{"tags":["workflows"],"summary":"pause Workflow","description":"pause\/resume\/archive status transitions; archive stops in-progress runs.","parameters":[{"schema":{"type":"string","description":"workflow stable key"},"required":true,"description":"workflow stable key","name":"workflowKey","in":"path"}],"responses":{"200":{"description":"Transitioned","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"workflow":{"type":"object","properties":{},"additionalProperties":{}},"platformFailures":{"type":"array","items":{"type":"string"}}},"required":["success","workflow","platformFailures"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Workflow not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"This action is not allowed in the current state","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/workflows\/{workflowKey}\/resume":{"post":{"tags":["workflows"],"summary":"resume Workflow","description":"pause\/resume\/archive status transitions; archive stops in-progress runs.","parameters":[{"schema":{"type":"string","description":"workflow stable key"},"required":true,"description":"workflow stable key","name":"workflowKey","in":"path"}],"responses":{"200":{"description":"Transitioned","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"workflow":{"type":"object","properties":{},"additionalProperties":{}},"platformFailures":{"type":"array","items":{"type":"string"}}},"required":["success","workflow","platformFailures"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Workflow not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"This action is not allowed in the current state","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/workflows\/{workflowKey}\/archive":{"post":{"tags":["workflows"],"summary":"archive Workflow","description":"pause\/resume\/archive status transitions; archive stops in-progress runs.","parameters":[{"schema":{"type":"string","description":"workflow stable key"},"required":true,"description":"workflow stable key","name":"workflowKey","in":"path"}],"responses":{"200":{"description":"Transitioned","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"workflow":{"type":"object","properties":{},"additionalProperties":{}},"platformFailures":{"type":"array","items":{"type":"string"}}},"required":["success","workflow","platformFailures"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Workflow not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"This action is not allowed in the current state","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/workflows\/{workflowKey}\/runs":{"get":{"tags":["workflows"],"summary":"Workflow run list","parameters":[{"schema":{"type":"string","description":"workflow stable key"},"required":true,"description":"workflow stable key","name":"workflowKey","in":"path"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","description":"Default 100, max 200"},"required":false,"description":"Default 100, max 200","name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Run list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"runs":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"limit":{"type":"number"},"offset":{"type":"number"}},"required":["success","runs","limit","offset"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Workflow not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/workflows\/{workflowKey}\/runs\/{runId}":{"get":{"tags":["workflows"],"summary":"Workflow run details (logs + send executions)","parameters":[{"schema":{"type":"string"},"required":true,"name":"workflowKey","in":"path"},{"schema":{"type":"string","description":"run ID"},"required":true,"description":"run ID","name":"runId","in":"path"}],"responses":{"200":{"description":"Run details","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"run":{"type":"object","properties":{},"additionalProperties":{}},"logs":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"sends":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","run","logs","sends"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Workflow not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/workflows\/{workflowKey}\/runs\/{runId}\/cancel":{"post":{"tags":["workflows"],"summary":"Cancel one in-progress workflow run","description":"Stops a queued, running or waiting run before its remaining steps. Emails already handed to sending are not recalled and other runs are untouched. Cancelling a run that already ended is a no-op that returns cancelled=false.","parameters":[{"schema":{"type":"string"},"required":true,"name":"workflowKey","in":"path"},{"schema":{"type":"string","description":"run ID"},"required":true,"description":"run ID","name":"runId","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","description":"Why the run is cancelled, kept in the run log (1-500 characters)"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Cancelled, or already ended","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"cancelled":{"type":"boolean"},"run":{"type":"object","properties":{},"additionalProperties":{}},"platformFailures":{"type":"array","items":{"type":"string"}}},"required":["success","cancelled","run","platformFailures"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Workflow not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/templates":{"post":{"tags":["templates"],"summary":"Create an email template (draft)","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"templateKey":{"type":"string"},"name":{"type":"string"},"definition":{"description":"Template definition (from\/subject\/body\/variables\/emailType\/topic, etc.)"}},"additionalProperties":{}}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"template":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","template"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"templateKey already exists","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"get":{"tags":["templates"],"summary":"Template list","parameters":[{"schema":{"type":"string","description":"Default 100, max 200"},"required":false,"description":"Default 100, max 200","name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Template list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"templates":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"limit":{"type":"number"},"offset":{"type":"number"}},"required":["success","templates","limit","offset"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/templates\/{templateKey}":{"get":{"tags":["templates"],"summary":"Template details (with version history)","parameters":[{"schema":{"type":"string","description":"template stable key"},"required":true,"description":"template stable key","name":"templateKey","in":"path"}],"responses":{"200":{"description":"Template details","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"template":{"type":"object","properties":{},"additionalProperties":{}},"versions":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","template","versions"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Template not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/templates\/{templateKey}\/draft":{"put":{"tags":["templates"],"summary":"Update a template draft","parameters":[{"schema":{"type":"string","description":"template stable key"},"required":true,"description":"template stable key","name":"templateKey","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"definition":{}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"template":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","template"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Template not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Archived templates cannot be edited","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/templates\/{templateKey}\/publish":{"post":{"tags":["templates"],"summary":"Publish a new template version","description":"Checks the from-domain verification status and the marketing footer configuration before publishing.","parameters":[{"schema":{"type":"string","description":"template stable key"},"required":true,"description":"template stable key","name":"templateKey","in":"path"}],"responses":{"200":{"description":"Published","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"template":{"type":"object","properties":{},"additionalProperties":{}},"version":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","template","version"],"additionalProperties":{}}}}},"400":{"description":"Publish validation failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Template not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Archived templates cannot be published","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/templates\/{templateKey}\/render":{"post":{"tags":["templates"],"summary":"Render a template preview","parameters":[{"schema":{"type":"string","description":"template stable key"},"required":true,"description":"template stable key","name":"templateKey","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"version":{"type":"number","description":"Published version number"},"draft":{"type":"boolean","description":"Render the draft (mutually exclusive with version)"},"locale":{"type":"string"},"variables":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Render result","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"templateKey":{"type":"string"},"version":{"anyOf":[{"type":"number"},{"type":"string"}]},"rendered":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","templateKey","version","rendered"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Template not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/templates\/{templateKey}\/test-send":{"post":{"tags":["templates"],"summary":"Send a template test","description":"Sends through the governed send path with testSend=true, recorded as the template_test source.","parameters":[{"schema":{"type":"string","description":"template stable key"},"required":true,"description":"template stable key","name":"templateKey","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"version":{"type":"number","description":"Published version number"},"draft":{"type":"boolean","description":"Render the draft (mutually exclusive with version)"},"locale":{"type":"string"},"variables":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"to":{"type":"string","description":"Test recipient"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Send result (passed through from the Queue service, JSON)"},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Template or version not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/templates\/{templateKey}\/archive":{"post":{"tags":["templates"],"summary":"Archive a template","parameters":[{"schema":{"type":"string","description":"template stable key"},"required":true,"description":"template stable key","name":"templateKey","in":"path"}],"responses":{"200":{"description":"Archived","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"template":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","template"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Template not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/delivery-events":{"get":{"tags":["delivery"],"summary":"List delivery events","parameters":[{"schema":{"type":"string","description":"Page size, default 50, max 200"},"required":false,"description":"Page size, default 50, max 200","name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string"},"required":false,"name":"campaignKey","in":"query"},{"schema":{"type":"string"},"required":false,"name":"recipientId","in":"query"},{"schema":{"type":"string","description":"External contact ID"},"required":false,"description":"External contact ID","name":"externalId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"messageId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"providerMessageId","in":"query"},{"schema":{"type":"string","description":"Event type: accepted, queued, sent, delivered, opened, deferred, soft_bounced, hard_bounced, complained, unsubscribed, link_clicked"},"required":false,"description":"Event type: accepted, queued, sent, delivered, opened, deferred, soft_bounced, hard_bounced, complained, unsubscribed, link_clicked","name":"type","in":"query"}],"responses":{"200":{"description":"Event list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"events":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"limit":{"type":"number"},"offset":{"type":"number"}},"required":["success","events","limit","offset"],"additionalProperties":{}}}}},"400":{"description":"Invalid type","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/delivery-events\/{eventId}":{"get":{"tags":["delivery"],"summary":"Delivery event details","parameters":[{"schema":{"type":"string","description":"Delivery event ID"},"required":true,"description":"Delivery event ID","name":"eventId","in":"path"}],"responses":{"200":{"description":"Event details","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"event":{"type":"object","properties":{},"additionalProperties":{}},"webhook":{"type":["object","null"],"properties":{},"additionalProperties":{}}},"required":["success","event","webhook"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Event not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/delivery-events\/{eventId}\/replay":{"post":{"tags":["delivery"],"summary":"Redeliver the webhook for an event","parameters":[{"schema":{"type":"string","description":"Delivery event ID"},"required":true,"description":"Delivery event ID","name":"eventId","in":"path"}],"responses":{"200":{"description":"Queued for redelivery","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"eventId":{"type":"string"},"webhookStatus":{"type":"string"}},"required":["success","eventId","webhookStatus"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Event not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Redelivery is not allowed in the current state","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/delivery-webhook":{"get":{"tags":["delivery"],"summary":"Get the delivery-event webhook configuration","responses":{"200":{"description":"Webhook configuration","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"webhook":{"type":["object","null"],"properties":{"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"active":{"type":"boolean"},"signingSecretConfigured":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["url","events","active"],"additionalProperties":{}}},"required":["success","webhook"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"put":{"tags":["delivery"],"summary":"Create or update the delivery-event webhook","description":"url must be public HTTPS (no credentials, custom ports, or private networks). Use either `signingSecret` (32-256 characters) or `rotateSecret`; the first setup or rotateSecret returns the newly generated secret.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"Webhook URL"},"events":{"type":"array","items":{"type":"string"},"description":"Event types to subscribe to; all by default"},"active":{"type":"boolean"},"signingSecret":{"type":"string"},"rotateSecret":{"type":"boolean"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"webhook":{"type":"object","properties":{},"additionalProperties":{}},"signingSecret":{"type":"string"}},"required":["success","webhook"],"additionalProperties":{}}}}},"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"webhook":{"type":"object","properties":{},"additionalProperties":{}},"signingSecret":{"type":"string"}},"required":["success","webhook"],"additionalProperties":{}}}}},"400":{"description":"Invalid configuration","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"delete":{"tags":["delivery"],"summary":"Disable the delivery-event webhook","responses":{"200":{"description":"Disabled","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"disabled":{"type":"boolean"}},"required":["success","disabled"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/translation-settings":{"get":{"tags":["inbox"],"summary":"Get email translation settings","description":"Translation in the web inbox replaces the text of an email in place. Without saved settings, target_language follows the workspace language.","responses":{"200":{"description":"Email translation settings","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"settings":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Show the translate bar on emails in the web inbox"},"target_language":{"type":"string","enum":["zh-CN","zh-TW","en","ja","ko","es","fr","de","pt","ru","it","vi"],"description":"Language emails are translated into"},"auto_translate":{"type":"boolean","description":"Translate emails in other languages automatically when opened"},"configured":{"type":"boolean","description":"false while the defaults are in use"}},"required":["enabled","target_language","auto_translate","configured"]},"available":{"type":"boolean","description":"false when translation is turned off for the whole platform"},"languages":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"native":{"type":"string"}},"required":["code","name","native"]}}},"required":["success","settings","available","languages"],"additionalProperties":{}}}}}}},"put":{"tags":["inbox"],"summary":"Update email translation settings","description":"Updates only the fields provided.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Show the translate bar on emails in the web inbox"},"target_language":{"type":"string","enum":["zh-CN","zh-TW","en","ja","ko","es","fr","de","pt","ru","it","vi"],"description":"Language emails are translated into"},"auto_translate":{"type":"boolean","description":"Translate emails in other languages automatically when opened"}}}}}},"responses":{"200":{"description":"Email translation settings","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"settings":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Show the translate bar on emails in the web inbox"},"target_language":{"type":"string","enum":["zh-CN","zh-TW","en","ja","ko","es","fr","de","pt","ru","it","vi"],"description":"Language emails are translated into"},"auto_translate":{"type":"boolean","description":"Translate emails in other languages automatically when opened"},"configured":{"type":"boolean","description":"false while the defaults are in use"}},"required":["enabled","target_language","auto_translate","configured"]},"available":{"type":"boolean","description":"false when translation is turned off for the whole platform"},"languages":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"native":{"type":"string"}},"required":["code","name","native"]}}},"required":["success","settings","available","languages"],"additionalProperties":{}}}}},"400":{"description":"Validation failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/messages\/{id}\/translations":{"post":{"tags":["inbox"],"summary":"Translate text segments of an email","description":"Used by the web inbox, which splits the rendered email into segments. Segments already translated are served from the cache for free; the rest are translated by the translation model and charged to the model usage balance. At most 60 segments and 12000 characters per request.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"target":{"type":"string","enum":["zh-CN","zh-TW","en","ja","ko","es","fr","de","pt","ru","it","vi"]},"segmenter_version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"subject":{"type":"string","maxLength":1000},"segments":{"maxItems":60,"type":"array","items":{"type":"object","properties":{"hash":{"type":"string"},"text":{"type":"string"}},"required":["hash","text"]}}},"required":["target","segmenter_version","segments"]}}}},"responses":{"200":{"description":"Translated text","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"target_language":{"type":"string"},"source_language":{"type":["string","null"]},"subject":{"type":["string","null"]},"segments":{"type":"object","additionalProperties":{"type":"string"},"description":"Translated text keyed by segment hash"}},"required":["success","target_language","source_language","subject","segments"],"additionalProperties":{}}}}},"400":{"description":"Validation failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"402":{"description":"Not enough model usage balance","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Email not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"The email exceeded the translation limit","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"The translation model failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Translation is turned off","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/addresses":{"get":{"tags":["inbox"],"summary":"List inbox addresses (with available sending and receiving domains)","responses":{"200":{"description":"Addresses and domains","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"domain":{"type":"string","description":"Platform default inbound domain (compatibility field)"},"domains":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"addresses":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","domain","domains","addresses"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Lookup failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"post":{"tags":["inbox"],"summary":"Create an inbox address","description":"The body is optional; prefix defaults to a random value and domain defaults to the platform domain. Up to 20 per account.","requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"prefix":{"type":"string","description":"Address prefix (lowercase letters, digits, . _ -). Role names such as support, info and admin, and names under 3 characters, are reserved on the platform domain only"},"domain":{"type":"string","description":"Inbound domain (must be inbound verified)"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"address":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","address"],"additionalProperties":{}}}}},"400":{"description":"Invalid prefix or domain, or address limit reached","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"402":{"description":"Requires a mailbox plan","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"403":{"description":"Domain ownership is not verified, or the plan mailbox limit is reached","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Address already taken, or MX is not configured","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Creation failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/addresses\/{id}":{"delete":{"tags":["inbox"],"summary":"Delete an inbox address and all of its emails","parameters":[{"schema":{"type":"string","description":"Inbox address ID"},"required":true,"description":"Inbox address ID","name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/messages":{"get":{"tags":["inbox"],"summary":"List received emails (without bodies)","description":"Keyset pagination; cursor is `${received_at}|${id}`. Supports recipient\/sender\/subject (match=exact|fuzzy), sender_domain, q fuzzy search, and a since\/until received-at range; does not search bodies.","parameters":[{"schema":{"type":"string","description":"Filter by inbox address"},"required":false,"description":"Filter by inbox address","name":"address_id","in":"query"},{"schema":{"type":"string","description":"inbox or quarantine, default inbox"},"required":false,"description":"inbox or quarantine, default inbox","name":"folder","in":"query"},{"schema":{"type":"string","description":"Default 20, max 100"},"required":false,"description":"Default 20, max 100","name":"limit","in":"query"},{"schema":{"type":"string","description":"Keyset pagination cursor"},"required":false,"description":"Keyset pagination cursor","name":"cursor","in":"query"},{"schema":{"type":"string","description":"Recipient (to_address); see match for the matching mode"},"required":false,"description":"Recipient (to_address); see match for the matching mode","name":"recipient","in":"query"},{"schema":{"type":"string","description":"Sender email; fuzzy matching also matches the display name"},"required":false,"description":"Sender email; fuzzy matching also matches the display name","name":"sender","in":"query"},{"schema":{"type":"string","description":"Subject; see match for the matching mode"},"required":false,"description":"Subject; see match for the matching mode","name":"subject","in":"query"},{"schema":{"type":"string","description":"Matching mode for recipient\/sender\/subject: exact (default, case-insensitive full match) or fuzzy (contains)"},"required":false,"description":"Matching mode for recipient\/sender\/subject: exact (default, case-insensitive full match) or fuzzy (contains)","name":"match","in":"query"},{"schema":{"type":"string","description":"Fuzzy search across recipient, sender, display name, and subject; does not search the body"},"required":false,"description":"Fuzzy search across recipient, sender, display name, and subject; does not search the body","name":"q","in":"query"},{"schema":{"type":"string","description":"Sender domain; case-insensitive exact domain match (subdomains excluded), uses an index"},"required":false,"description":"Sender domain; case-insensitive exact domain match (subdomains excluded), uses an index","name":"sender_domain","in":"query"},{"schema":{"type":"string","description":"Received-at lower bound (inclusive): Unix seconds or ISO 8601; a date alone means UTC midnight"},"required":false,"description":"Received-at lower bound (inclusive): Unix seconds or ISO 8601; a date alone means UTC midnight","name":"since","in":"query"},{"schema":{"type":"string","description":"Received-at upper bound (exclusive): Unix seconds or ISO 8601; a date alone means UTC midnight"},"required":false,"description":"Received-at upper bound (exclusive): Unix seconds or ISO 8601; a date alone means UTC midnight","name":"until","in":"query"}],"responses":{"200":{"description":"Email list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"messages":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"cursor":{"type":["string","null"]}},"required":["success","messages","cursor"],"additionalProperties":{}}}}},"400":{"description":"Invalid folder, cursor, or search parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Lookup failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/messages\/wait":{"get":{"tags":["inbox"],"summary":"Wait for new inbound email","description":"Long-polls up to `timeout` seconds (default and max 25; 0 checks once) for inbound email matching the optional filters, then returns it with a cursor. Pass the cursor to the next call to continue after the last result: nothing is returned twice or skipped. Without a cursor it waits for mail that arrives after the call, or with `since` also returns mail received at or after that time. `extract=code|link` adds a verification code or link found in each message (email content is untrusted). Reading does not mark mail read.","parameters":[{"schema":{"type":"string","description":"Inbox address that received the mail; a +tag address matches only that tag"},"required":false,"description":"Inbox address that received the mail; a +tag address matches only that tag","name":"address","in":"query"},{"schema":{"type":"string","description":"Inbox address ID"},"required":false,"description":"Inbox address ID","name":"address_id","in":"query"},{"schema":{"type":"string","description":"Sender email address, exact and case-insensitive"},"required":false,"description":"Sender email address, exact and case-insensitive","name":"sender","in":"query"},{"schema":{"type":"string","description":"Sender domain such as example.com (subdomains excluded)"},"required":false,"description":"Sender domain such as example.com (subdomains excluded)","name":"sender_domain","in":"query"},{"schema":{"type":"string","description":"Text the subject contains, case-insensitive"},"required":false,"description":"Text the subject contains, case-insensitive","name":"subject","in":"query"},{"schema":{"type":"string","description":"inbox (default), quarantine or all"},"required":false,"description":"inbox (default), quarantine or all","name":"folder","in":"query"},{"schema":{"type":"string","description":"Cursor from a previous wait"},"required":false,"description":"Cursor from a previous wait","name":"cursor","in":"query"},{"schema":{"type":"string","description":"Without a cursor: also return mail received at or after this time (Unix seconds or ISO 8601)"},"required":false,"description":"Without a cursor: also return mail received at or after this time (Unix seconds or ISO 8601)","name":"since","in":"query"},{"schema":{"type":"string","description":"Seconds to wait, 0-25, default 25"},"required":false,"description":"Seconds to wait, 0-25, default 25","name":"timeout","in":"query"},{"schema":{"type":"string","description":"Default 10, max 20"},"required":false,"description":"Default 10, max 20","name":"limit","in":"query"},{"schema":{"type":"string","description":"code or link"},"required":false,"description":"code or link","name":"extract","in":"query"}],"responses":{"200":{"description":"Matching email, or timed_out=true with a cursor to keep waiting","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"messages":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"cursor":{"type":"string"},"timed_out":{"type":"boolean"}},"required":["success","messages","cursor","timed_out"],"additionalProperties":{}}}}},"400":{"description":"Invalid filters, cursor or options","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Inbox address not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/threads":{"get":{"tags":["inbox"],"summary":"List threads (each with a summary of its latest email)","description":"Keyset pagination; cursor is `${last_received_at}|${thread_id}`. Search parameters match the email list; a thread is returned when any email in it satisfies all conditions.","parameters":[{"schema":{"type":"string","description":"Filter by inbox address"},"required":false,"description":"Filter by inbox address","name":"address_id","in":"query"},{"schema":{"type":"string","description":"inbox or quarantine, default inbox"},"required":false,"description":"inbox or quarantine, default inbox","name":"folder","in":"query"},{"schema":{"type":"string","description":"Default 20, max 100"},"required":false,"description":"Default 20, max 100","name":"limit","in":"query"},{"schema":{"type":"string","description":"Keyset pagination cursor"},"required":false,"description":"Keyset pagination cursor","name":"cursor","in":"query"},{"schema":{"type":"string","description":"Recipient (to_address); see match for the matching mode"},"required":false,"description":"Recipient (to_address); see match for the matching mode","name":"recipient","in":"query"},{"schema":{"type":"string","description":"Sender email; fuzzy matching also matches the display name"},"required":false,"description":"Sender email; fuzzy matching also matches the display name","name":"sender","in":"query"},{"schema":{"type":"string","description":"Subject; see match for the matching mode"},"required":false,"description":"Subject; see match for the matching mode","name":"subject","in":"query"},{"schema":{"type":"string","description":"Matching mode for recipient\/sender\/subject: exact (default, case-insensitive full match) or fuzzy (contains)"},"required":false,"description":"Matching mode for recipient\/sender\/subject: exact (default, case-insensitive full match) or fuzzy (contains)","name":"match","in":"query"},{"schema":{"type":"string","description":"Fuzzy search across recipient, sender, display name, and subject; does not search the body"},"required":false,"description":"Fuzzy search across recipient, sender, display name, and subject; does not search the body","name":"q","in":"query"},{"schema":{"type":"string","description":"Sender domain; case-insensitive exact domain match (subdomains excluded), uses an index"},"required":false,"description":"Sender domain; case-insensitive exact domain match (subdomains excluded), uses an index","name":"sender_domain","in":"query"},{"schema":{"type":"string","description":"Received-at lower bound (inclusive): Unix seconds or ISO 8601; a date alone means UTC midnight"},"required":false,"description":"Received-at lower bound (inclusive): Unix seconds or ISO 8601; a date alone means UTC midnight","name":"since","in":"query"},{"schema":{"type":"string","description":"Received-at upper bound (exclusive): Unix seconds or ISO 8601; a date alone means UTC midnight"},"required":false,"description":"Received-at upper bound (exclusive): Unix seconds or ISO 8601; a date alone means UTC midnight","name":"until","in":"query"}],"responses":{"200":{"description":"Thread list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"threads":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"cursor":{"type":["string","null"]}},"required":["success","threads","cursor"],"additionalProperties":{}}}}},"400":{"description":"Invalid folder, cursor, or search parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Lookup failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/threads\/{threadId}":{"get":{"tags":["inbox"],"summary":"All emails in a thread (with bodies, oldest first)","parameters":[{"schema":{"type":"string","description":"Thread ID"},"required":true,"description":"Thread ID","name":"threadId","in":"path"},{"schema":{"type":"string","description":"Default inbox"},"required":false,"description":"Default inbox","name":"folder","in":"query"}],"responses":{"200":{"description":"Thread emails","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"thread_id":{"type":"string"},"messages":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","thread_id","messages"],"additionalProperties":{}}}}},"400":{"description":"Invalid folder","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/messages\/{id}":{"get":{"tags":["inbox"],"summary":"Email details (with body)","parameters":[{"schema":{"type":"string","description":"Email ID"},"required":true,"description":"Email ID","name":"id","in":"path"}],"responses":{"200":{"description":"Email details","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","message"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"delete":{"tags":["inbox"],"summary":"Delete an email","parameters":[{"schema":{"type":"string","description":"Email ID"},"required":true,"description":"Email ID","name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/messages\/{id}\/release":{"post":{"tags":["inbox"],"summary":"Move a quarantined email back to the inbox","description":"Changes visibility only; automations are not replayed.","parameters":[{"schema":{"type":"string","description":"Email ID"},"required":true,"description":"Email ID","name":"id","in":"path"}],"responses":{"200":{"description":"Moved back","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","message"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/messages\/{id}\/content":{"get":{"tags":["inbox"],"summary":"Read the body without side effects (for webhooks and agents)","description":"Without format, returns text+html; with format=text\/html\/markdown, returns only that representation. strip_quotes=true removes quoted blocks.","parameters":[{"schema":{"type":"string","description":"Email ID"},"required":true,"description":"Email ID","name":"id","in":"path"},{"schema":{"type":"string","description":"text \/ html \/ markdown"},"required":false,"description":"text \/ html \/ markdown","name":"format","in":"query"},{"schema":{"type":"string","description":"true \/ false"},"required":false,"description":"true \/ false","name":"strip_quotes","in":"query"}],"responses":{"200":{"description":"Body content","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"content":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","content"],"additionalProperties":{}}}}},"400":{"description":"Invalid format or strip_quotes","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/messages\/{id}\/read-state":{"patch":{"tags":["inbox"],"summary":"Set the read state of an email","parameters":[{"schema":{"type":"string","description":"Email ID"},"required":true,"description":"Email ID","name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"is_read":{"type":"boolean","description":"true marks as read, false marks as unread"}},"additionalProperties":{},"required":["is_read"]}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"id":{"type":"string"},"is_read":{"type":"boolean"},"changed":{"type":"boolean"}},"required":["success","id","is_read","changed"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Sent records cannot be modified","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/threads\/{threadId}\/read-state":{"patch":{"tags":["inbox"],"summary":"Set the read state of inbound emails in a thread","parameters":[{"schema":{"type":"string","description":"Thread ID"},"required":true,"description":"Thread ID","name":"threadId","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"is_read":{"type":"boolean","description":"true marks as read, false marks as unread"},"folder":{"type":"string","description":"inbox or quarantine, default inbox"}},"additionalProperties":{},"required":["is_read"]}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"thread_id":{"type":"string"},"is_read":{"type":"boolean"},"updated_count":{"type":"number"}},"required":["success","thread_id","is_read","updated_count"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/messages\/{id}\/attachments\/{attachmentId}":{"get":{"tags":["inbox"],"summary":"Download an email attachment","description":"With `disposition=inline`, image attachments are returned inline.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"attachmentId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"disposition","in":"query"}],"responses":{"200":{"description":"Attachment binary content"},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/messages\/{id}\/reply":{"post":{"tags":["inbox"],"summary":"Reply to an email","description":"Uses the governed, billed send path; on success the reply is written to the same thread with direction=outbound. Supports the `Idempotency-Key` header (8-200 characters of letters, digits, . _ : -).","parameters":[{"schema":{"type":"string","description":"Email ID"},"required":true,"description":"Email ID","name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"text":{"type":"string"},"html":{"type":"string"},"subject":{"type":"string"},"to":{"type":"string","description":"Override recipient"},"cc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Cc addresses: comma-separated string or array"},"bcc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Bcc addresses: comma-separated string or array"},"reply_all":{"type":"boolean","description":"Also Cc the original To\/Cc recipients, excluding yourself. Default false"},"fromName":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Reply result (passed through from the send path, JSON)"},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/messages\/{id}\/forward":{"post":{"tags":["inbox"],"summary":"Forward an email","description":"Body = note + quoted original; original attachments are included by default (controlled by include_attachments). Supports the `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","description":"Email ID"},"required":true,"description":"Email ID","name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"to":{"type":"string","description":"Forward-to email address"},"cc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Cc addresses: comma-separated string or array"},"bcc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Bcc addresses: comma-separated string or array"},"text":{"type":"string"},"html":{"type":"string"},"subject":{"type":"string"},"fromName":{"type":"string"},"include_attachments":{"type":"boolean","description":"Default true"},"attachments":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Forward result (passed through from the send path, JSON)"},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/replies\/{requestId}":{"get":{"tags":["inbox"],"summary":"Get the status of an idempotent reply request","parameters":[{"schema":{"type":"string","description":"Reply request ID"},"required":true,"description":"Reply request ID","name":"requestId","in":"path"}],"responses":{"200":{"description":"Request status","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"request":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","request"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/webhook":{"get":{"tags":["inbox"],"summary":"Inbound webhook configuration","description":"Custom header values are returned masked (valueHint).","responses":{"200":{"description":"Configuration","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"webhook":{"type":["object","null"],"properties":{},"additionalProperties":{}}},"required":["success","webhook"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Lookup failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"put":{"tags":["inbox"],"summary":"Create or update the inbound webhook","description":"url must be public HTTPS. Omitted fields (bodyFormat, stripQuotes, headers, template and other delivery options) keep their current values; null resets an option to its default. Use either signingSecret (32-256 characters) or rotateSecret; a generated secret is returned only once in the response.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"active":{"type":"boolean"},"bodyFormat":{"type":"string","description":"text \/ html \/ markdown"},"stripQuotes":{"type":"boolean"},"signingSecret":{"type":"string"},"rotateSecret":{"type":"boolean"},"headers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value":{"description":"Omit to keep the stored value of an existing header","type":"string"}},"required":["name"]},"description":"Custom request headers, at most 10. The list replaces all headers; values are stored encrypted and only returned masked."},"payloadMode":{"type":"string","enum":["raw","template"],"description":"raw sends the full email.received payload; template sends the rendered template"},"template":{"type":"string","description":"JSON template with {{variable}} placeholders: from, from_name, to, tag, subject, snippet, body_markdown, body_text, thread_id, message_id, internet_message_id, address_id, received_at, truncated, attachments_count, count, emails. Values are JSON-escaped, so put text variables inside quotes."},"bodyMaxChars":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Truncate the body to this many characters (100-20000, default 20000)"},"filters":{"type":"object","properties":{"toAddresses":{"description":"Default webhook only: only mail sent to these addresses (+tags match)","type":"array","items":{"type":"string"}},"fromInclude":{"description":"Only senders matching an address or domain","type":"array","items":{"type":"string"}},"fromExclude":{"description":"Skip senders matching an address or domain","type":"array","items":{"type":"string"}},"subjectInclude":{"description":"Only subjects containing one of these keywords","type":"array","items":{"type":"string"}},"subjectExclude":{"description":"Skip subjects containing one of these keywords","type":"array","items":{"type":"string"}},"skipAutomated":{"description":"Skip auto-replies, bulk\/list mail and bounces","type":"boolean"}},"description":"Which mail to send; omitted lists keep their values, null clears all filters"},"maxPerMinute":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"At most this many requests per minute (1-600); extra mail waits, it is not dropped"},"batchWindowSeconds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Wait this many seconds (10-3600) and merge mail that arrives meanwhile into one request; 0 sends each email on its own"},"maxAttempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Attempts before a delivery is marked failed (1-8, default 8)"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"webhook":{"type":"object","properties":{},"additionalProperties":{}},"signingSecret":{"type":"string"}},"required":["success","webhook"],"additionalProperties":{}}}}},"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"webhook":{"type":"object","properties":{},"additionalProperties":{}},"signingSecret":{"type":"string"}},"required":["success","webhook"],"additionalProperties":{}}}}},"400":{"description":"Invalid configuration","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Header encryption is not configured on the server","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"delete":{"tags":["inbox"],"summary":"Disable the inbound webhook (keeps configuration and history)","responses":{"200":{"description":"Disabled","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"disabled":{"type":"boolean"}},"required":["success","disabled"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/webhook\/test":{"post":{"tags":["inbox"],"summary":"Send a test event to the default inbound webhook","description":"Immediately sends one sample email to the endpoint exactly like a real delivery (template, custom headers, body length, signature; Mailly-Event-Type: webhook.test) and returns the receiver's status code and the first 4 KB of its response body, plus the request body that was sent. In raw mode the payload has the email.received shape with type webhook.test and test = true; the sample email is not stored, so content_url cannot be fetched. The optional JSON body can override url, bodyFormat, stripQuotes, headers, payloadMode, template and bodyMaxChars to try unsaved settings; nothing is saved. Works for disabled endpoints too; nothing is queued or retried.","requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"bodyFormat":{"type":"string"},"stripQuotes":{"type":"boolean"},"headers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value":{"description":"Omit to keep the stored value of an existing header","type":"string"}},"required":["name"]},"description":"Custom request headers, at most 10. The list replaces all headers; values are stored encrypted and only returned masked."},"payloadMode":{"type":"string","enum":["raw","template"],"description":"raw sends the full email.received payload; template sends the rendered template"},"template":{"type":"string","description":"JSON template with {{variable}} placeholders: from, from_name, to, tag, subject, snippet, body_markdown, body_text, thread_id, message_id, internet_message_id, address_id, received_at, truncated, attachments_count, count, emails. Values are JSON-escaped, so put text variables inside quotes."},"bodyMaxChars":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Truncate the body to this many characters (100-20000, default 20000)"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Test sent (check test.ok for the endpoint result)","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"test":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","test"],"additionalProperties":{}}}}},"400":{"description":"Webhook url is no longer allowed, or invalid overrides","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Tested too recently","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/webhook\/endpoints":{"get":{"tags":["inbox"],"summary":"List per-address webhook endpoints","parameters":[{"schema":{"type":"string","description":"Only endpoints of this inbox address"},"required":false,"description":"Only endpoints of this inbox address","name":"address_id","in":"query"}],"responses":{"200":{"description":"Endpoints","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"endpoints":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","endpoints"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Lookup failed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"post":{"tags":["inbox"],"summary":"Add a webhook endpoint to an inbox address","description":"An address can have up to 10 endpoints; every active endpoint receives its own signed delivery. While an address has an active endpoint, its mail is no longer sent to the workspace default webhook. url must be public HTTPS and unique per address. A generated signing secret is returned only once.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"addressId":{"type":"string","description":"Inbox address ID"},"url":{"type":"string"},"active":{"type":"boolean"},"bodyFormat":{"type":"string","description":"text \/ html \/ markdown"},"stripQuotes":{"type":"boolean"},"signingSecret":{"type":"string"},"headers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value":{"description":"Omit to keep the stored value of an existing header","type":"string"}},"required":["name"]},"description":"Custom request headers, at most 10. The list replaces all headers; values are stored encrypted and only returned masked."},"payloadMode":{"type":"string","enum":["raw","template"],"description":"raw sends the full email.received payload; template sends the rendered template"},"template":{"type":"string","description":"JSON template with {{variable}} placeholders: from, from_name, to, tag, subject, snippet, body_markdown, body_text, thread_id, message_id, internet_message_id, address_id, received_at, truncated, attachments_count, count, emails. Values are JSON-escaped, so put text variables inside quotes."},"bodyMaxChars":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Truncate the body to this many characters (100-20000, default 20000)"},"filters":{"type":"object","properties":{"toAddresses":{"description":"Default webhook only: only mail sent to these addresses (+tags match)","type":"array","items":{"type":"string"}},"fromInclude":{"description":"Only senders matching an address or domain","type":"array","items":{"type":"string"}},"fromExclude":{"description":"Skip senders matching an address or domain","type":"array","items":{"type":"string"}},"subjectInclude":{"description":"Only subjects containing one of these keywords","type":"array","items":{"type":"string"}},"subjectExclude":{"description":"Skip subjects containing one of these keywords","type":"array","items":{"type":"string"}},"skipAutomated":{"description":"Skip auto-replies, bulk\/list mail and bounces","type":"boolean"}},"description":"Which mail to send; omitted lists keep their values, null clears all filters"},"maxPerMinute":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"At most this many requests per minute (1-600); extra mail waits, it is not dropped"},"batchWindowSeconds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Wait this many seconds (10-3600) and merge mail that arrives meanwhile into one request; 0 sends each email on its own"},"maxAttempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Attempts before a delivery is marked failed (1-8, default 8)"}},"additionalProperties":{}}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"endpoint":{"type":"object","properties":{},"additionalProperties":{}},"signingSecret":{"type":"string"}},"required":["success","endpoint"],"additionalProperties":{}}}}},"400":{"description":"Invalid configuration or endpoint limit reached","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Duplicate url for this address","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Header encryption is not configured on the server","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/webhook\/endpoints\/{endpointId}":{"get":{"tags":["inbox"],"summary":"Get a webhook endpoint","parameters":[{"schema":{"type":"string","description":"Webhook endpoint ID"},"required":true,"description":"Webhook endpoint ID","name":"endpointId","in":"path"}],"responses":{"200":{"description":"Endpoint","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"endpoint":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","endpoint"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"patch":{"tags":["inbox"],"summary":"Update a webhook endpoint","description":"Omitted fields keep their current values; null resets a delivery option to its default. Use either signingSecret or rotateSecret; a generated secret is returned only once.","parameters":[{"schema":{"type":"string","description":"Webhook endpoint ID"},"required":true,"description":"Webhook endpoint ID","name":"endpointId","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"active":{"type":"boolean"},"bodyFormat":{"type":"string","description":"text \/ html \/ markdown"},"stripQuotes":{"type":"boolean"},"signingSecret":{"type":"string"},"headers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value":{"description":"Omit to keep the stored value of an existing header","type":"string"}},"required":["name"]},"description":"Custom request headers, at most 10. The list replaces all headers; values are stored encrypted and only returned masked."},"payloadMode":{"type":"string","enum":["raw","template"],"description":"raw sends the full email.received payload; template sends the rendered template"},"template":{"type":"string","description":"JSON template with {{variable}} placeholders: from, from_name, to, tag, subject, snippet, body_markdown, body_text, thread_id, message_id, internet_message_id, address_id, received_at, truncated, attachments_count, count, emails. Values are JSON-escaped, so put text variables inside quotes."},"bodyMaxChars":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Truncate the body to this many characters (100-20000, default 20000)"},"filters":{"type":"object","properties":{"toAddresses":{"description":"Default webhook only: only mail sent to these addresses (+tags match)","type":"array","items":{"type":"string"}},"fromInclude":{"description":"Only senders matching an address or domain","type":"array","items":{"type":"string"}},"fromExclude":{"description":"Skip senders matching an address or domain","type":"array","items":{"type":"string"}},"subjectInclude":{"description":"Only subjects containing one of these keywords","type":"array","items":{"type":"string"}},"subjectExclude":{"description":"Skip subjects containing one of these keywords","type":"array","items":{"type":"string"}},"skipAutomated":{"description":"Skip auto-replies, bulk\/list mail and bounces","type":"boolean"}},"description":"Which mail to send; omitted lists keep their values, null clears all filters"},"maxPerMinute":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"At most this many requests per minute (1-600); extra mail waits, it is not dropped"},"batchWindowSeconds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Wait this many seconds (10-3600) and merge mail that arrives meanwhile into one request; 0 sends each email on its own"},"maxAttempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Attempts before a delivery is marked failed (1-8, default 8)"},"rotateSecret":{"type":"boolean"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"endpoint":{"type":"object","properties":{},"additionalProperties":{}},"signingSecret":{"type":"string"}},"required":["success","endpoint"],"additionalProperties":{}}}}},"400":{"description":"Invalid configuration","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Duplicate url for this address","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Header encryption is not configured on the server","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"delete":{"tags":["inbox"],"summary":"Delete a webhook endpoint","description":"When an address has no active endpoint left, its mail falls back to the workspace default webhook. Its custom headers are deleted too.","parameters":[{"schema":{"type":"string","description":"Webhook endpoint ID"},"required":true,"description":"Webhook endpoint ID","name":"endpointId","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"removed":{"type":"boolean"}},"required":["success","removed"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/webhook\/endpoints\/{endpointId}\/test":{"post":{"tags":["inbox"],"summary":"Send a test event to a webhook endpoint","description":"Immediately sends one sample email to the endpoint exactly like a real delivery (template, custom headers, body length, signature; Mailly-Event-Type: webhook.test) and returns the receiver's status code and the first 4 KB of its response body, plus the request body that was sent. In raw mode the payload has the email.received shape with type webhook.test and test = true; the sample email is not stored, so content_url cannot be fetched. The optional JSON body can override url, bodyFormat, stripQuotes, headers, payloadMode, template and bodyMaxChars to try unsaved settings; nothing is saved. Works for disabled endpoints too; nothing is queued or retried.","parameters":[{"schema":{"type":"string","description":"Webhook endpoint ID"},"required":true,"description":"Webhook endpoint ID","name":"endpointId","in":"path"}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"bodyFormat":{"type":"string"},"stripQuotes":{"type":"boolean"},"headers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value":{"description":"Omit to keep the stored value of an existing header","type":"string"}},"required":["name"]},"description":"Custom request headers, at most 10. The list replaces all headers; values are stored encrypted and only returned masked."},"payloadMode":{"type":"string","enum":["raw","template"],"description":"raw sends the full email.received payload; template sends the rendered template"},"template":{"type":"string","description":"JSON template with {{variable}} placeholders: from, from_name, to, tag, subject, snippet, body_markdown, body_text, thread_id, message_id, internet_message_id, address_id, received_at, truncated, attachments_count, count, emails. Values are JSON-escaped, so put text variables inside quotes."},"bodyMaxChars":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Truncate the body to this many characters (100-20000, default 20000)"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Test sent (check test.ok for the endpoint result)","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"test":{"type":"object","properties":{},"additionalProperties":{}},"endpoint":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","test","endpoint"],"additionalProperties":{}}}}},"400":{"description":"Endpoint url is no longer allowed, or invalid overrides","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"Tested too recently","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/webhook\/deliveries":{"get":{"tags":["inbox"],"summary":"List inbound webhook deliveries","description":"One row per email and endpoint, newest first. Mail merged into one request shares a batchId. responseBody holds the first 2 KB of the receiver's last response. Mail skipped by endpoint filters is not listed.","parameters":[{"schema":{"type":"string","description":"whk_... for an address endpoint, or default for the workspace default webhook"},"required":false,"description":"whk_... for an address endpoint, or default for the workspace default webhook","name":"endpoint_id","in":"query"},{"schema":{"type":"string","description":"pending \/ delivering \/ retrying \/ delivered \/ failed"},"required":false,"description":"pending \/ delivering \/ retrying \/ delivered \/ failed","name":"status","in":"query"},{"schema":{"type":"string","description":"Only deliveries of this email"},"required":false,"description":"Only deliveries of this email","name":"email_id","in":"query"},{"schema":{"type":"string","description":"Default 20, max 100"},"required":false,"description":"Default 20, max 100","name":"limit","in":"query"},{"schema":{"type":"string","description":"nextCursor from the previous page"},"required":false,"description":"nextCursor from the previous page","name":"cursor","in":"query"}],"responses":{"200":{"description":"Deliveries","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deliveries":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"nextCursor":{"type":["string","null"]}},"required":["success","deliveries","nextCursor"],"additionalProperties":{}}}}},"400":{"description":"Invalid filter","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/webhook\/deliveries\/{deliveryId}\/redeliver":{"post":{"tags":["inbox"],"summary":"Redeliver an inbound webhook delivery","description":"Queues the email again with the endpoint's current url, secret and delivery options, resets the attempt count and sends it right away (unless the endpoint's batch window or per-minute limit holds it). Returns the updated delivery. A delivery that is being sent right now cannot be redelivered.","parameters":[{"schema":{"type":"string","description":"Delivery ID"},"required":true,"description":"Delivery ID","name":"deliveryId","in":"path"}],"responses":{"200":{"description":"Redelivered","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"delivery":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","delivery"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"The delivery is being sent right now","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/inbox\/webhook\/addresses\/{addressId}":{"put":{"tags":["inbox"],"summary":"Set the first webhook endpoint of an inbox address (legacy)","description":"Legacy single-subscription API: creates or updates the oldest endpoint of the address. Use \/inbox\/webhook\/endpoints to manage multiple endpoints. The signing secret is returned only on creation or rotateSecret.","parameters":[{"schema":{"type":"string","description":"Inbox address ID"},"required":true,"description":"Inbox address ID","name":"addressId","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"active":{"type":"boolean"},"bodyFormat":{"type":"string","description":"text \/ html \/ markdown"},"stripQuotes":{"type":"boolean"},"signingSecret":{"type":"string"},"rotateSecret":{"type":"boolean"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"subscription":{"type":"object","properties":{},"additionalProperties":{}},"signingSecret":{"type":"string"}},"required":["success","subscription"],"additionalProperties":{}}}}},"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"subscription":{"type":"object","properties":{},"additionalProperties":{}},"signingSecret":{"type":"string"}},"required":["success","subscription"],"additionalProperties":{}}}}},"400":{"description":"Invalid configuration","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Duplicate url for this address","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"get":{"tags":["inbox"],"summary":"Get the first webhook endpoint of an inbox address (legacy)","description":"Returns the oldest endpoint plus endpointCount. Use \/inbox\/webhook\/endpoints?address_id= to see all of them.","parameters":[{"schema":{"type":"string","description":"Inbox address ID"},"required":true,"description":"Inbox address ID","name":"addressId","in":"path"}],"responses":{"200":{"description":"Subscription configuration","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"subscription":{"type":["object","null"],"properties":{},"additionalProperties":{}},"endpointCount":{"type":"number"}},"required":["success","subscription","endpointCount"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"delete":{"tags":["inbox"],"summary":"Delete the first webhook endpoint of an inbox address (legacy)","description":"Deletes only the oldest endpoint. Once the address has no active endpoint, its mail falls back to the workspace default webhook.","parameters":[{"schema":{"type":"string","description":"Inbox address ID"},"required":true,"description":"Inbox address ID","name":"addressId","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"removed":{"type":"boolean"}},"required":["success","removed"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resource not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/mail-drafts":{"get":{"tags":["mail-drafts"],"summary":"Get a standalone mail draft","description":"Each pending draft includes review_url: a private link where a person can read the exact email (from, to, subject, body) and send or discard it without signing in. Anyone with the link can do that, so share it only with the person who should decide. It expires after review_expires_at, and stops working once the draft is sent, discarded or edited (an edit returns a new link). Other drafts have review_url null.","parameters":[{"schema":{"type":"string","maxLength":128},"required":false,"name":"thread_id","in":"query"}],"responses":{"200":{"description":"Draft action succeeded","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Draft or email not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Draft version or status has changed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Send result is unconfirmed; you can retry the same version","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"post":{"tags":["mail-drafts"],"summary":"Saves a host-drafted reply without calling a model or sending email","description":"Each pending draft includes review_url: a private link where a person can read the exact email (from, to, subject, body) and send or discard it without signing in. Anyone with the link can do that, so share it only with the person who should decide. It expires after review_expires_at, and stops working once the draft is sent, discarded or edited (an edit returns a new link). Other drafts have review_url null.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"anchor_email_id":{"type":"string","minLength":1,"maxLength":128},"text":{"type":"string","minLength":1,"maxLength":524288},"idempotency_key":{"type":"string","minLength":1,"maxLength":128},"cc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Cc addresses: comma-separated string or array. Replaces the current Cc when given."},"reply_all":{"type":"boolean","description":"Also Cc the anchor email's other To\/Cc recipients, excluding yourself. Resolved when the draft is saved."}},"required":["anchor_email_id","text","idempotency_key"]}}}},"responses":{"200":{"description":"Draft action succeeded","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Draft or email not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Draft version or status has changed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Send result is unconfirmed; you can retry the same version","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/mail-drafts\/{id}":{"get":{"tags":["mail-drafts"],"summary":"Get a draft","description":"Each pending draft includes review_url: a private link where a person can read the exact email (from, to, subject, body) and send or discard it without signing in. Anyone with the link can do that, so share it only with the person who should decide. It expires after review_expires_at, and stops working once the draft is sent, discarded or edited (an edit returns a new link). Other drafts have review_url null.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":128},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Draft action succeeded","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Draft or email not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Draft version or status has changed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Send result is unconfirmed; you can retry the same version","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"patch":{"tags":["mail-drafts"],"summary":"Edit a pending draft; the current version is required","description":"Each pending draft includes review_url: a private link where a person can read the exact email (from, to, subject, body) and send or discard it without signing in. Anyone with the link can do that, so share it only with the person who should decide. It expires after review_expires_at, and stops working once the draft is sent, discarded or edited (an edit returns a new link). Other drafts have review_url null.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":128},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":524288},"revision":{"type":"integer","exclusiveMinimum":0},"cc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Cc addresses: comma-separated string or array. Replaces the current Cc when given."}},"required":["text","revision"]}}}},"responses":{"200":{"description":"Draft action succeeded","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Draft or email not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Draft version or status has changed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Send result is unconfirmed; you can retry the same version","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/mail-drafts\/{id}\/discard":{"post":{"tags":["mail-drafts"],"summary":"Discard a pending draft","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":128},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0}},"required":["revision"]}}}},"responses":{"200":{"description":"Draft action succeeded","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Draft or email not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Draft version or status has changed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Send result is unconfirmed; you can retry the same version","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/mail-drafts\/{id}\/approve":{"post":{"tags":["mail-drafts"],"summary":"Approve and send a reviewed draft version","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":128},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0},"text":{"type":"string","minLength":1,"maxLength":524288}},"required":["revision","text"]}}}},"responses":{"200":{"description":"Draft action succeeded","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Draft or email not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Draft version or status has changed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Send result is unconfirmed; you can retry the same version","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/agents":{"get":{"tags":["agents"],"summary":"List agent profiles","description":"Includes run statistics (runs, drafts awaiting approval, failures, last run time). summary_prompt is null when the agent uses the default summary prompt for summary_locale; effective_summary_prompt is the prompt actually used.","responses":{"200":{"description":"Agent list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"agents":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","agents"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"post":{"tags":["agents"],"summary":"Create an agent profile","description":"mode is off \/ summarize \/ draft (auto opens after guardrail validation).","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Name, up to 100 characters"},"persona_prompt":{"type":"string","description":"Persona prompt, up to 8000 characters"},"mode":{"type":"string","description":"off \/ summarize \/ draft"},"address_id":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Inbox address ID to bind; null leaves it unbound"},"allowed_senders":{"type":"array","items":{"type":"string"},"description":"Sender allowlist, up to 100 entries"},"skills":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":900},"instructions":{"type":"string","minLength":1,"maxLength":16000},"enabled":{"type":"boolean"}},"required":["id","name","description","instructions","enabled"]},"maxItems":20,"description":"User-defined skills; an empty array deletes all skills"},"summary_prompt":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"description":"Summary prompt for evaluations, up to 4000 characters; null, blank, or a built-in default follows the workspace language"}},"additionalProperties":{}}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"id":{"type":"string"}},"required":["success","id"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Agent not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/agents\/preferences":{"put":{"tags":["agents"],"summary":"Set the workspace language for agent defaults","description":"Agents without a custom summary prompt use the default prompt for this language. Custom prompts are not changed.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"locale":{"type":"string","enum":["zh-CN","en-US"]}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Saved","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"summary_locale":{"type":"string"}},"required":["success","summary_locale"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/agents\/{id}":{"patch":{"tags":["agents"],"summary":"Update an agent profile","description":"Updates only the fields provided; pass address_id null to unbind, summary_prompt null to go back to the default summary prompt.","parameters":[{"schema":{"type":"string","description":"agent ID"},"required":true,"description":"agent ID","name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"persona_prompt":{"type":"string"},"mode":{"type":"string"},"address_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"allowed_senders":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"skills":{"type":"array","maxItems":20,"items":{"type":"object","properties":{"id":{"type":"string","maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":900},"instructions":{"type":"string","minLength":1,"maxLength":16000},"enabled":{"type":"boolean"}},"required":["id","name","description","instructions","enabled"]}},"summary_prompt":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"description":"Summary prompt for evaluations, up to 4000 characters; null, blank, or a built-in default follows the workspace language"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Agent not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"delete":{"tags":["agents"],"summary":"Delete an agent (with its evaluation records)","description":"Replies already sent stay in their threads and sent mail.","parameters":[{"schema":{"type":"string","description":"agent ID"},"required":true,"description":"agent ID","name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Agent not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/agents\/{id}\/console-token":{"post":{"tags":["agents"],"summary":"Issue a short-lived token for the agent conversation","description":"For direct browser connections to agent conversations; body.thread_id is optional: with it you get that thread conversation, otherwise the main conversation.","parameters":[{"schema":{"type":"string","description":"agent ID"},"required":true,"description":"agent ID","name":"id","in":"path"}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"thread_id":{"type":"string","description":"Inbox thread ID"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Token issued","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"url":{"type":"string"},"token":{"type":"string"},"expires_at":{"type":"number"},"name":{"type":"string"}},"required":["success","url","token","expires_at","name"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Agent not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/agents\/{id}\/memories":{"get":{"tags":["agents"],"summary":"List agent memories","parameters":[{"schema":{"type":"string","description":"agent ID"},"required":true,"description":"agent ID","name":"id","in":"path"}],"responses":{"200":{"description":"Memory list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"memories":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","memories"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"post":{"tags":["agents"],"summary":"Add an agent memory","parameters":[{"schema":{"type":"string","description":"agent ID"},"required":true,"description":"agent ID","name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"content":{"type":"string","description":"Memory content, up to 1000 characters"}},"additionalProperties":{}}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"id":{"type":"string"}},"required":["success","id"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Agent not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/agents\/{id}\/memories\/{memoryId}":{"delete":{"tags":["agents"],"summary":"Delete one memory","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"memoryId","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Memory not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/agents\/runs":{"get":{"tags":["agents"],"summary":"List evaluation runs","description":"Filters: agent_id \/ status \/ email_id \/ thread_id \/ approval_status; limit defaults to 100, max 200.","parameters":[{"schema":{"type":"string"},"required":false,"name":"agent_id","in":"query"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"email_id","in":"query"},{"schema":{"type":"string"},"required":false,"name":"thread_id","in":"query"},{"schema":{"type":"string"},"required":false,"name":"approval_status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Run list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"runs":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","runs"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"post":{"tags":["agents"],"summary":"Evaluate an inbound email manually","description":"Returns 409 if the agent already has a run for this email; clients should rerun instead.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"agent_id":{"type":"string"},"email_id":{"type":"string"}},"additionalProperties":{}}}}},"responses":{"202":{"description":"Accepted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"run_id":{"type":"string"}},"required":["success","run_id"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Agent or email not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"An evaluation already exists","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"Could not wake the agent","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/agents\/runs\/{id}\/rerun":{"post":{"tags":["agents"],"summary":"Rerun an evaluation","description":"Clears the previous result, returns to running, and wakes the agent. Approved or sent runs cannot be rerun; pending drafts are replaced by the new result.","parameters":[{"schema":{"type":"string","description":"run ID"},"required":true,"description":"run ID","name":"id","in":"path"}],"responses":{"202":{"description":"Accepted","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"run_id":{"type":"string"}},"required":["success","run_id"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Run not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"This run cannot be rerun in its current state","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"Could not wake the agent","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/agents\/runs\/{id}":{"get":{"tags":["agents"],"summary":"Run details (with draft and trace)","parameters":[{"schema":{"type":"string","description":"run ID"},"required":true,"description":"run ID","name":"id","in":"path"}],"responses":{"200":{"description":"Run details","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"run":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","run"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Run not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/agents\/runs\/{id}\/approve":{"post":{"tags":["agents"],"summary":"Approve and send a draft","description":"pending \u2192 approved \u2192 sent through the reply pipeline \u2192 sent; idempotency key agent-run:{runId}. body.text overrides the draft text.","parameters":[{"schema":{"type":"string","description":"run ID"},"required":true,"description":"run ID","name":"id","in":"path"}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"text":{"type":"string","description":"Override the draft body"},"cc":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Override the draft Cc (comma-separated string or array; empty removes it)"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Sent","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"run_id":{"type":"string"},"reply_id":{"type":"string"},"sent_message_id":{"type":["string","null"]}},"required":["success","run_id"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters or no draft","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Run not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Not awaiting approval","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/agents\/runs\/{id}\/discard":{"post":{"tags":["agents"],"summary":"Discard a draft","parameters":[{"schema":{"type":"string","description":"run ID"},"required":true,"description":"run ID","name":"id","in":"path"}],"responses":{"200":{"description":"Discarded","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Run not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Not awaiting approval","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/preferences":{"get":{"tags":["governance"],"summary":"Get recipient subscription preferences","parameters":[{"schema":{"type":"string","description":"Recipient email"},"required":false,"description":"Recipient email","name":"email","in":"query"}],"responses":{"200":{"description":"Preference list and status","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"preferences":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"status":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","preferences","status"],"additionalProperties":{}}}}},"400":{"description":"Missing email","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"put":{"tags":["governance"],"summary":"Set subscription preferences (unsubscribe or per-scope subscription)","description":"Use POST \/preferences\/resubscribe for workspace-level resubscribes; a workspace-level unsubscribe also marks the matching workflow contacts as suppressed.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"scope":{"type":"string","enum":["workspace","sender","topic"]},"senderEmail":{"type":"string","description":"Required when scope=sender"},"topic":{"type":"string","description":"Required when scope=topic"},"subscribed":{"type":"boolean"},"source":{"type":"string"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Preferences updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"preference":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","preference"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Use the resubscribe endpoint","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/preferences\/resubscribe":{"post":{"tags":["governance"],"summary":"Resubscribe (requires consent evidence)","description":"Restoring a workspace-level subscription requires a source and consent evidence (consentAt + consentReference).","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"email":{"type":"string","description":"Recipient email"},"scope":{"type":"string","enum":["workspace","sender","topic"],"description":"V1 supports only workspace"},"source":{"type":"string","description":"Resubscribe source, up to 100 characters"},"consentAt":{"anyOf":[{"type":"string"},{"type":"number"}],"description":"Consent time (ISO or epoch seconds)"},"consentReference":{"type":"string","description":"Consent evidence reference, up to 200 characters"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Resubscribed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Resubscribing is not allowed in the current state","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Conflict","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/suppressions":{"get":{"tags":["governance"],"summary":"Suppression list","parameters":[{"schema":{"type":"string","description":"Filter by recipient"},"required":false,"description":"Filter by recipient","name":"email","in":"query"}],"responses":{"200":{"description":"Suppression list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"suppressions":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","suppressions"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}},"post":{"tags":["governance"],"summary":"Add a suppression","requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"scope":{"type":"string","enum":["workspace","sender","topic"]},"senderEmail":{"type":"string"},"topic":{"type":"string"},"reason":{"type":"string","enum":["unsubscribed","hard_bounce","complaint","manual"]},"source":{"type":"string"},"campaignId":{"type":"string"},"messageId":{"type":"string"}},"additionalProperties":{}}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"id":{"type":"string"}},"required":["success","id"],"additionalProperties":{}}}}},"400":{"description":"Invalid parameters","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/suppressions\/{id}":{"delete":{"tags":["governance"],"summary":"Remove a suppression","parameters":[{"schema":{"type":"string","description":"suppression ID"},"required":true,"description":"suppression ID","name":"id","in":"path"}],"responses":{"200":{"description":"Removed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid API key","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"404":{"description":"Suppression not found","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/admin\/sending-controls":{"get":{"tags":["admin"],"summary":"List workspace sending controls","description":"Lists workspaces with sending-control records (paused, warned, given a daily limit, or evaluated for bounces\/complaints), with live 24h \/ 7d metrics.","parameters":[{"schema":{"type":"string","enum":["active","paused","warning"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Workspace list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"workspaces":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","workspaces"],"additionalProperties":{}}}}}}}},"\/admin\/sending-controls\/{workspace}":{"get":{"tags":["admin"],"summary":"Show workspace sending controls and audit log","parameters":[{"schema":{"type":"string","description":"Workspace ID (account email, case-insensitive, URL-encoded)"},"required":true,"description":"Workspace ID (account email, case-insensitive, URL-encoded)","name":"workspace","in":"path"}],"responses":{"200":{"description":"Workspace details","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"workspace":{"type":"object","properties":{},"additionalProperties":{}},"audit":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","workspace","audit"],"additionalProperties":{}}}}},"400":{"description":"Invalid workspace ID","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/admin\/sending-controls\/{workspace}\/pause":{"post":{"tags":["admin"],"summary":"Pause workspace sending manually","description":"While paused, every customer send from the workspace is rejected with workspace_sending_paused; queued messages that have not been sent fail when consumed and are not replayed after resuming.","parameters":[{"schema":{"type":"string","description":"Workspace ID (account email, case-insensitive, URL-encoded)"},"required":true,"description":"Workspace ID (account email, case-insensitive, URL-encoded)","name":"workspace","in":"path"}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"note":{"type":"string","description":"Pause note (optional)"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Paused (or already paused)","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"changed":{"type":"boolean"},"workspace":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","changed","workspace"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/admin\/sending-controls\/{workspace}\/resume":{"post":{"tags":["admin"],"summary":"Resume workspace sending manually","description":"A reason is required. After resuming, automatic evaluation counts only sends created after the resume and needs the minimum sample again before it can auto-pause.","parameters":[{"schema":{"type":"string","description":"Workspace ID (account email, case-insensitive, URL-encoded)"},"required":true,"description":"Workspace ID (account email, case-insensitive, URL-encoded)","name":"workspace","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","description":"Reason for resuming (required, written to the audit log)"}},"additionalProperties":{},"required":["reason"]}}}},"responses":{"200":{"description":"Resumed","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"changed":{"type":"boolean"},"workspace":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","changed","workspace"],"additionalProperties":{}}}}},"400":{"description":"Missing reason for resuming","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"Workspace is not paused","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/admin\/sending-controls\/{workspace}\/daily-limit":{"post":{"tags":["admin"],"summary":"Override or lift the workspace daily recipient limit","description":"`lifted: true` removes the limit; `limit: N` sets a custom rolling 24h limit (regardless of account age); `limit: null` returns to the default new-workspace policy.","parameters":[{"schema":{"type":"string","description":"Workspace ID (account email, case-insensitive, URL-encoded)"},"required":true,"description":"Workspace ID (account email, case-insensitive, URL-encoded)","name":"workspace","in":"path"}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"limit":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}],"description":"Custom limit; null returns to the default policy"},"lifted":{"type":"boolean","description":"true removes the limit"},"note":{"type":"string","description":"Note (optional)"}},"additionalProperties":{}}}}},"responses":{"200":{"description":"Updated","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"workspace":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","workspace"],"additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/admin\/ses-tenants":{"get":{"tags":["admin"],"summary":"List SES tenants","description":"Lists workspace tenant mappings (workspace_ses_tenants) and recorded resource associations for the system tenant, which is not in the mapping table.","parameters":[{"schema":{"type":"string","enum":["pending","active","failed"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Tenant list","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"tenants":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"counts":{"type":"object","properties":{},"additionalProperties":{}},"systemResources":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["success","tenants","counts","systemResources"],"additionalProperties":{}}}}}}}},"\/admin\/ses-tenants\/system\/provision":{"post":{"tags":["admin"],"summary":"Provision the system SES tenant","description":"Creates or reuses the system tenant (mailly-system by default) and associates the shared configuration set, the system sender domain (SYSTEM_EMAIL_FROM_DOMAIN), and the platform domain. Idempotent.","responses":{"200":{"description":"Provisioned","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"system":{"type":"object","properties":{},"additionalProperties":{}}},"required":["success","system"],"additionalProperties":{}}}}},"400":{"description":"Invalid system sender domain","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"SES_TENANT_PROVISIONING is not enabled on the queue","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"SES rate limited; retry later","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"AWS or queue failure","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Queue is missing AWS credentials or is not bound","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/admin\/ses-tenants\/{workspace}":{"get":{"tags":["admin"],"summary":"Show the workspace SES tenant and resource associations","parameters":[{"schema":{"type":"string","description":"Workspace ID (account email, case-insensitive, URL-encoded)"},"required":true,"description":"Workspace ID (account email, case-insensitive, URL-encoded)","name":"workspace","in":"path"}],"responses":{"200":{"description":"Tenant details (tenant is null if not provisioned)","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"tenant":{"type":["object","null"],"properties":{},"additionalProperties":{}}},"required":["success","tenant"],"additionalProperties":{}}}}},"400":{"description":"Invalid workspace ID","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}},"\/admin\/ses-tenants\/{workspace}\/provision":{"post":{"tags":["admin"],"summary":"Provision the workspace SES tenant","description":"Creates or reuses the workspace tenant and rechecks all resource associations (shared configuration set, platform domain, its verified sender domains). Idempotent; does not resume a paused tenant.","parameters":[{"schema":{"type":"string","description":"Workspace ID (account email, case-insensitive, URL-encoded)"},"required":true,"description":"Workspace ID (account email, case-insensitive, URL-encoded)","name":"workspace","in":"path"}],"responses":{"200":{"description":"Tenant is active","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"tenant":{"type":["object","null"],"properties":{},"additionalProperties":{}}},"required":["success","tenant"],"additionalProperties":{}}}}},"400":{"description":"Invalid workspace ID","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"409":{"description":"SES_TENANT_PROVISIONING is not enabled on the queue","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"429":{"description":"SES rate limited; retry later","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"502":{"description":"Provisioning failed (see tenant.lastError)","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}},"503":{"description":"Queue is missing AWS credentials or is not bound","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"false"},"error":{"type":"string"},"hint":{"type":"string","description":"Suggested next step, present when there is an obvious one"}},"required":["success","error"],"additionalProperties":{}}}}}}}}},"webhooks":{}}