Skip to content

POST · public

POST /api/v1/keys

Summary

Without Bearer, create an account, a full-access key, and a first inbox (the secret is returned once). username is optional. Omit it and Cooper picks box plus 8 hex characters. create_inbox false skips the inbox. The response includes address, inbox.email, and hint. hint says to save the key and address now and gives the curl command that lists unread mail. A later POST /api/v1/inboxes with the same username returns that inbox. With Bearer, mint another key. Body may include name, inbox_id, permissions, and ttl_hours or expires_at. permissions null means full access. Accepted names include draft_write (create, edit, and delete drafts; does not send) and draft_send (send one draft; does not create, edit, or delete drafts). POST and PATCH /api/v1/inboxes/:id/drafts accept message_send or draft_write. A key with only draft_send can PATCH send_at and cannot edit other fields. DELETE accepts message_delete, message_send, or draft_write. POST .../drafts/:draftId/send accepts message_send or draft_send. A key with only draft_write cannot send mail. Scheduling a draft (send_at) counts as sending and needs message_send or draft_send. HTTP 403 permission_denied with param send_at when it does not, and nothing is written. A restricted key can only grant a subset of its own permissions and cannot widen inbox scope. Unknown permission names return 400 invalid_permission. Revoke with DELETE /api/v1/keys/:id (works immediately, including the calling key). GET lists keys and never returns the secret.

Request

{
  "name": "agent-prod",
  "permissions": [
    "message_read",
    "message_send"
  ],
  "ttl_hours": 24
}

Response

The OpenAPI document does not declare a JSON response schema for this call. The summary is the contract.

Errors

  • HTTP 403 permission_denied
  • HTTP 400 invalid_permission

Idempotency

This route does not document Idempotency-Key or client_id.