Emails

REST endpoints for emails. Bearer-auth required.

GET /api/emails

List received emails.

Query parameters

  • limit (optional): Page size (1–100, default 100).
  • after (optional): Keyset cursor — return the page after this row (next page).
  • before (optional): Keyset cursor — return the page before this row (prev page).
  • ids (optional): Comma-separated list of IDs. Narrows results to these IDs within the caller's accessible scope (does not bypass access checks).
  • filter (optional): Nested filter expression (<Entity>Filter): AND/OR/NOT + per-field comparison operators + relation traversal. JSON-encoded on the query string.
  • orderBy (optional): Multi-key sort (<Entity>OrderBy[]): array of { field: direction } applied in order. Directions: asc/desc plus the four explicit nulls variants. JSON-encoded on the query string.
  • workspace_id (optional): Filter emails to this workspace.
  • include_deleted (optional): Soft-deleted email visibility. false (default) — active rows only. true — active plus soft-deleted. only — soft-deleted only.
  • body_preview_truncated (optional): Shorthand: filter where bodyPreviewTruncated equals this value.

Response

JSON
{
  "data": [
    {
      "id": "<...>",
      "workspaceId": "<...>",
      "messageId": "<...>",
      "inReplyTo": "<...>",
      "references": "<...>",
      "subject": "<...>",
      "from": "<...>",
      "sender": "<...>",
      "to": "<...>",
      "cc": "<...>",
      "bcc": "<...>",
      "replyTo": "<...>",
      "date": "<...>",
      "bodyPreview": "<...>",
      "bodyPreviewTruncated": "<...>",
      "rawSize": "<...>",
      "attachmentCount": "<...>",
      "receivedAt": "<...>",
      "createdAt": "<...>",
      "updatedAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}

GET /api/emails/{id}

Get email

Path parameters

  • id (required): The email's prefixed ID (e.g. eml_...).

Response

JSON
{
  "id": "string",
  "workspaceId": "string",
  "messageId": "string",
  "inReplyTo": "string",
  "references": "string",
  "subject": "string",
  "from": {
    "name": "<...>",
    "address": "<...>"
  },
  "sender": "any",
  "to": ["<...>"],
  "cc": ["<...>"],
  "bcc": ["<...>"],
  "replyTo": ["<...>"],
  "date": "string",
  "bodyPreview": "string",
  "bodyPreviewTruncated": "boolean",
  "rawSize": "number",
  "attachmentCount": "number",
  "receivedAt": "string",
  "createdAt": "string",
  "updatedAt": "string"
}

DELETE /api/emails/{id}

Soft-delete an email.

Path parameters

  • id (required): Email to soft-delete.

Response

JSON
{
  "success": "boolean"
}

DELETE /api/emails/{id}/purge

Permanently delete a soft-deleted email.

Path parameters

  • id (required): Soft-deleted email to permanently delete.

Response

JSON
{
  "success": "boolean"
}

POST /api/emails/{id}/restore

Restore a soft-deleted email

Restore a soft-deleted email. No-op if already active. 404 if the email has been purged.

Path parameters

  • id (required): The email's prefixed ID (e.g. eml_...).

Response

JSON
{
  "id": "string",
  "workspaceId": "string",
  "messageId": "string",
  "inReplyTo": "string",
  "references": "string",
  "subject": "string",
  "from": {
    "name": "<...>",
    "address": "<...>"
  },
  "sender": "any",
  "to": ["<...>"],
  "cc": ["<...>"],
  "bcc": ["<...>"],
  "replyTo": ["<...>"],
  "date": "string",
  "bodyPreview": "string",
  "bodyPreviewTruncated": "boolean",
  "rawSize": "number",
  "attachmentCount": "number",
  "receivedAt": "string",
  "createdAt": "string",
  "updatedAt": "string"
}