{"openapi":"3.1.0","info":{"title":"Ollastack API","version":"1.0.0","description":"Ollastack is a form backend for developers AND AI agents \u2014 plus agent mail (real inboxes your agents own).\n\n**Agents:** Authorize an agent in the dashboard, then POST to `\/api\/submit\/<endpointSlug>` with `Authorization: Bearer <your-token>`. Your agents submit cleanly while bots stay blocked. Submissions are tagged in the inbox with the agent's label so you can review or filter.\n\n**Humans:** Use cookie-based auth via `\/api\/auth\/login` for the dashboard, or issue personal API tokens for scripting.","contact":{"name":"Ollastack support","email":"hello@ollastack.com","url":"https:\/\/ollastack.com"},"license":{"name":"Proprietary"}},"servers":[{"url":"https:\/\/login.ollastack.com","description":"Production"}],"tags":[{"name":"agent","description":"Endpoints designed for AI-agent workflows. Highlighted in MCP servers and agent SDKs."},{"name":"submissions","description":"Submit, list, read, delete."},{"name":"forms","description":"Create + configure forms."},{"name":"webhooks","description":"Sign + deliver submission events."},{"name":"tokens","description":"Personal API tokens (issued by humans, used by humans or agents)."},{"name":"auth","description":"Cookie-session login for humans."},{"name":"orgs","description":"Organizations \/ workspaces."},{"name":"analytics","description":"Submission timeseries + spam rate."},{"name":"meta","description":"Discovery, health."},{"name":"mail","description":"Agent Mail \u2014 give an AI agent a real email identity it can send, receive, and reply from, with a spam-filtered inbox. Agent workflow: (1) GET \/api\/mailboxes\/check-handle?handle=<h> to verify availability; (2) POST \/api\/mailboxes {name, mode:'agent', handle:<h>} to claim <h>@agent.ollastack.com; (3) POST ...\/send to email out as that identity; (4) GET ...\/wait to long-poll inbound (never returns spam); (5) POST ...\/messages\/{id}\/reply to thread. 'test' mode gives a disposable random inbox on test.ollastack.com (unfiltered) for CI. Scopes are split per module so a CI token can't read or send as your real identity: mail.test:read|write|send for disposable inboxes, mail.agent:read|write|send for agent identities (:send covers send+reply and is separate from :write). Never granted by default."}],"paths":{"\/api\/health":{"get":{"operationId":"health","summary":"Health check","tags":["meta"],"responses":{"200":{"description":"Healthy","content":{"application\/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["healthy"]},"timestamp":{"type":"string","format":"date-time"},"uptime":{"type":"number"}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/health\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/version":{"get":{"operationId":"version","summary":"Running build version","description":"Reports the deployed build's identity \u2014 stamped at build time. Use it to confirm which commit is live (the runtime counterpart of \/opt\/formdev\/.deploy-sha). No auth, no secrets.","tags":["meta"],"responses":{"200":{"description":"Version info","content":{"application\/json":{"schema":{"type":"object","properties":{"version":{"type":"string","description":"Semver or 0.0.0+<commit>."},"commit":{"type":"string","description":"Short git SHA, or \"unknown\"."},"buildTime":{"type":"string","description":"ISO-8601 build timestamp, or \"unknown\"."}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/version\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/submit\/{endpointSlug}":{"post":{"operationId":"submitForm","summary":"Submit a form \u2014 anonymous or as an authorized agent","description":"Accepts JSON or form-encoded payload. When called with a valid Bearer credential scoped to the form's owner, the submission is recognized as authorized agent traffic and the spam-detection layer designed for anonymous callers is skipped \u2014 your per-form and account-level limits still apply.\n\nAnonymous submissions (no Bearer) go through the full anti-spam pipeline and must come from an allowed Origin if the form has `allowedOrigins` set.","tags":["submissions","agent"],"security":[{"bearerAuth":[]},{}],"parameters":[{"name":"endpointSlug","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SubmitPayload"}},"application\/x-www-form-urlencoded":{"schema":{"$ref":"#\/components\/schemas\/SubmitPayload"}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"id":{"type":"string"},"next":{"type":"string","nullable":true,"description":"Validated post-submit redirect URL."}}}}}},"400":{"description":"Validation error (missing required field, etc.)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Origin not allowed for this form","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Form not found or disabled","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Rate limit or quota exceeded","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/submit\/<endpointSlug>\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{}'"}]},"options":{"operationId":"submitFormPreflight","summary":"CORS preflight","tags":["submissions"],"parameters":[{"name":"endpointSlug","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"OK"}}}},"\/api\/auth\/register":{"post":{"operationId":"register","summary":"Register a new user account","tags":["auth"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["name","email","password","confirmPassword"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":8},"confirmPassword":{"type":"string"}}}}}},"responses":{"201":{"description":"Verification email sent"},"400":{"description":"Validation error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Account with this email already exists","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/auth\/register\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"string\",\"email\":\"you@example.com\",\"password\":\"string\",\"confirmPassword\":\"string\"}'"}]}},"\/api\/auth\/login":{"post":{"operationId":"login","summary":"Log in with email + password (sets cookie)","tags":["auth"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","format":"email"},"password":{"type":"string"}}}}}},"responses":{"200":{"description":"OK \u2014 session cookie set"},"401":{"description":"Invalid email or password","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Too many attempts \u2014 rate limited","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/auth\/login\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"email\":\"you@example.com\",\"password\":\"string\"}'"}]}},"\/api\/auth\/logout":{"post":{"operationId":"logout","summary":"Log out (clear session cookie)","tags":["auth"],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/auth\/logout\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/forms":{"get":{"operationId":"listForms","summary":"List the caller's forms","tags":["forms"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"projectId","in":"query","schema":{"type":"string"},"description":"Filter to forms filed under this project."}],"responses":{"200":{"description":"OK \u2014 paginated","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Form"}},"pagination":{"$ref":"#\/components\/schemas\/Pagination"}}}}}}}},"401":{"description":"Unauthorized","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"post":{"operationId":"createForm","summary":"Create a new form","description":"If `schemaJson` is provided, the form is template-seeded with those fields. Agents typically call this to scaffold a form for the human owner.","tags":["forms","agent"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CreateForm"}}}},"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#\/components\/schemas\/Form"}}}}}},"400":{"description":"Validation error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Unauthorized","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/forms\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"string\"}'"}]}},"\/api\/forms\/{id}":{"get":{"operationId":"getForm","summary":"Get a form by id","tags":["forms"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#\/components\/schemas\/Form"}}}}}},"404":{"description":"Form not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<id>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"patch":{"operationId":"updateForm","summary":"Update form settings","tags":["forms"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/UpdateForm"}}}},"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#\/components\/schemas\/Form"}}}}}},"400":{"description":"Validation error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PATCH \"https:\/\/login.ollastack.com\/api\/forms\/<id>\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"string\",\"projectId\":\"string\",\"notifyEmail\":\"you@example.com\",\"notifyEmails\":[\"you@example.com\"]}'"}]},"delete":{"operationId":"deleteForm","summary":"Soft-delete a form","tags":["forms"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/forms\/<id>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{id}\/clone":{"post":{"operationId":"cloneForm","summary":"Clone an existing form","tags":["forms"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#\/components\/schemas\/Form"}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/forms\/<id>\/clone\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{id}\/endpoint":{"post":{"operationId":"regenerateEndpoint","summary":"Regenerate the public endpoint slug (invalidates the old URL)","tags":["forms"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#\/components\/schemas\/Form"}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/forms\/<id>\/endpoint\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/builder":{"patch":{"operationId":"updateFormFields","summary":"Define or replace a form's fields","description":"Replaces the form's entire field list. This is the ONLY way to set form fields after creation \u2014 PATCH \/api\/forms\/{id} does not accept schemaJson. Send the complete desired field list; it is not a merge.","tags":["forms"],"security":[{"bearerAuth":["forms:write"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["schema"],"properties":{"schema":{"type":"array","maxItems":200,"items":{"$ref":"#\/components\/schemas\/BuilderFormField"}}}}}}},"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#\/components\/schemas\/Form"}}}}}},"400":{"description":"VALIDATION_ERROR \u2014 the field list failed schema validation.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"NOT_FOUND \u2014 form does not exist or is not owned by the caller.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PATCH \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/builder\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"schema\":[{\"id\":\"string\",\"type\":\"text\",\"label\":\"string\"}]}'"}]}},"\/api\/forms\/{formId}\/submissions":{"get":{"operationId":"listFormSubmissions","summary":"List submissions for a form","tags":["submissions"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK \u2014 paginated","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Submission"}},"pagination":{"$ref":"#\/components\/schemas\/Pagination"}}}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/submissions\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/submissions\/{submissionId}\/enrich":{"post":{"operationId":"enrichSubmission","summary":"AI triage of a submission (category, sentiment, summary, reply)","description":"Runs AI lead enrichment on the submission and returns structured triage: category, sentiment, urgency, a one-line summary, extracted entities, and a suggested reply. On-demand (never on the submit hot path); the result is not stored. Returns 503 if AI enrichment is not enabled on this server.","tags":["submissions","agent"],"security":[{"bearerAuth":["submissions:write"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"submissionId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","properties":{"labels":{"type":"array","items":{"type":"string"},"description":"Optional closed set the category must be chosen from."}}}}}},"responses":{"200":{"description":"{ submissionId, model, enrichment: { category, sentiment, urgency, summary, entities, suggestedReply } }"},"404":{"description":"Form or submission not found \/ not owned","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"502":{"description":"AI provider temporarily unavailable","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"503":{"description":"AI enrichment is not enabled on this server","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/submissions\/<submissionId>\/enrich\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"labels\":[\"string\"]}'"}]}},"\/api\/forms\/{formId}\/submissions\/{submissionId}":{"get":{"operationId":"getSubmission","summary":"Get a single submission","tags":["submissions"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"submissionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#\/components\/schemas\/Submission"}}}}}},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/submissions\/<submissionId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"patch":{"operationId":"updateSubmission","summary":"Mark as read\/spam, recover, set status, add tags","description":"Send exactly one action. `recover: true` un-flags a spam or ML-quarantined submission and re-sends the notification as a clean lead (idempotent \u2014 won't duplicate an already-delivered email).","tags":["submissions"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"submissionId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"isRead":{"type":"boolean"},"isSpam":{"type":"boolean"},"recover":{"type":"boolean","description":"Un-flag spam\/quarantine and re-notify"},"status":{"type":"string","enum":["new","read","archived"]},"tags":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#\/components\/schemas\/Submission"}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PATCH \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/submissions\/<submissionId>\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"isRead\":true,\"isSpam\":true,\"recover\":true,\"status\":\"new\"}'"}]},"delete":{"operationId":"deleteSubmission","summary":"Soft-delete a submission","tags":["submissions"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"submissionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/submissions\/<submissionId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/export":{"get":{"operationId":"exportSubmissions","summary":"Download submissions as CSV \/ Excel \/ JSON","description":"Returns a file attachment of non-spam submissions. csv and excel include id, created_at, every form field, and the geo columns (country\/city\/region\/postal_code\/latitude\/longitude\/timezone). excel is a real .xlsx workbook. json carries the same data plus the raw payload. Up to 50,000 rows.","tags":["submissions"],"security":[{"bearerAuth":["submissions:read"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"format","in":"query","schema":{"type":"string","enum":["csv","excel","xlsx","json"],"default":"csv"},"description":"Output format. xlsx is an alias of excel."},{"name":"from","in":"query","schema":{"type":"string","format":"date-time"},"description":"Only submissions on\/after this ISO timestamp."},{"name":"to","in":"query","schema":{"type":"string","format":"date-time"},"description":"Only submissions on\/before this ISO timestamp."}],"responses":{"200":{"description":"Exported file attachment.","content":{"text\/csv":{"schema":{"type":"string"}},"application\/json":{"schema":{"type":"array","items":{"type":"object"}}},"application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/export\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/analytics":{"get":{"operationId":"getFormAnalytics","summary":"Submission + spam timeseries for a form","tags":["analytics"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"days","in":"query","schema":{"type":"integer","default":30}}],"responses":{"200":{"description":"OK"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/analytics\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/rules":{"get":{"operationId":"listRules","summary":"List a form's workflow rules","tags":["rules"],"security":[{"bearerAuth":["forms:read"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Rule[]"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/rules\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"post":{"operationId":"createRule","summary":"Create a workflow rule (when a submission matches X, do Y)","description":"Runs best-effort AFTER a submission is stored. conditions: {field, op, value} (op: contains|not_contains|equals|not_equals|exists; field \"_spam\" = the spam flag), matched by matchType all|any. actions: {type:'add_tag', value} | {type:'set_status', value:'new'|'read'|'archived'} | {type:'webhook', event?} | {type:'notify_email', to, subject?} | {type:'slack', url}.","tags":["rules","agent"],"security":[{"bearerAuth":["forms:write"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["name","conditions","actions"],"properties":{"name":{"type":"string","maxLength":100},"enabled":{"type":"boolean"},"matchType":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"op":{"type":"string","enum":["contains","not_contains","equals","not_equals","exists"]},"value":{"type":"string"}}}},"actions":{"type":"array","items":{"type":"object"},"description":"add_tag | set_status | webhook | notify_email | slack"}}}}}},"responses":{"200":{"description":"The Rule"},"400":{"description":"Validation error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Form not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/rules\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"string\",\"conditions\":[{\"field\":\"string\",\"op\":\"contains\",\"value\":\"string\"}],\"actions\":[{}]}'"}]}},"\/api\/forms\/{formId}\/rules\/{ruleId}":{"patch":{"operationId":"updateRule","summary":"Update a workflow rule","tags":["rules"],"security":[{"bearerAuth":["forms:write"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"ruleId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"The Rule"},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PATCH \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/rules\/<ruleId>\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{}'"}]},"delete":{"operationId":"deleteRule","summary":"Delete a workflow rule","tags":["rules"],"security":[{"bearerAuth":["forms:write"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"ruleId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/rules\/<ruleId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/webhooks":{"get":{"operationId":"listWebhooks","summary":"List webhooks for a form","tags":["webhooks"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK \u2014 paginated","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Webhook"}},"pagination":{"$ref":"#\/components\/schemas\/Pagination"}}}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/webhooks\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"post":{"operationId":"createWebhook","summary":"Register a webhook","tags":["webhooks","agent"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CreateWebhook"}}}},"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#\/components\/schemas\/Webhook"}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/webhooks\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"url\":\"string\"}'"}]}},"\/api\/sms-inboxes":{"get":{"operationId":"listSmsInboxes","summary":"List your SMS test inboxes","tags":["sms"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"page","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"{ inboxes, total }"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/sms-inboxes\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"post":{"operationId":"createSmsInbox","summary":"Register a phone number as an SMS test inbox","description":"Inbound SMS to this number \u2014 relayed and HMAC-signed to \/api\/ingest\/sms \u2014 lands in this inbox with extracted OTP codes.","tags":["sms","agent"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["label","phoneNumber"],"properties":{"label":{"type":"string"},"phoneNumber":{"type":"string","description":"E.164, e.g. +14155550100."},"retentionDays":{"type":"integer","minimum":1,"maximum":90}}}}}},"responses":{"200":{"description":"The SmsInbox"},"400":{"description":"Validation error (bad number \/ already registered)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/sms-inboxes\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"label\":\"string\",\"phoneNumber\":\"string\"}'"}]}},"\/api\/sms-inboxes\/{inboxId}":{"get":{"operationId":"getSmsInbox","summary":"Get an SMS inbox","tags":["sms"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"inboxId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The SmsInbox"},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/sms-inboxes\/<inboxId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"delete":{"operationId":"deleteSmsInbox","summary":"Delete an SMS inbox","tags":["sms"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"inboxId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/sms-inboxes\/<inboxId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/sms-inboxes\/{inboxId}\/messages":{"get":{"operationId":"listSmsMessages","summary":"List received SMS (newest first, with extracted codes)","tags":["sms"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"inboxId","in":"path","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"{ messages, total }"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/sms-inboxes\/<inboxId>\/messages\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/sms-inboxes\/{inboxId}\/wait":{"get":{"operationId":"waitForSms","summary":"Long-poll for the next SMS","description":"Blocks up to `timeout` seconds and returns { message } the moment an SMS lands, or { message: null } on timeout. The CI primitive.","tags":["sms","agent"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"inboxId","in":"path","required":true,"schema":{"type":"string"}},{"name":"timeout","in":"query","schema":{"type":"integer"},"description":"1..55s (default 30)"},{"name":"since","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"body_contains","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"{ message | null }"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/sms-inboxes\/<inboxId>\/wait\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/uploads":{"get":{"operationId":"listUploads","summary":"List a form's uploads","tags":["uploads"],"security":[{"bearerAuth":["forms:read"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Form not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/uploads\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"post":{"operationId":"presignUpload","summary":"Get a presigned URL to upload a file directly to storage","description":"Returns { uploadId, uploadUrl, storageKey, expiresAt }. The client PUTs the file straight to uploadUrl (bytes never transit this API), then calls the confirm endpoint. Validated against the form's upload config.","tags":["uploads","agent"],"security":[{"bearerAuth":["forms:write"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["fieldId","filename","mimeType","sizeBytes"],"properties":{"fieldId":{"type":"string"},"filename":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer"}}}}}},"responses":{"200":{"description":"{ uploadId, uploadUrl, storageKey, expiresAt }"},"400":{"description":"Validation error (uploads off, size\/type not allowed)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Form not found \/ not owned","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"503":{"description":"Object storage is not enabled on this server","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/uploads\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"fieldId\":\"string\",\"filename\":\"string\",\"mimeType\":\"string\",\"sizeBytes\":0}'"}]}},"\/api\/forms\/{formId}\/uploads\/{uploadId}\/confirm":{"post":{"operationId":"confirmUpload","summary":"Mark an upload complete after PUTting the file","tags":["uploads","agent"],"security":[{"bearerAuth":["forms:write"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"uploadId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The Upload"},"404":{"description":"Form\/upload not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"503":{"description":"Object storage not enabled","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/uploads\/<uploadId>\/confirm\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/uploads\/{uploadId}\/download":{"get":{"operationId":"downloadUpload","summary":"Get a short-lived presigned download URL","tags":["uploads"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"uploadId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ url }"},"400":{"description":"Upload not completed","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Form\/upload not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"503":{"description":"Object storage not enabled","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/uploads\/<uploadId>\/download\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/uploads\/{uploadId}":{"delete":{"operationId":"deleteUpload","summary":"Delete an uploaded file","tags":["uploads"],"security":[{"bearerAuth":["forms:write"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"uploadId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Form\/upload not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"503":{"description":"Object storage not enabled","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/uploads\/<uploadId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/webhooks\/publish":{"post":{"operationId":"publishWebhookEvent","summary":"Publish a custom event to the form's webhook endpoints","description":"Deliver an arbitrary event + payload through the reliable webhook engine (HMAC-signed, auto-retried with backoff, replayable, logged) to every active endpoint on the form \u2014 or to a single webhookId. One immediate attempt is made per endpoint; failures fall into the retry queue. The body the subscriber receives is { event, formId, formName, publishedAt, data }, signed exactly like a submission event.","tags":["webhooks","agent"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["event","payload"],"properties":{"event":{"type":"string","maxLength":64,"description":"Short dotted name, e.g. \"order.shipped\"."},"payload":{"type":"object","description":"Arbitrary JSON object (max 256KB) delivered as `data`."},"webhookId":{"type":"string","description":"Optional: deliver to just this endpoint instead of all active ones."}}}}}},"responses":{"200":{"description":"Per-endpoint delivery results: { event, deliveries: [{ id, webhookId, url, outcome }] }. outcome is success | rescheduled | abandoned."},"400":{"description":"Validation error (bad event\/payload, or no active endpoint)."},"404":{"description":"Form or webhookId not found \/ not owned."}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/webhooks\/publish\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"event\":\"string\",\"payload\":{}}'"}]}},"\/api\/forms\/{formId}\/webhooks\/{webhookId}":{"patch":{"operationId":"toggleWebhook","summary":"Toggle a webhook on\/off","description":"Enables or disables delivery without losing config. This is a TOGGLE only \u2014 to change a webhook's URL or events, delete it and re-create it. A body without a boolean `isActive` returns 400 (not 500).","tags":["webhooks"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"webhookId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["isActive"],"properties":{"isActive":{"type":"boolean","description":"true = deliveries on, false = off."}}}}}},"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#\/components\/schemas\/Webhook"}}}}}},"400":{"description":"isActive (boolean) is required \u2014 toggle-only endpoint","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PATCH \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/webhooks\/<webhookId>\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"isActive\":true}'"}]},"delete":{"operationId":"deleteWebhook","summary":"Remove a webhook","tags":["webhooks"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"webhookId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/webhooks\/<webhookId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/webhooks\/{webhookId}\/deliveries":{"get":{"operationId":"listWebhookDeliveries","summary":"List delivery attempts for a webhook (newest first)","tags":["webhooks"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"webhookId","in":"path","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/webhooks\/<webhookId>\/deliveries\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/webhooks\/{webhookId}\/deliveries\/{deliveryId}\/replay":{"post":{"operationId":"replayWebhookDelivery","summary":"Re-send a past delivery's exact payload as a fresh delivery","description":"Creates a new delivery row with the original stored payload (the original is untouched), makes one immediate attempt, then falls into the retry queue on failure. Works on any past outcome.","tags":["webhooks"],"security":[{"bearerAuth":["forms:write"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"webhookId","in":"path","required":true,"schema":{"type":"string"}},{"name":"deliveryId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK \u2014 { delivery, outcome }"},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/webhooks\/<webhookId>\/deliveries\/<deliveryId>\/replay\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/submissions":{"get":{"operationId":"listAllSubmissions","summary":"Cross-form inbox (caller's submissions across all forms)","tags":["submissions"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"page","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer"}},{"name":"formId","in":"query","schema":{"type":"string"},"description":"Filter to a single form."},{"name":"tag","in":"query","schema":{"type":"string"}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string","enum":["new","read","archived"]}},{"name":"include_spam","in":"query","schema":{"type":"boolean"},"description":"Include spam-flagged rows alongside clean ones."},{"name":"onlySpam","in":"query","schema":{"type":"boolean"},"description":"Only hard-spam rows (hidden from the default inbox)."},{"name":"onlyQuarantine","in":"query","schema":{"type":"boolean"},"description":"Only ML-quarantined rows (delivered with a [Possible spam] banner)."}],"responses":{"200":{"description":"OK \u2014 paginated","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Submission"}},"pagination":{"$ref":"#\/components\/schemas\/Pagination"}}}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/submissions\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/analytics\/geo":{"get":{"operationId":"getGeoAnalytics","summary":"Cross-form visitor geography for the caller","description":"Aggregates non-spam submission geo across all the caller's forms (scoped by forms.userId). Response data: { total, withGeo, byCountry: [{country,count}], byCity: [{city,country,count}] }.","tags":["analytics"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer","default":90,"minimum":1,"maximum":365}}],"responses":{"200":{"description":"OK"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/analytics\/geo\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/orgs\/{orgId}\/sender-domain":{"get":{"operationId":"getSenderDomainStatus","summary":"Verification status of the org's custom sender domain","description":"Read-only. status: none | not_found | pending | verified. Does not provision \u2014 onboarding a new domain to the shared provider account is a gated operator step.","tags":["orgs"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/sender-domain\" \\\n  -b \"ollastack_session=$SESSION\""}]},"put":{"operationId":"setSenderDomain","summary":"Set the org's custom sender domain (paid)","tags":["orgs"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"name":{"type":"string"}}},"example":{"email":"noreply@acme.com","name":"Acme"}}}},"responses":{"200":{"description":"Status"},"403":{"description":"Paid plans only","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PUT \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/sender-domain\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"email\":\"noreply@acme.com\",\"name\":\"Acme\"}'"}]}},"\/api\/email-logs":{"get":{"operationId":"listEmailLogs","summary":"Caller's email deliverability feed + summary stats","description":"Notifications, autoresponders, and tests sent on the caller's behalf, scoped to your account. Response data includes { data, pagination, stats: { total, sent, failed, pending } }.","tags":["email"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"page","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer"}},{"name":"status","in":"query","schema":{"type":"string","enum":["sent","failed","pending"]}}],"responses":{"200":{"description":"OK"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/email-logs\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/email-logs\/test":{"post":{"operationId":"sendTestEmail","summary":"Send a deliverability test to the caller's own address","description":"Self-only \u2014 the recipient is always the authenticated user's email (not a relay). The send is logged to your deliverability feed.","tags":["email"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"responses":{"200":{"description":"OK \u2014 { success, provider, to, error }"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/email-logs\/test\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/activity":{"get":{"operationId":"listActivity","summary":"Caller's activity audit trail (forms, submissions, settings)","description":"Append-only history of the caller's own actions. Every entry carries the acting user \u2014 this never surfaces another tenant's events. New inbound submissions are NOT here (see \/api\/submissions).","tags":["activity"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"parameters":[{"name":"page","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer"}},{"name":"action","in":"query","schema":{"type":"string"},"description":"Exact action, e.g. submission.recovered"},{"name":"entityType","in":"query","schema":{"type":"string","enum":["form","submission","settings","user","email","upload"]}}],"responses":{"200":{"description":"OK"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/activity\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/user\/tokens":{"get":{"operationId":"listApiTokens","summary":"List the caller's API tokens (without plaintext)","tags":["tokens"],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/ApiToken"}}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/user\/tokens\" \\\n  -b \"ollastack_session=$SESSION\""}]},"post":{"operationId":"createApiToken","summary":"Issue a new API token (plaintext returned once)","tags":["tokens","agent"],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CreateApiToken"}}}},"responses":{"200":{"description":"Token created \u2014 plaintext returned once","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"token":{"type":"string","description":"Plaintext \u2014 shown only here."},"meta":{"$ref":"#\/components\/schemas\/ApiToken"},"warning":{"type":"string"}}}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/user\/tokens\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"string\"}'"}]}},"\/api\/user\/tokens\/{id}":{"delete":{"operationId":"revokeApiToken","summary":"Revoke an API token","tags":["tokens"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/user\/tokens\/<id>\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/user\/tokens\/{id}\/activity":{"get":{"operationId":"getTokenActivity","summary":"Recent activity for an API token (audit log)","description":"Most recent 50 audit rows. Every Bearer-authenticated API call writes one row (method, path, status, hashed IP, user-agent, timestamp). Used to investigate what an agent has been doing and to confirm a revoked token has truly stopped.","tags":["tokens"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"method":{"type":"string"},"path":{"type":"string"},"status":{"type":"integer"},"ipHash":{"type":"string","nullable":true},"userAgent":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}}}}}}}}},"404":{"description":"Token not found or not owned","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/user\/tokens\/<id>\/activity\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/orgs":{"get":{"operationId":"listOrgs","summary":"List the caller's organizations","tags":["orgs"],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK \u2014 paginated","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Organization"}},"pagination":{"$ref":"#\/components\/schemas\/Pagination"}}}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/orgs\" \\\n  -b \"ollastack_session=$SESSION\""}]},"post":{"operationId":"createOrg","summary":"Create an organization","tags":["orgs"],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#\/components\/schemas\/Organization"}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/orgs\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"string\"}'"}]}},"\/api\/orgs\/{orgId}\/members":{"get":{"operationId":"listTeam","summary":"List org members + pending invitations","description":"Returns { members, invitations, myRole }. Any member may read.","tags":["team"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ members, invitations, myRole }"},"404":{"description":"Not in this org","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/members\" \\\n  -b \"ollastack_session=$SESSION\""}]},"post":{"operationId":"inviteMember","summary":"Invite a teammate by email (admin\/owner)","description":"Creates a pending invitation + emails an accept link. Roles: viewer (read-only) | member | admin.","tags":["team","agent"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["viewer","member","admin"]}}}}}},"responses":{"200":{"description":"The invitation"},"403":{"description":"Not an admin","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"Already a member","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/members\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"email\":\"you@example.com\"}'"}]}},"\/api\/orgs\/{orgId}\/members\/{memberId}":{"patch":{"operationId":"updateMemberRole","summary":"Change a member's role (admin\/owner)","tags":["team"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"memberId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["role"],"properties":{"role":{"type":"string","enum":["viewer","member","admin"]}}}}}},"responses":{"200":{"description":"OK"},"403":{"description":"Not an admin","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PATCH \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/members\/<memberId>\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"role\":\"viewer\"}'"}]},"delete":{"operationId":"removeMember","summary":"Remove a member (admin\/owner), or leave (self)","tags":["team"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"memberId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/members\/<memberId>\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/orgs\/{orgId}\/invitations\/{invitationId}":{"delete":{"operationId":"revokeInvitation","summary":"Revoke a pending invitation (admin\/owner)","tags":["team"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"invitationId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/invitations\/<invitationId>\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/orgs\/{orgId}\/transfer-ownership":{"post":{"operationId":"transferOwnership","summary":"Transfer org ownership to a member (owner only)","description":"The target must already be a member. They become owner; you're demoted to admin.","tags":["team"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["userId"],"properties":{"userId":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"},"400":{"description":"Not a member \/ already owner","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Not the owner","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/transfer-ownership\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"userId\":\"string\"}'"}]}},"\/api\/invitations\/accept":{"post":{"operationId":"acceptInvitation","summary":"Accept a team invitation","description":"Joins the org for the token \u2014 only if your login email matches the invited email.","tags":["team"],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string"}}}}}},"responses":{"200":{"description":"{ orgId, orgName, role }"},"400":{"description":"Invalid\/expired","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Email mismatch","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/invitations\/accept\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"token\":\"string\"}'"}]}},"\/api\/orgs\/{orgId}\/projects":{"get":{"operationId":"listProjects","summary":"List an org's projects","description":"Each project includes counts: { forms, mailboxes }.","tags":["projects"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"{ projects, total }"},"404":{"description":"Org not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/projects\" \\\n  -b \"ollastack_session=$SESSION\""}]},"post":{"operationId":"createProject","summary":"Create a project in an org","tags":["projects","agent"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":100}}}}}},"responses":{"200":{"description":"The Project"},"404":{"description":"Org not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/projects\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"string\"}'"}]}},"\/api\/orgs\/{orgId}\/projects\/{projectId}":{"get":{"operationId":"getProject","summary":"Get a project (with counts)","tags":["projects"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The Project"},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/projects\/<projectId>\" \\\n  -b \"ollastack_session=$SESSION\""}]},"patch":{"operationId":"updateProject","summary":"Rename a project","tags":["projects"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100}}}}}},"responses":{"200":{"description":"The Project"},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PATCH \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/projects\/<projectId>\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"string\"}'"}]},"delete":{"operationId":"deleteProject","summary":"Delete a project (its forms\/mailboxes are unfiled, not deleted)","tags":["projects"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/projects\/<projectId>\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/orgs\/{orgId}\/smtp":{"get":{"operationId":"getOrgSmtp","summary":"Get the org's SMTP config (password masked)","description":"Returns null when no SMTP is configured. Password is never returned \u2014 re-enter on edit.","tags":["orgs"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/smtp\" \\\n  -b \"ollastack_session=$SESSION\""}]},"put":{"operationId":"putOrgSmtp","summary":"Upsert the org's SMTP config","description":"Password is encrypted with AES-256-GCM at rest. Submission notifications, autoresponders, and digests for this org's forms will route through this SMTP; failures transparently fall back to the platform sender.","tags":["orgs"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["host","port","username","password","fromEmail"],"properties":{"host":{"type":"string"},"port":{"type":"integer","minimum":1,"maximum":65535},"username":{"type":"string"},"password":{"type":"string"},"fromEmail":{"type":"string","format":"email"},"fromName":{"type":"string","nullable":true},"secure":{"type":"boolean","default":false}}}}}},"responses":{"200":{"description":"Saved","content":{"application\/json":{"schema":{"type":"object"}}}},"400":{"description":"Validation error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Org not found \/ not owned","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PUT \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/smtp\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"host\":\"string\",\"port\":0,\"username\":\"string\",\"password\":\"string\",\"fromEmail\":\"you@example.com\"}'"}]},"delete":{"operationId":"deleteOrgSmtp","summary":"Remove the org's SMTP config","tags":["orgs"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Removed"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/smtp\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/orgs\/{orgId}\/smtp\/test":{"post":{"operationId":"testOrgSmtp","summary":"Test the org's SMTP connection","description":"Opens a SMTP session and runs `verify()` (no mail is sent); the result updates the config's stored health status.","tags":["orgs"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Result","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":"string","nullable":true}}}}}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\/smtp\/test\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/openapi.json":{"get":{"operationId":"openapi","summary":"This document","tags":["meta"],"responses":{"200":{"description":"OpenAPI 3.1 document"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/openapi.json\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/forms\/{formId}\/stats":{"get":{"operationId":"getFormStats","summary":"Submission counts + recent activity for one form","tags":["analytics"],"security":[{"bearerAuth":["forms:read"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ total, unread, spam, last7Days, ... }"},"404":{"description":"Form not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/stats\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/failures":{"get":{"operationId":"listSubmissionFailures","summary":"Rejected submissions (rate-limit, captcha, origin, validation, spam)","description":"Every attempt blocked before it reached `submissions` \u2014 so the form owner can see lost enquiries. Fields: reason, detail, ipHash, payload snapshot, createdAt.","tags":["submissions"],"security":[{"bearerAuth":["submissions:read"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":25}}],"responses":{"200":{"description":"{ data, pagination }"},"404":{"description":"Form not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/failures\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/snippets":{"get":{"operationId":"getFormSnippets","summary":"Ready-to-paste HTML\/React\/fetch snippets for a form","tags":["forms"],"security":[{"bearerAuth":["forms:read"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ html, react, fetch, endpointUrl }"},"404":{"description":"Form not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/snippets\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/sparklines":{"get":{"operationId":"getFormSparklines","summary":"14-day submission sparkline series for the caller's forms","tags":["analytics"],"security":[{"bearerAuth":["forms:read"]},{"sessionCookie":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer","default":14}}],"responses":{"200":{"description":"{ [formId]: number[] }"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/sparklines\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/unread-counts":{"get":{"operationId":"getUnreadCounts","summary":"Unread submission count per form","tags":["analytics"],"security":[{"bearerAuth":["forms:read"]},{"sessionCookie":[]}],"responses":{"200":{"description":"{ [formId]: number }"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/unread-counts\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/integrations":{"get":{"operationId":"listIntegrations","summary":"List a form's outbound integrations","description":"Slack \/ Discord \/ Telegram \/ Mailchimp \/ Google Sheets pushes configured on the form.","tags":["forms"],"security":[{"bearerAuth":["forms:read"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Integration[]"},"404":{"description":"Form not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/integrations\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"post":{"operationId":"createIntegration","summary":"Add an integration to a form","tags":["forms","agent"],"security":[{"bearerAuth":["forms:write"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["type","config"],"properties":{"type":{"type":"string","enum":["slack","discord","telegram","mailchimp","google_sheets","apprise"]},"config":{"type":"object","description":"Provider-specific: { webhookUrl } for slack\/discord\/google_sheets; { botToken, chatId } for telegram; { apiKey, audienceId, dataCenter } for mailchimp; { serverUrl, urls | configKey } for apprise (fans out to 100+ services via a self-hosted Apprise API)."}}},"example":{"type":"slack","config":{"webhookUrl":"https:\/\/hooks.slack.com\/services\/T\/B\/xxx"}}}}},"responses":{"200":{"description":"The created integration"},"400":{"description":"Invalid config","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/integrations\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"type\":\"slack\",\"config\":{\"webhookUrl\":\"https:\/\/hooks.slack.com\/services\/T\/B\/xxx\"}}'"}]}},"\/api\/forms\/{formId}\/integrations\/{integrationId}":{"delete":{"operationId":"deleteIntegration","summary":"Remove an integration","tags":["forms"],"security":[{"bearerAuth":["forms:write"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}},{"name":"integrationId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted"},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/integrations\/<integrationId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/forms\/{formId}\/integrations\/google-sheets\/test":{"post":{"operationId":"testGoogleSheets","summary":"Validate a Google Sheets integration connection","tags":["forms"],"security":[{"bearerAuth":["forms:write"]},{"sessionCookie":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok: boolean }"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/forms\/<formId>\/integrations\/google-sheets\/test\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/orgs\/{orgId}":{"get":{"operationId":"getOrg","summary":"Get an org (incl. plan, quota, your role)","tags":["orgs"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ...org, formCount, myRole }"},"404":{"description":"Not found \/ no access","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\" \\\n  -b \"ollastack_session=$SESSION\""}]},"patch":{"operationId":"updateOrg","summary":"Rename an org \/ set custom sender (admin+)","tags":["orgs"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"customSenderEmail":{"type":"string","nullable":true},"customSenderName":{"type":"string","nullable":true}}},"example":{"name":"Acme Inc."}}}},"responses":{"200":{"description":"The org"},"403":{"description":"Requires admin role","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PATCH \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"Acme Inc.\"}'"}]},"delete":{"operationId":"deleteOrg","summary":"Delete an org (owner only)","tags":["orgs"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted"},"403":{"description":"Owner only","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/orgs\/<orgId>\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/user\/account":{"get":{"operationId":"getAccount","summary":"Current user's account","tags":["auth"],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"{ id, email, name, createdAt }"},"401":{"description":"Not authenticated","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/user\/account\" \\\n  -b \"ollastack_session=$SESSION\""}]},"patch":{"operationId":"updateAccount","summary":"Update the current user's profile","tags":["auth"],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}},"example":{"name":"Jane Dev"}}}},"responses":{"200":{"description":"Updated account"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PATCH \"https:\/\/login.ollastack.com\/api\/user\/account\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"Jane Dev\"}'"}]},"delete":{"operationId":"deleteAccount","summary":"Delete the current user's account","tags":["auth"],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Deleted"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/user\/account\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/user\/change-password":{"post":{"operationId":"changePassword","summary":"Change the current user's password","tags":["auth"],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["currentPassword","newPassword"],"properties":{"currentPassword":{"type":"string"},"newPassword":{"type":"string","minLength":8}}},"example":{"currentPassword":"old-pw","newPassword":"a-new-strong-pw"}}}},"responses":{"200":{"description":"Changed"},"400":{"description":"Wrong current password \/ weak new password","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/user\/change-password\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"currentPassword\":\"old-pw\",\"newPassword\":\"a-new-strong-pw\"}'"}]}},"\/api\/user\/sessions":{"get":{"operationId":"listSessions","summary":"List the current user's active sessions","tags":["auth"],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Session[]"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/user\/sessions\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/user\/sessions\/{sessionId}":{"delete":{"operationId":"revokeSession","summary":"Revoke one of the current user's sessions","tags":["auth"],"security":[{"sessionCookie":[]}],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Revoked"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/user\/sessions\/<sessionId>\" \\\n  -b \"ollastack_session=$SESSION\""}]}},"\/api\/billing\/plans":{"get":{"operationId":"listBillingPlans","summary":"Available subscription plans (DODO)","tags":["orgs"],"security":[{"bearerAuth":[]},{"sessionCookie":[]}],"responses":{"200":{"description":"{ provider: 'dodo', enabled, plans: [{ name, label, quota, currency, priceLabel }] }"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/billing\/plans\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/billing\/dodo\/subscribe":{"post":{"operationId":"createSubscription","summary":"Start a DODO checkout for a plan","tags":["orgs"],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["plan","orgId"],"properties":{"plan":{"type":"string"},"orgId":{"type":"string"}}},"example":{"plan":"solo","orgId":"<orgId>"}}}},"responses":{"200":{"description":"{ url } \u2014 redirect the user to the checkout session"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/billing\/dodo\/subscribe\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"plan\":\"solo\",\"orgId\":\"<orgId>\"}'"}]}},"\/api\/billing\/dodo\/cancel":{"post":{"operationId":"cancelSubscription","summary":"Cancel an org's subscription at period end","tags":["orgs"],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["orgId"],"properties":{"orgId":{"type":"string"}}},"example":{"orgId":"<orgId>"}}}},"responses":{"200":{"description":"Cancellation scheduled"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/billing\/dodo\/cancel\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"orgId\":\"<orgId>\"}'"}]}},"\/api\/billing\/dodo\/portal":{"post":{"operationId":"openBillingPortal","summary":"Get a DODO customer-portal link (card, invoices)","tags":["orgs"],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["orgId"],"properties":{"orgId":{"type":"string"}}},"example":{"orgId":"<orgId>"}}}},"responses":{"200":{"description":"{ link }"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/billing\/dodo\/portal\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"orgId\":\"<orgId>\"}'"}]}},"\/api\/auth\/forgot-password":{"post":{"operationId":"forgotPassword","summary":"Request a password-reset email","tags":["auth"],"security":[],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}},"example":{"email":"you@example.com"}}}},"responses":{"200":{"description":"Always 200 (no account enumeration)"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/auth\/forgot-password\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"email\":\"you@example.com\"}'"}]}},"\/api\/auth\/reset-password":{"post":{"operationId":"resetPassword","summary":"Complete a password reset with a token","tags":["auth"],"security":[],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["token","password"],"properties":{"token":{"type":"string"},"password":{"type":"string","minLength":8}}},"example":{"token":"<reset-token>","password":"a-new-strong-pw"}}}},"responses":{"200":{"description":"Reset"},"400":{"description":"Invalid\/expired token","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/auth\/reset-password\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"token\":\"<reset-token>\",\"password\":\"a-new-strong-pw\"}'"}]}},"\/api\/auth\/resend-verification":{"post":{"operationId":"resendVerification","summary":"Resend the email-verification link","tags":["auth"],"security":[],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}},"example":{"email":"you@example.com"}}}},"responses":{"200":{"description":"Sent (if unverified)"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/auth\/resend-verification\" \\\n  -b \"ollastack_session=$SESSION\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"email\":\"you@example.com\"}'"}]}},"\/api\/mailboxes":{"get":{"operationId":"listMailboxes","summary":"List mailboxes","tags":["mail"],"security":[{"bearerAuth":["mail.test:read"]},{"bearerAuth":["mail.agent:read"]},{"sessionCookie":[]}],"parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":25}},{"name":"mode","in":"query","description":"Filter by mailbox kind: 'agent' (persistent business identity, spam-filtered) or 'test' (disposable CI inbox, never filtered). Omit for both.","schema":{"type":"string","enum":["agent","test"]}},{"name":"projectId","in":"query","description":"Filter to mailboxes filed under this project.","schema":{"type":"string"}}],"responses":{"200":{"description":"Mailboxes owned by the caller.","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"mailboxes":{"type":"array","items":{"$ref":"#\/components\/schemas\/Mailbox"}},"total":{"type":"integer"}}}}}}}},"401":{"description":"Missing\/invalid auth or token lacks mail.test:read \/ mail.agent:read.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/mailboxes\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"post":{"operationId":"createMailbox","summary":"Create a mailbox (agent or test)","description":"agent mode: pass `handle` to claim a chosen address (your agent's identity) on the agent domain \u2014 spam-filtered, persistent. test mode (default): a disposable random address for CI. Any `+tag` variant routes to the same mailbox. Mailbox count is plan-capped.","tags":["mail","agent"],"security":[{"bearerAuth":["mail.test:write"]},{"bearerAuth":["mail.agent:write"]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CreateMailbox"},"example":{"name":"Support agent","mode":"agent","handle":"support"}}}},"responses":{"200":{"description":"The new mailbox (incl. address).","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/Mailbox"}}}}}},"400":{"description":"Validation error, plan cap reached, or module not configured.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Missing\/invalid auth or token lacks mail.test:write \/ mail.agent:write.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/mailboxes\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"Support agent\",\"mode\":\"agent\",\"handle\":\"support\"}'"}]}},"\/api\/mailboxes\/check-handle":{"get":{"operationId":"checkMailHandle","summary":"Check agent-address availability","description":"Live availability for the chosen agent identity. Does NOT reserve. reason is one of taken | reserved | invalid | agent_mail_disabled.","tags":["mail","agent"],"security":[{"bearerAuth":["mail.test:read"]},{"bearerAuth":["mail.agent:read"]},{"sessionCookie":[]}],"parameters":[{"name":"handle","in":"query","required":true,"schema":{"type":"string"}},{"name":"domain","in":"query","description":"Defaults to the platform agent domain.","schema":{"type":"string"}}],"responses":{"200":{"description":"Availability result.","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"available":{"type":"boolean"},"reason":{"type":"string","nullable":true,"enum":["taken","reserved","invalid","agent_mail_disabled"],"description":"Present only when available=false."},"address":{"type":"string","nullable":true,"description":"The full address the handle would resolve to."}}}}},"example":{"success":true,"data":{"available":true,"address":"support@agent.ollastack.com"}}}}},"401":{"description":"Missing\/invalid auth or token lacks mail.test:read \/ mail.agent:read.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/mailboxes\/check-handle\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/mailboxes\/{mailboxId}":{"get":{"operationId":"getMailbox","summary":"Get a mailbox","tags":["mail"],"security":[{"bearerAuth":["mail.test:read"]},{"bearerAuth":["mail.agent:read"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The mailbox.","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/Mailbox"}}}}}},"404":{"description":"Not found (or not owned by the caller \u2014 never disclosed which).","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"patch":{"operationId":"updateMailbox","summary":"Update a mailbox","tags":["mail"],"security":[{"bearerAuth":["mail.test:write"]},{"bearerAuth":["mail.agent:write"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/UpdateMailbox"}}}},"responses":{"200":{"description":"The updated mailbox.","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/Mailbox"}}}}}},"400":{"description":"Validation error (e.g. retentionDays above plan ceiling).","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PATCH \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"string\",\"isActive\":true,\"retentionDays\":0,\"webhookUrl\":\"string\"}'"}]},"delete":{"operationId":"deleteMailbox","summary":"Delete a mailbox","description":"Soft-delete. The slug is never reused; later mail for it lands in failures.","tags":["mail"],"security":[{"bearerAuth":["mail.test:write"]},{"bearerAuth":["mail.agent:write"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted."},"404":{"description":"Not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/mailboxes\/{mailboxId}\/messages":{"get":{"operationId":"listMailMessages","summary":"List received messages","description":"Newest first. Bodies are omitted in the list \u2014 GET a single message for content.","tags":["mail","agent"],"security":[{"bearerAuth":["mail.test:read"]},{"bearerAuth":["mail.agent:read"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":25,"maximum":100}},{"name":"q","in":"query","description":"Case-insensitive match on subject \/ from \/ recipient.","schema":{"type":"string"}},{"name":"unread","in":"query","schema":{"type":"boolean"}},{"name":"direction","in":"query","description":"Filter to received (inbound) or sent (outbound) messages.","schema":{"type":"string","enum":["inbound","outbound"]}},{"name":"received_after","in":"query","description":"ISO timestamp \u2014 only messages received after this instant.","schema":{"type":"string","format":"date-time"}},{"name":"spam","in":"query","description":"true = the Spam view (hard-spam only). Default hides hard spam from the normal list.","schema":{"type":"boolean"}},{"name":"tag","in":"query","description":"Per-run filter \u2014 matches the +<tag> subaddress in the recipient (slug+<tag>@). A CI run picks a unique tag to isolate its mail.","schema":{"type":"string"}}],"responses":{"200":{"description":"Messages (bodies omitted).","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"messages":{"type":"array","items":{"$ref":"#\/components\/schemas\/MailMessage"}},"total":{"type":"integer"}}}}}}}},"404":{"description":"Mailbox not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/messages\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"delete":{"operationId":"clearMailbox","summary":"Clear inbox \u2014 bulk-delete + purge every message","description":"Soft-deletes AND PII-purges all messages in the mailbox. Built for disposable test inboxes between CI runs. Returns { cleared: <count> }.","tags":["mail","agent"],"security":[{"bearerAuth":["mail.test:write"]},{"bearerAuth":["mail.agent:write"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK \u2014 { cleared }"},"404":{"description":"Mailbox not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/messages\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/mailboxes\/{mailboxId}\/messages\/{messageId}\/enrich":{"post":{"operationId":"enrichMailMessage","summary":"AI triage of a mail message (category, sentiment, summary, reply)","description":"Runs AI enrichment on the message and stores the result on it. Body (optional): { labels?: string[] }. 503 if AI isn't enabled on the server.","tags":["mail","agent"],"security":[{"bearerAuth":["mail.test:write"]},{"bearerAuth":["mail.agent:write"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ messageId, model, enrichment }"},"404":{"description":"Mailbox\/message not found"},"503":{"description":"AI enrichment not enabled on this server"}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/messages\/<messageId>\/enrich\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/mailboxes\/{mailboxId}\/messages\/{messageId}":{"get":{"operationId":"getMailMessage","summary":"Get a message (full bodies + codes\/links)","description":"Marks the message read.","tags":["mail","agent"],"security":[{"bearerAuth":["mail.test:read"]},{"bearerAuth":["mail.agent:read"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The message.","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/MailMessage"}}}}}},"404":{"description":"Mailbox or message not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/messages\/<messageId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"delete":{"operationId":"deleteMailMessage","summary":"Delete a message","description":"Soft-delete + PII purge (raw source, bodies, extracted codes\/links).","tags":["mail"],"security":[{"bearerAuth":["mail.test:write"]},{"bearerAuth":["mail.agent:write"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted and purged."},"404":{"description":"Mailbox or message not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/messages\/<messageId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/mailboxes\/{mailboxId}\/messages\/{messageId}\/attachments\/{index}":{"get":{"operationId":"getMailAttachment","summary":"Download an inbound attachment","description":"Returns a short-lived presigned `downloadUrl` for the attachment at the 0-based `index` in the message's `attachments` array \u2014 fetch it directly for the bytes. 404 if the attachment has no stored content (metadata only, e.g. object storage was unconfigured when the message arrived, or it's an outbound message).","tags":["mail","agent"],"security":[{"bearerAuth":["mail.test:read"]},{"bearerAuth":["mail.agent:read"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"}},{"name":"index","in":"path","required":true,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"A presigned download URL + attachment metadata.","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"downloadUrl":{"type":"string"},"filename":{"type":"string","nullable":true},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer"},"expiresInSeconds":{"type":"integer"}}}}}}}},"404":{"description":"Attachment not found or has no stored content.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/messages\/<messageId>\/attachments\/<index>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/mailboxes\/{mailboxId}\/wait":{"get":{"operationId":"waitForMailMessage","summary":"Long-poll for the next email","description":"Blocks until a matching message arrives or `timeout` elapses. Returns `{message}` immediately when one lands, `{message: null}` on timeout (HTTP 200 either way \u2014 loop on null). Returns the OLDEST unseen message after `since`; advance `since` to the returned message's receivedAt and re-call to drain a burst in arrival order. Max 55s per call; for longer waits, re-call with the same `since`. Typical CI flow: create mailbox -> trigger the email in your app -> wait -> read `message.codes[0]`.","tags":["mail","agent"],"security":[{"bearerAuth":["mail.test:read"]},{"bearerAuth":["mail.agent:read"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}},{"name":"timeout","in":"query","description":"Seconds to wait, 1-55. Default 30.","schema":{"type":"integer","default":30,"minimum":1,"maximum":55}},{"name":"since","in":"query","description":"ISO timestamp; only messages received after this. Defaults to request arrival.","schema":{"type":"string","format":"date-time"}},{"name":"subject_contains","in":"query","schema":{"type":"string"}},{"name":"to_contains","in":"query","description":"Match the envelope recipient \u2014 filter to one `+tag` variant.","schema":{"type":"string"}}],"responses":{"200":{"description":"Message or null-on-timeout.","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"message":{"oneOf":[{"$ref":"#\/components\/schemas\/MailMessage"},{"type":"null"}]}}}}}}}},"400":{"description":"Too many concurrent waits on this mailbox.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Mailbox not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/wait\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/mailboxes\/{mailboxId}\/send":{"post":{"operationId":"sendMail","summary":"Send an email FROM this mailbox","description":"Agent mail: sends from the mailbox's own address via the platform's outbound provider. Stored as direction=outbound with deliveryStatus. Set `sendAt` (future ISO time) to SCHEDULE the send (reminders\/follow-ups) \u2014 it's queued as deliveryStatus=scheduled and delivered by the drain; DELETE the message before then to cancel. Counts against this mailbox's monthly send quota (per-mailbox, separate from the received quota; a scheduled send reserves quota at schedule time). Requires the dedicated send scope for the mailbox's mode \u2014 mail.test:send or mail.agent:send; the matching :write scope does NOT grant sending.","tags":["mail","agent"],"security":[{"bearerAuth":["mail.test:send"]},{"bearerAuth":["mail.agent:send"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SendMail"},"example":{"to":"human@example.com","subject":"Your weekly agent report","text":"All systems nominal."}}}},"responses":{"200":{"description":"The stored outbound message.","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/MailMessage"}}}}}},"400":{"description":"Validation, send quota reached, or outbound not configured.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Missing\/invalid auth or token lacks mail.test:send \/ mail.agent:send.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Mailbox not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/send\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"to\":\"human@example.com\",\"subject\":\"Your weekly agent report\",\"text\":\"All systems nominal.\"}'"}]}},"\/api\/mailboxes\/{mailboxId}\/messages\/{messageId}\/reply":{"post":{"operationId":"replyMail","summary":"Reply to a received message","description":"Recipient defaults to the original sender; subject gets Re:; In-Reply-To\/References keep the thread intact in real mail clients. Requires mail.test:send \/ mail.agent:send.","tags":["mail","agent"],"security":[{"bearerAuth":["mail.test:send"]},{"bearerAuth":["mail.agent:send"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}},{"name":"messageId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ReplyMail"},"example":{"text":"Thanks \u2014 handled. Let me know if anything else comes up."}}}},"responses":{"200":{"description":"The stored outbound reply.","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/MailMessage"}}}}}},"400":{"description":"Validation, replying to an outbound message, or quota.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Mailbox or message not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/messages\/<messageId>\/reply\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"text\":\"Thanks \u2014 handled. Let me know if anything else comes up.\"}'"}]}},"\/api\/mailboxes\/{mailboxId}\/failures":{"get":{"operationId":"listMailIngestFailures","summary":"List ingest failures (lost mail)","tags":["mail"],"security":[{"bearerAuth":["mail.test:read"]},{"bearerAuth":["mail.agent:read"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":25}}],"responses":{"200":{"description":"Failure rows, newest first.","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"failures":{"type":"array","items":{"$ref":"#\/components\/schemas\/MailIngestFailure"}},"total":{"type":"integer"}}}}}}}},"404":{"description":"Mailbox not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/failures\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/mailboxes\/{mailboxId}\/webhook-deliveries":{"get":{"operationId":"listMailWebhookDeliveries","summary":"Webhook delivery log","description":"Recent mail.received webhook push attempts for this mailbox (newest first) so you can see whether your endpoint is receiving the signed pushes. Delivery is fire-and-forget (no retries) \u2014 for guaranteed capture, poll \/wait.","tags":["mail","agent"],"security":[{"bearerAuth":["mail.test:read"]},{"bearerAuth":["mail.agent:read"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Delivery attempts.","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#\/components\/schemas\/MailWebhookDelivery"}}}}}}}}},"404":{"description":"Mailbox not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/webhook-deliveries\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/mailboxes\/usage":{"get":{"operationId":"mailUsage","summary":"Mail usage + quotas + your domains","description":"This month's received\/sent counts vs your plan ceilings, plus the agent\/test\/BYO domains your mailboxes use. Call this to render meters or to learn agentDomain before creating an agent mailbox.","tags":["mail","agent"],"security":[{"bearerAuth":["mail.test:read"]},{"bearerAuth":["mail.agent:read"]},{"sessionCookie":[]}],"responses":{"200":{"description":"Usage summary.","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/MailUsage"}}},"example":{"success":true,"data":{"plan":"free","received":12,"receivedQuota":100,"sent":3,"sendQuota":50,"agentDomain":"agent.ollastack.com","testDomain":"test.ollastack.com","byoDomain":null}}}}},"401":{"description":"Missing\/invalid auth or token lacks mail.test:read \/ mail.agent:read.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/mailboxes\/usage\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}},"\/api\/mailboxes\/{mailboxId}\/rules":{"get":{"operationId":"listMailRules","summary":"List a mailbox's workflow rules","description":"Rules run best-effort right after an inbound message is stored (hard spam excluded): when a received message matches the conditions, the actions fire (mark read \/ AI-enrich \/ auto-reply \/ forward \/ webhook \/ notify-email).","tags":["mail","agent"],"security":[{"bearerAuth":["mail.agent:read"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The mailbox's rules (sortOrder, then created)."},"404":{"description":"Mailbox not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/rules\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]},"post":{"operationId":"createMailRule","summary":"Create a workflow rule on a mailbox","description":"conditions: {field, op, value} \u2014 field is one of from|subject|body|to|_spam; op is contains|not_contains|equals|not_equals|exists. actions: {type:'mark_read'} | {type:'enrich'} | {type:'auto_reply', body} | {type:'forward', to} (send onward from the mailbox identity; uses send quota) | {type:'webhook', url} (POST a lean summary, SSRF-guarded) | {type:'notify_email', to, subject?} (platform alert to a fixed inbox). matchType 'all' (default) requires every condition; 'any' requires one.","tags":["mail","agent"],"security":[{"bearerAuth":["mail.agent:write"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["name","conditions","actions"],"properties":{"name":{"type":"string"},"enabled":{"type":"boolean"},"matchType":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","enum":["from","subject","body","to","_spam"]},"op":{"type":"string","enum":["contains","not_contains","equals","not_equals","exists"]},"value":{"type":"string"}}}},"actions":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["mark_read","enrich","auto_reply","forward","webhook","notify_email"]},"body":{"type":"string","description":"Required for auto_reply."},"to":{"type":"string","format":"email","description":"Required for forward \/ notify_email."},"url":{"type":"string","format":"uri","description":"Required for webhook (SSRF-guarded)."},"subject":{"type":"string","description":"Optional for notify_email."}}}}}},"example":{"name":"Auto-reply to invoice requests","matchType":"all","conditions":[{"field":"subject","op":"contains","value":"invoice"}],"actions":[{"type":"auto_reply","body":"Thanks \u2014 your invoice is attached shortly."}]}}}},"responses":{"200":{"description":"The created rule."},"400":{"description":"Invalid rule.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Mailbox not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X POST \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/rules\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\":\"Auto-reply to invoice requests\",\"matchType\":\"all\",\"conditions\":[{\"field\":\"subject\",\"op\":\"contains\",\"value\":\"invoice\"}],\"actions\":[{\"type\":\"auto_reply\",\"body\":\"Thanks \u2014 your invoice is attached shortly.\"}]}'"}]}},"\/api\/mailboxes\/{mailboxId}\/rules\/{ruleId}":{"patch":{"operationId":"updateMailRule","summary":"Update a mailbox workflow rule","tags":["mail"],"security":[{"bearerAuth":["mail.agent:write"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}},{"name":"ruleId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","description":"Any subset of {name, enabled, matchType, conditions, actions, sortOrder}."}}}},"responses":{"200":{"description":"The updated rule."},"404":{"description":"Mailbox or rule not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X PATCH \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/rules\/<ruleId>\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{}'"}]},"delete":{"operationId":"deleteMailRule","summary":"Delete a mailbox workflow rule","tags":["mail"],"security":[{"bearerAuth":["mail.agent:write"]},{"sessionCookie":[]}],"parameters":[{"name":"mailboxId","in":"path","required":true,"schema":{"type":"string"}},{"name":"ruleId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted."},"404":{"description":"Mailbox or rule not found.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-codeSamples":[{"lang":"curl","label":"curl","source":"curl -X DELETE \"https:\/\/login.ollastack.com\/api\/mailboxes\/<mailboxId>\/rules\/<ruleId>\" \\\n  -H \"Authorization: Bearer $TOKEN\""}]}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Personal API token issued from the dashboard. Shown once on creation; pass as `Authorization: Bearer <your-token>`."},"sessionCookie":{"type":"apiKey","in":"cookie","name":"ollastack_session","description":"Browser session cookie set by \/api\/auth\/login. Agents should use bearerAuth instead."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","description":"Machine-readable error code. Agents key on this.","examples":["VALIDATION_ERROR","AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","NOT_FOUND","RATE_LIMIT_EXCEEDED","CONFLICT","ORIGIN_NOT_ALLOWED","INTERNAL_ERROR"]},"message":{"type":"string","description":"Human-readable message."},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"description":"Per-field validation errors when code=VALIDATION_ERROR."},"retryAfter":{"type":"integer","description":"Seconds to wait before retry, when code=RATE_LIMIT_EXCEEDED."}}}}},"Pagination":{"type":"object","properties":{"page":{"type":"integer","minimum":1},"limit":{"type":"integer","minimum":1,"maximum":100},"total":{"type":"integer","minimum":0},"totalPages":{"type":"integer","minimum":0},"hasNext":{"type":"boolean"},"hasPrev":{"type":"boolean"}}},"FormField":{"type":"object","required":["id"],"properties":{"id":{"type":"string","maxLength":64,"description":"Field name in the submissions payload."},"label":{"type":"string","maxLength":200},"type":{"type":"string","maxLength":32,"description":"Input type. The builder enforces a strict enum; creation is permissive."},"required":{"type":"boolean"},"placeholder":{"type":"string","maxLength":200},"options":{"type":"array","items":{"type":"string"},"maxItems":50,"description":"Choice values, for select\/radio."}}},"BuilderFormField":{"type":"object","required":["id","type","label"],"properties":{"id":{"type":"string","minLength":1,"description":"Field name in the submissions payload."},"type":{"type":"string","enum":["text","email","textarea","number","checkbox","select","radio","date","datetime","phone","url","hidden","file"]},"label":{"type":"string","minLength":1,"maxLength":100},"placeholder":{"type":"string","maxLength":200},"required":{"type":"boolean","default":false},"step":{"type":"integer","minimum":0,"maximum":20,"description":"Step index for multi-step forms."},"showIf":{"type":"object","description":"Conditional visibility rule.","required":["field","operator"],"properties":{"field":{"type":"string","description":"Another field's id."},"operator":{"type":"string","enum":["equals","not_equals","contains","truthy","not_truthy"]},"value":{"type":"string"}}},"options":{"type":"array","maxItems":100,"description":"Choices for select\/radio. Objects, not bare strings.","items":{"type":"object","required":["value","label"],"properties":{"value":{"type":"string"},"label":{"type":"string"}}}},"accept":{"type":"array","items":{"type":"string"},"maxItems":20,"description":"Accepted file types, for type=file."},"validation":{"type":"object","properties":{"min":{"type":"number"},"max":{"type":"number"},"minLength":{"type":"number"},"maxLength":{"type":"number"},"pattern":{"type":"string","description":"Regex the value must match."}}}}},"Form":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"orgId":{"type":"string","nullable":true},"name":{"type":"string"},"slug":{"type":"string","description":"Vanity slug used in \/f\/<slug>."},"endpointSlug":{"type":"string","description":"Public submit slug used at \/api\/submit\/<endpointSlug>."},"schemaJson":{"type":"array","items":{"$ref":"#\/components\/schemas\/FormField"}},"notifyEmail":{"type":"string","format":"email","nullable":true},"notifyEmails":{"type":"array","items":{"type":"string","format":"email"}},"ccEmails":{"type":"array","items":{"type":"string","format":"email"}},"bccEmails":{"type":"array","items":{"type":"string","format":"email"}},"emailSubjectTemplate":{"type":"string","nullable":true},"emailEnabled":{"type":"boolean"},"isActive":{"type":"boolean"},"submissionCount":{"type":"integer"},"successRedirectUrl":{"type":"string","format":"uri","nullable":true},"allowFileUploads":{"type":"boolean"},"maxFileSizeBytes":{"type":"integer","nullable":true},"maxFilesPerSubmission":{"type":"integer"},"allowedMimeTypes":{"type":"array","items":{"type":"string"}},"retentionDays":{"type":"integer","nullable":true},"captchaRequired":{"type":"boolean"},"allowedOrigins":{"type":"array","items":{"type":"string"},"description":"Public submit POSTs from other origins are 403'd unless empty array."},"autoresponderEnabled":{"type":"boolean"},"autoresponderSubject":{"type":"string","nullable":true},"autoresponderBodyHtml":{"type":"string","nullable":true},"customCss":{"type":"string","nullable":true,"description":"Per-form CSS rendered on \/f\/<slug>."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}}},"CreateForm":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100},"orgId":{"type":"string"},"projectId":{"type":"string","description":"File the new form under this project (must be in the form's org)."},"notifyEmail":{"type":"string","format":"email"},"schemaJson":{"type":"array","items":{"$ref":"#\/components\/schemas\/FormField"},"maxItems":50},"emailSubjectTemplate":{"type":"string","maxLength":200}}},"UpdateForm":{"type":"object","description":"Every form setting except the field list. All properties are optional \u2014 only the supplied ones change. To define form FIELDS use PATCH \/api\/forms\/{formId}\/builder instead; schemaJson is rejected here. One PATCH can set any combination of these.","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"projectId":{"type":"string","nullable":true,"description":"File (or null to unfile) the form under a project in its org."},"notifyEmail":{"type":"string","format":"email","nullable":true,"description":"Primary recipient (singular legacy field)."},"notifyEmails":{"type":"array","items":{"type":"string","format":"email"},"maxItems":20,"description":"Multi-recipient To list."},"ccEmails":{"type":"array","items":{"type":"string","format":"email"},"maxItems":20},"bccEmails":{"type":"array","items":{"type":"string","format":"email"},"maxItems":20},"emailEnabled":{"type":"boolean","description":"Master switch for submission notification emails."},"emailSubjectTemplate":{"type":"string","maxLength":200,"nullable":true,"description":"Supports {{form_name}} and any field id, e.g. {{name}}."},"notificationTemplateHtml":{"type":"string","maxLength":20000,"nullable":true,"description":"Custom notification email HTML. {{field}} placeholders supported."},"isActive":{"type":"boolean","description":"Inactive forms reject submissions."},"successRedirectUrl":{"type":"string","format":"uri","nullable":true},"retentionDays":{"type":"integer","minimum":0,"maximum":3650,"nullable":true,"description":"Auto-delete submissions after N days. 0 \/ null = keep forever."},"allowFileUploads":{"type":"boolean"},"maxFileSizeBytes":{"type":"integer","minimum":1024,"maximum":104857600,"description":"Per-file size cap in BYTES (e.g. 25 MB = 26214400)."},"maxFilesPerSubmission":{"type":"integer","minimum":1,"maximum":20},"allowedMimeTypes":{"type":"array","items":{"type":"string","maxLength":100},"maxItems":20},"captchaRequired":{"type":"boolean","description":"Enforce CAPTCHA. Needs a platform CAPTCHA provider configured to take effect."},"allowedOrigins":{"type":"array","items":{"type":"string","format":"uri"},"maxItems":20,"description":"Browser Origin allowlist. Empty = any origin. JSON array, not a comma string."},"autoresponderEnabled":{"type":"boolean","description":"Needs the submission payload to carry _replyto or an email field."},"autoresponderFromName":{"type":"string","maxLength":100,"nullable":true},"autoresponderSubject":{"type":"string","maxLength":200,"nullable":true},"autoresponderBodyHtml":{"type":"string","maxLength":20000,"nullable":true},"autoresponderBodyText":{"type":"string","maxLength":20000,"nullable":true},"customCss":{"type":"string","maxLength":16384,"nullable":true,"description":"CSS for the hosted form page."}}},"Submission":{"type":"object","properties":{"id":{"type":"string"},"formId":{"type":"string"},"payloadJson":{"type":"object","additionalProperties":true},"ip":{"type":"string","nullable":true},"userAgent":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"isSpam":{"type":"boolean"},"spamReason":{"type":"string","nullable":true},"isRead":{"type":"boolean"},"status":{"type":"string","enum":["new","read","archived"]},"tags":{"type":"array","items":{"type":"string"}},"submittedVia":{"type":"string","nullable":true,"description":"Provenance label. Identifies whether a submission came from an anonymous caller or an authenticated agent. Useful for filtering the inbox."},"submittedByTokenId":{"type":"string","nullable":true,"description":"Opaque identifier of the agent that submitted this entry, if any."},"createdAt":{"type":"string","format":"date-time"}}},"SubmitPayload":{"type":"object","description":"Any JSON payload. Field keys not prefixed with `_` map to form fields. Reserved magic fields: `_replyto` (sets Reply-To header), `_subject` (overrides email subject), `_next` (post-submit redirect URL \u2014 must match form.allowedOrigins or successRedirectUrl), `_gotcha` (honeypot \u2014 bots fill, humans don't).","additionalProperties":true,"examples":[{"name":"Alice","email":"alice@example.com","message":"Hi there","_replyto":"alice@example.com"}]},"ApiToken":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string","description":"First 8 chars of the plaintext token (for identification)."},"scopes":{"type":"array","items":{"type":"string","enum":["forms:read","forms:write","submissions:read","submissions:write","mail.test:read","mail.test:write","mail.test:send","mail.agent:read","mail.agent:write","mail.agent:send","mail:read","mail:write","mail:send"]}},"agentType":{"type":"string","enum":["human","agent"],"description":"Whether this token is held by a human or an authorized AI agent. Agent submissions go through cleanly while bots stay blocked."},"agentLabel":{"type":"string","nullable":true,"description":"Free-text agent name e.g. 'Claude', 'Cursor', 'Internal Bot'."},"lastUsedAt":{"type":"string","format":"date-time","nullable":true},"expiresAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"},"revokedAt":{"type":"string","format":"date-time","nullable":true}}},"CreateApiToken":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":64},"agentType":{"type":"string","enum":["human","agent"],"default":"human"},"agentLabel":{"type":"string","maxLength":64},"scopes":{"type":"array","items":{"type":"string","enum":["forms:read","forms:write","submissions:read","submissions:write","mail.test:read","mail.test:write","mail.test:send","mail.agent:read","mail.agent:write","mail.agent:send","mail:read","mail:write","mail:send"]},"description":"Defaults to [forms:read, forms:write] if omitted. Scopes are enforced \u2014 a token can only call routes its scopes permit. Mail scopes are split by function and never granted by default: mail.test:{read,write,send} = disposable test inboxes (Mail Testing); mail.agent:{read,write,send} = persistent agent identities (Agent Mail). A token scoped to one mode cannot touch the other. The mode-blind mail:{read,write,send} are DEPRECATED but still accepted (they span both modes)."},"expiresInDays":{"type":"integer","minimum":1,"description":"Token lifetime in days from creation. Omit for a non-expiring token."}}},"Webhook":{"type":"object","properties":{"id":{"type":"string"},"formId":{"type":"string"},"url":{"type":"string","format":"uri"},"isActive":{"type":"boolean"},"subscribedEvents":{"type":"array","items":{"type":"string","enum":["submission.created","submission.spam","submission.deleted"]}},"maxRetries":{"type":"integer"},"lastTriggeredAt":{"type":"string","format":"date-time","nullable":true},"lastStatus":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"}}},"CreateWebhook":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri","description":"Must be https (or http for ALLOW_PRIVATE_WEBHOOKS=true in dev only)."},"secret":{"type":"string","description":"Optional HMAC-SHA256 signing secret. If set, every delivery includes X-Ollastack-Signature: sha256=<hex>."},"events":{"type":"array","items":{"type":"string","enum":["submission.created","submission.spam","submission.deleted"]},"description":"Events to subscribe to. Omit for the default set. NOTE: the request field is `events`; the Webhook object echoes it back as `subscribedEvents`."}}},"Organization":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"ownerId":{"type":"string"},"plan":{"type":"string"},"submissionsQuotaMonthly":{"type":"integer"},"submissionsUsedThisPeriod":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"}}},"Mailbox":{"type":"object","description":"A logical email-testing inbox. Mail sent to `address` (including `+tag` variants, e.g. slug+ci-run-42@domain) is captured, parsed, and exposed via the messages API.","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string","description":"Address local-part. Random for test mode; the user-chosen handle for agent mode. Never reused on its domain."},"mode":{"type":"string","enum":["test","agent"],"description":"agent = persistent inbox with a chosen identity (spam-filtered); test = disposable CI inbox (unfiltered)."},"domain":{"type":"string","nullable":true,"description":"Receiving domain (agent \/ test subdomain, or a verified BYO domain)."},"address":{"type":"string","nullable":true,"description":"Full receiving address (`slug@domain`)."},"retentionDays":{"type":"integer","description":"Messages older than this are deleted + PII-purged by the retention cron."},"isActive":{"type":"boolean"},"messageCount":{"type":"integer"},"lastIngestAt":{"type":"string","format":"date-time","nullable":true,"description":"Last time the relay delivered mail here \u2014 the dead-relay signal."},"createdAt":{"type":"string","format":"date-time"}}},"MailMessage":{"type":"object","description":"A received email. `codes` and `links` are extracted at ingest \u2014 `codes[0]` is typically the OTP your test is waiting for.","properties":{"id":{"type":"string"},"mailboxId":{"type":"string"},"envelopeTo":{"type":"string","description":"SMTP RCPT TO (includes any +tag)."},"envelopeFrom":{"type":"string","nullable":true},"fromAddress":{"type":"string","nullable":true},"fromName":{"type":"string","nullable":true},"toAddresses":{"type":"array","items":{"type":"string"}},"subject":{"type":"string","nullable":true},"textBody":{"type":"string","nullable":true,"description":"Single-message GET only."},"htmlBody":{"type":"string","nullable":true,"description":"Single-message GET only."},"truncated":{"type":"boolean","description":"True if a body exceeded 1MB and was cut."},"attachments":{"type":"array","description":"Attachment metadata. Inbound attachment bytes (\u226410 MB) are stored when object storage is configured \u2014 fetch them via GET ...\/attachments\/{index} (0-based) for a short-lived download URL.","items":{"type":"object","properties":{"filename":{"type":"string","nullable":true},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer"}}}},"codes":{"type":"array","items":{"type":"string"},"description":"OTP\/verification codes extracted from the body, best match first."},"links":{"type":"array","items":{"type":"string"},"description":"URLs found in the body."},"isRead":{"type":"boolean"},"direction":{"type":"string","enum":["inbound","outbound"],"description":"inbound = received by the mailbox; outbound = sent from it."},"inReplyTo":{"type":"string","nullable":true,"description":"RFC822 threading."},"deliveryStatus":{"type":"string","nullable":true,"enum":["sent","failed","dry_run","scheduled","sending"],"description":"Outbound only. 'scheduled' = queued for a future sendAt (see scheduledAt); 'sending' = claimed by the drain; then 'sent'\/'failed'."},"scheduledAt":{"type":"string","format":"date-time","nullable":true,"description":"When a scheduled send will be delivered (set only while deliveryStatus=scheduled)."},"isSpam":{"type":"boolean","description":"Agent inboxes only: hard spam. Excluded from the normal list, \/wait, unread, and webhooks; visible via ?spam=true."},"spamReason":{"type":"string","nullable":true,"description":"Spam verdict detail. `quarantine:*` means delivered-but-flagged (ML-alone); other values accompany isSpam=true."},"receivedAt":{"type":"string","format":"date-time"}}},"MailAttachmentUpload":{"type":"object","required":["filename","content"],"description":"One outbound attachment. Total across attachments \u2264 10 MB.","properties":{"filename":{"type":"string","maxLength":255},"content":{"type":"string","description":"Base64-encoded file bytes."},"contentType":{"type":"string","description":"MIME type; defaults to application\/octet-stream."}}},"SendMail":{"type":"object","required":["to","subject"],"properties":{"to":{"type":"string","format":"email"},"subject":{"type":"string","maxLength":998},"text":{"type":"string","description":"Plain-text body. text and\/or html required."},"html":{"type":"string"},"attachments":{"type":"array","maxItems":20,"description":"Optional file attachments, \u226410 MB total. Not allowed with sendAt.","items":{"$ref":"#\/components\/schemas\/MailAttachmentUpload"}},"sendAt":{"type":"string","format":"date-time","description":"Optional ISO-8601 future time (\u226490 days). When set, the message is queued (deliveryStatus=scheduled) and delivered by the drain on\/after that time \u2014 use for reminders\/follow-ups. Cannot be combined with attachments."}}},"ReplyMail":{"type":"object","properties":{"text":{"type":"string","description":"text and\/or html required."},"html":{"type":"string"},"subject":{"type":"string","description":"Defaults to Re: <original subject>."},"attachments":{"type":"array","maxItems":20,"description":"Optional file attachments, \u226410 MB total.","items":{"$ref":"#\/components\/schemas\/MailAttachmentUpload"}}}},"MailIngestFailure":{"type":"object","description":"Mail that arrived for this mailbox but was NOT stored (quota, rate limit, parse error, oversize) \u2014 the lost-mail audit trail.","properties":{"id":{"type":"string"},"mailboxId":{"type":"string","nullable":true},"envelopeTo":{"type":"string","nullable":true},"reason":{"type":"string","enum":["unknown_mailbox","quota","rate_limit","parse_error","too_large","error"]},"detail":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}}},"CreateMailbox":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100},"mode":{"type":"string","enum":["test","agent"],"default":"test","description":"agent = persistent inbox with a chosen identity (spam-filtered); test = disposable random CI inbox."},"handle":{"type":"string","maxLength":64,"description":"Required for agent mode: the chosen address local-part (letters, numbers, dots, dashes). Globally unique per domain."},"domain":{"type":"string","description":"Optional agent-mode BYO domain (paid). Must match the org's verified custom sender domain; defaults to the platform agent domain."},"retentionDays":{"type":"integer","minimum":1,"maximum":365,"description":"Capped by plan (free 3, solo 30, team 90). Default min(30, plan max)."},"orgId":{"type":"string","description":"File the mailbox under a specific org you belong to (also sets the plan cap). Omitted => your default org. 403 if you're not a non-viewer member of it."}}},"UpdateMailbox":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"isActive":{"type":"boolean","description":"false pauses ingest (mail goes to failures)."},"retentionDays":{"type":"integer","minimum":1,"maximum":365},"webhookUrl":{"type":"string","nullable":true,"description":"Agent-mail push: signed POST (X-Mail-Signature: v1=<hex HMAC-SHA256 of the body with the mailbox's webhookSecret>) on every received message. https-only, private IPs rejected. null clears it."},"projectId":{"type":"string","nullable":true,"description":"File this AGENT mailbox under a project in its org (null = unfile). Test inboxes can't be filed."},"autoEnrich":{"type":"boolean","description":"Auto-run AI triage on every inbound message (stored on the message). Requires AI enabled on the server."},"webhookIncludePayload":{"type":"boolean","default":false,"description":"Inbound Parse: when true, the webhook body carries the FULL parsed message (see MailWebhookEvent) so you get structured JSON in one hop. Default false sends a lean nudge (ids + codes + links only) and you fetch the body via GET \/api\/mailboxes\/{id}\/messages\/{id} \u2014 safer if the webhook URL could leak."}}},"MailWebhookEvent":{"type":"object","description":"Body POSTed to a mailbox's webhookUrl on each received message. Signed: X-Mail-Signature: v1=<hex HMAC-SHA256(body, webhookSecret)> \u2014 verify it before trusting the payload. The message fields after `receivedAt` are present ONLY when the mailbox has webhookIncludePayload=true.","properties":{"event":{"type":"string","enum":["mail.received"]},"mailboxId":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"envelopeTo":{"type":"string"},"fromAddress":{"type":"string","nullable":true},"fromName":{"type":"string","nullable":true},"subject":{"type":"string","nullable":true},"codes":{"type":"array","items":{"type":"string"},"description":"Extracted OTP-style codes."},"links":{"type":"array","items":{"type":"string"}},"receivedAt":{"type":"string","format":"date-time"},"envelopeFrom":{"type":"string","nullable":true,"description":"Full payload only."},"to":{"type":"array","items":{"type":"string"},"description":"Full payload only."},"text":{"type":"string","nullable":true,"description":"Full payload only. Truncated at 1MB."},"html":{"type":"string","nullable":true,"description":"Full payload only. Truncated at 1MB."},"truncated":{"type":"boolean","description":"Full payload only: a body was over 1MB and clipped."},"attachments":{"type":"array","description":"Full payload only: metadata only ({filename, mimeType, sizeBytes}); bodies are not stored in v1.","items":{"type":"object"}},"messageId":{"type":"string","nullable":true,"description":"Full payload only: RFC822 Message-ID."},"inReplyTo":{"type":"string","nullable":true,"description":"Full payload only."},"references":{"type":"string","nullable":true,"description":"Full payload only."},"spamReason":{"type":"string","nullable":true,"description":"Full payload only: set when ML-quarantined."}}}}},"MailUsage":{"type":"object","description":"This month's mail usage vs your plan ceilings, plus the per-mode domains.","properties":{"plan":{"type":"string"},"received":{"type":"integer"},"receivedQuota":{"type":"integer","description":"0 = uncapped."},"sent":{"type":"integer"},"sendQuota":{"type":"integer","description":"0 = uncapped."},"agentDomain":{"type":"string","nullable":true,"description":"Domain for agent inboxes (null if agent mail is off)."},"testDomain":{"type":"string","nullable":true,"description":"Domain for disposable test inboxes."},"byoDomain":{"type":"string","nullable":true,"description":"Your verified custom domain, if any (paid)."}}},"MailWebhookDelivery":{"type":"object","description":"One mail.received webhook push attempt (delivery-health log).","properties":{"id":{"type":"string"},"messageId":{"type":"string","nullable":true},"status":{"type":"string","enum":["sent","failed"],"description":"sent = 2xx; failed = non-2xx or network error."},"statusCode":{"type":"integer","nullable":true},"error":{"type":"string","nullable":true},"attemptedAt":{"type":"string","format":"date-time"}}}}},"externalDocs":{"description":"Developer docs","url":"https:\/\/ollastack.com\/docs"}}