Skip to content

POST · Bearer

POST /api/v1/webhooks

Summary

Register a URL for message.received, message.held, message.sent, message.blocked, message.bounced, message.complained, task.received, owner.reply, chat.message, domain.verified, draft.created, draft.approved, draft.rejected, draft.sent, account.sending_paused, account.sending_resumed, thread.assigned, and thread.unassigned. chat.message fires the moment the owner sends a message from the Cooper app; the same message is also delivered into the inbox as an email from the owner (label owner-chat), so message.received fires too. A hook receives a type only when its events list includes that type. The default remains message.received. thread.assigned and thread.unassigned carry the assignment object and previous_assignee, and they do not include a message body. message.held fires when screening is hold and the heuristic marks the mail suspicious. The message is stored. message.received fires for other stored inbound mail, and again when a held message is released. message.blocked fires when an allow or block list drops inbound mail, with inbox_id, from, subject, direction, and reason. message.bounced and message.complained fire when a delivery report matches an outbound message, with message_id, inbox_id, thread_id, bounce_type, and recipients. Optional headers (max 5, Authorization or X-*) are stored encrypted and sent on delivery; GET returns the names with values redacted. Optional inbox_id is stored into inbox_ids. inbox_ids accepts at most 10 inbox ids (400 too_many_inboxes). A hook matches when inbox_ids is empty or contains the event inbox. domain.verified, account.sending_paused, and account.sending_resumed have no inbox, so leave the filter empty to receive them. account.sending_paused fires once when sending pauses. account.sending_resumed fires once when it leaves paused. data is the sending_status object. The same client_id returns the original hook with HTTP 200 and the secret redacted. GET /api/v1/webhooks/:id returns one hook with the secret redacted the same way as the list. PATCH accepts enabled: false disables deliveries and sets disabled_reason manual; enabled true re-enables and resets consecutive_failures to 0. A final non-2xx after retries increments consecutive_failures. At 20 the hook sets enabled to 0, disabled_at, and disabled_reason consecutive_failures. Any 2xx resets consecutive_failures to 0. Deliveries send x-cooper-signature (sha256= HMAC-SHA256 of the raw body), x-cooper-timestamp (unix seconds), and x-cooper-signature-v2 (v1= plus hex HMAC-SHA256 of timestamp + "." + raw body). Reject a timestamp more than 5 minutes from now and dedupe on x-cooper-delivery. 5xx and network errors are retried twice. Every delivery is stored for 7 days.

Request

{
  "url": "https://example.com/hooks/cooper",
  "events": [
    "message.received",
    "task.received"
  ],
  "inbox_ids": [
    "inb_…"
  ],
  "client_id": "hook-1",
  "headers": {
    "Authorization": "Bearer …",
    "X-Tenant": "acme"
  }
}

Response

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

Errors

  • HTTP 400 too_many_inboxes

Idempotency

client_id makes this write idempotent. Sending the same client_id again returns the original object instead of creating a duplicate.