API referenceMessages

Bulk-delete many mailbox messages in a single call

Permanently deletes up to 1000 mailbox messages named in messageIds in one call, removing each message and its stored bytes — the raw email plus every attachment.

Endpoint
POST https://api.dairo.app/v1/messages/batch-delete

Permanently deletes up to 1000 mailbox messages named in messageIds in one call, removing each message and its stored bytes — the raw email plus every attachment. Deletion is owner-scoped and partial-success: the response is { deleted: [...], failed: [{ id, error }] }, and a malformed, unknown, or foreign id lands in failed rather than aborting the batch. An empty messageIds, or more than 1000 ids, returns 400. This is irreversible and emits no webhook event; it requires the messages:read scope — the same scope that reads the mailbox, since the messages surface has no separate delete scope.

Scope: messages:read. Send the API key as a bearer token; Scopes lists what each one reaches.

Request

cURL
curl -X POST "https://api.dairo.app/v1/messages/batch-delete" \
  -H "Authorization: Bearer $DAIRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messageIds": [
      "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    ]
  }'

Body

Required, application/json: BatchDeleteMessagesRequest.

FieldTypeRequiredDescription
messageIdsarray of string (uuid)yesThe message ids to delete (1-1000). (min items 1, max items 1000)

Response

200 Success. Body: application/json, BatchDeleteResult.

FieldTypeRequiredDescription
object"batch_delete_result"yes
deletedarray of stringyesThe ids that were successfully deleted.
failedarray of objectyesPer-id failures; never aborts the rest of the batch.
200
{
  "object": "batch_delete_result",
  "deleted": [
    "string"
  ],
  "failed": [
    {
      "id": "string",
      "error": "string"
    }
  ]
}

Errors

Every error has the same body, {"error": {"type", "code", "message", "param"}}; branch on code. Errors lists every code.

StatusMeaning
400The request is malformed or a value is invalid (invalid_request, invalid_domain, idempotency_key_mismatch).
401The API key is missing or invalid.
403The key lacks the scope this endpoint needs (scope_missing) or may not do this (not_permitted).
422The request is well-formed but a field failed validation (validation_failed).
429Rate limit, plan limit, budget or spend cap reached (rate_limited, plan_limit_reached, budget_exceeded, spend_cap_reached).
500An unexpected error; retry with backoff, then contact support (internal_error).

On this page