# Email Manager — agent reference Base: https://mail-api.cloudcrew.si Contract audience: alien:email-manager ## Authentication | Surface | Header | |---------|--------| | /v1/* | Bearer em_… (org API key from desk) | | /actions, /mcp | Employee JWT, or Bearer alk_… → identity connector token | Optional: Idempotency-Key on POST /v1/emails and batch sends. ## MCP POST https://mail-api.cloudcrew.si/mcp Content-Type: application/json Authorization: Bearer em_… OR alk_… Same tools as the desk contract (send, domains, audiences, …). Prefer tool_search profile on chat; direct MCP uses the employee tool list. ## CLI alien-actions --url https://mail-api.cloudcrew.si/actions ## Public (no key) - GET https://mail-api.cloudcrew.si/docs - GET https://mail-api.cloudcrew.si/docs/openapi.json - GET https://mail-api.cloudcrew.si/help - GET https://mail-api.cloudcrew.si/public/deliverability - GET https://mail-api.cloudcrew.si/v1/unsubscribe/:token — one-click unsub (RFC 8058) ## /v1 — core routes ### health, stats - GET /v1/health → { object, delivery, status, setup, … } - GET /v1/stats → { object, sent, … } ### emails - GET /v1/emails ?q=&forEmployee=&label=&delivery=&group=thread - GET /v1/threads - GET /v1/emails/:id - POST /v1/emails { to, subject, text } | { template, to, vars } - POST /v1/emails/batch { emails: [...] } - POST /v1/emails/:id/labels { add, remove } ### domains - GET /v1/domains → { data: [...] } - POST /v1/domains { name } - POST /v1/domains/verify { name } - DELETE /v1/domains/:name ### api-keys - GET /v1/api-keys → { data: [{ id, name, prefix, domain }] } - POST /v1/api-keys { name, domain? } → { id, prefix, secret } (once) - DELETE /v1/api-keys/:id ### audiences & contacts - GET/POST /v1/audiences - GET /v1/audiences/:id - POST /v1/audiences/:id/contacts { email | emails, defaultTags? } - GET /v1/contacts ?tag= - POST /v1/contacts { email, name?, tags? } ### broadcasts - GET /v1/broadcasts - GET /v1/broadcasts/:id - POST /v1/broadcasts { name, subject, text, audienceId, segmentId?, scheduledAt? } - POST /v1/broadcasts/:id/send | /cancel ### webhooks - GET/POST /v1/webhooks - DELETE /v1/webhooks/:id - POST /v1/webhooks/:id/test - GET /v1/webhooks/:id/logs ### suppressions - GET/POST /v1/suppressions | /v1/suppression - DELETE /v1/suppression/:email ### errors 422 { message } — validation / gate (suppress, pause, rate) 401 — missing or invalid em_ key OpenAPI sketch: https://mail-api.cloudcrew.si/docs/openapi.json