{"openapi":"3.1.0","info":{"title":"Cooper Email API","version":"1.0.0","summary":"API-first email for AI agents","description":"Create inboxes, send and receive mail over HTTP, and search the full mail database. Bearer API keys. Idempotent writes via client_id. extracted_text is the agent-facing body.","contact":{"name":"Avatar 8 LLC","email":"ops@avatar33.com"}},"servers":[{"url":"https://cooperemail.com","description":"This deployment"}],"tags":[{"name":"Auth"},{"name":"Inboxes"},{"name":"Messages"},{"name":"Search"},{"name":"Webhooks"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"},"param":{"type":"string"},"docs_url":{"type":"string"}},"required":["type","code","message"]}}},"Inbox":{"type":"object","properties":{"id":{"type":"string"},"username":{"type":"string"},"email":{"type":"string"},"display_name":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"Message":{"type":"object","properties":{"id":{"type":"string"},"inbox_id":{"type":"string"},"thread_id":{"type":"string"},"direction":{"enum":["inbound","outbound"]},"from":{"type":"string"},"to":{"type":"array","items":{"type":"string"}},"subject":{"type":"string"},"text":{"type":"string"},"html":{"type":"string","nullable":true},"extracted_text":{"type":"string"},"extracted_html":{"type":"string"},"preview":{"type":"string"},"status":{"enum":["queued","sent","received","failed"]},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"reply_to":{"type":"string","nullable":true},"in_reply_to":{"type":"string","nullable":true},"references":{"type":"array","items":{"type":"string"}},"labels":{"type":"array","items":{"type":"string"}},"provider":{"type":"string","nullable":true},"client_id":{"type":"string","nullable":true},"idempotent":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}}},"Attachment":{"type":"object","properties":{"id":{"type":"string"},"filename":{"type":"string"},"content_type":{"type":"string"},"content_id":{"type":"string","nullable":true},"disposition":{"enum":["inline","attachment"]},"size_bytes":{"type":"integer"},"url":{"type":"string"}}}}},"paths":{"/api/v1/onboard":{"post":{"tags":["Auth"],"summary":"Onboard: API key + inbox","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"username":{"type":"string"},"display_name":{"type":"string"},"key_name":{"type":"string"}},"required":["username"]}}}}}},"/api/v1/keys":{"post":{"tags":["Auth"],"summary":"Create an API key (signup-lite without Bearer; extra key with Bearer)","security":[]}},"/api/v1/inboxes":{"get":{"tags":["Inboxes"],"summary":"List inboxes"},"post":{"tags":["Inboxes"],"summary":"Create an inbox"}},"/api/v1/inboxes/{id}":{"get":{"tags":["Inboxes"],"summary":"Get inbox by id, username, or email"}},"/api/v1/inboxes/{id}/messages":{"get":{"tags":["Messages"],"summary":"List messages"},"post":{"tags":["Messages"],"summary":"Send a message (text, html, attachments)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"array","items":{"type":"string"}},"subject":{"type":"string"},"text":{"type":"string"},"html":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","properties":{"filename":{"type":"string"},"content_type":{"type":"string"},"content_base64":{"type":"string"},"content_id":{"type":"string"}},"required":["filename","content_base64"]}},"client_id":{"type":"string"}},"required":["to"]}}}}}},"/api/v1/inboxes/{id}/messages/{msgId}":{"get":{"tags":["Messages"],"summary":"Get a message (includes attachment metadata)"}},"/api/v1/inboxes/{id}/messages/{msgId}/attachments/{attId}":{"get":{"tags":["Messages"],"summary":"Download attachment bytes (Bearer)"}},"/api/v1/inboxes/{id}/inbound":{"post":{"tags":["Messages"],"summary":"Inject inbound mail for tests (Bearer)"}},"/api/v1/search":{"get":{"tags":["Search"],"summary":"Full-text search across stored mail","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string"}}]}},"/api/v1/webhooks":{"get":{"tags":["Webhooks"],"summary":"List webhooks"},"post":{"tags":["Webhooks"],"summary":"Register a webhook"}},"/api/v1/stats":{"get":{"tags":["Inboxes"],"summary":"Account analytics for the dashboard"}}},"security":[{"bearerAuth":[]}]}