Skip to content

Page through a workspace's unrouted inbound emails.

GET
/api/workflows/email-unrouted/page
curl --request GET \
--url 'https://example.com/api/workflows/email-unrouted/page?workspace_id=2489E9AD-2EE2-8E00-8EC9-32D5F69181C0&direction=asc'

Returns one bounded window of inbound messages no workflow alias claimed, with the cursor of the next window. The cursor is present even when a window holds only mail of other workspaces, so a client can always continue the scan.

workspace_id
required
string format: uuid
cursor
string format: uuid
search
string
direction
string
Allowed values: asc desc

OK

Media typeapplication/json
object
cursor
string | null
items
required
Array<object>

Wrapper item used by list_unrouted_messages: the summary + whether this message looks like it belongs to the given workspace.

object
matches_workspace
required

true only when current or retained exact issued-recipient evidence names this workspace.

boolean
summary
required

A summary of one message in Unrouted/ – the row the admin UI renders.

object
from
required

From: value, verbatim.

string
mailbox_key

Opaque original account identity accompanying an actual live SELECT.

string | null
received_at
required

Best-effort received-at (the Date: header verbatim, since the IMAP INTERNALDATE differs across providers); empty when absent.

string
recipients
required

The full set of recipient header values (To, Delivered-To, X-Original-To) so an admin can see which alias was attempted.

Array<string>
subject
required

Subject: value – empty when absent.

string
uid
required

IMAP UID inside the Unrouted/ folder.

integer format: int32
uid_validity

Original SELECT generation accompanying this exact UID. Pure unscoped summary helpers omit it; live admin list items always provide it.

integer | null format: int32
mailbox_key
required
string
scan_complete
required
boolean
scanned
required
integer format: int64
total

Unknown until an authoritative full tenant count is available; scanned is not a total.

integer | null format: int64
uid_validity
required

The Unrouted folder’s UIDVALIDITY. 0 (never a real UIDVALIDITY, RFC 3501) only on the empty, complete first page of a mailbox whose Unrouted folder does not exist yet.

integer format: int32

Example generated

{
"cursor": "example",
"items": [
{
"matches_workspace": true,
"summary": {
"from": "example",
"mailbox_key": "example",
"received_at": "example",
"recipients": [
"example"
],
"subject": "example",
"uid": 1,
"uid_validity": 1
}
}
],
"mailbox_key": "example",
"scan_complete": true,
"scanned": 1,
"total": 1,
"uid_validity": 1
}

No central mailbox is configured, or the mailbox cannot open its Unrouted folder: it refused it, or the folder vanished between pages

Media typeapplication/json

The canonical JSON body of every error response. Every AppError serializes as this exact shape; code is the generated stable machine-readable vocabulary.

object
cap
One of:

Present only on an MCP budget refusal (429) — the refusing layer + retry hint.

object
layer
required

The refusing layer.

string
limit
required

The layer’s budget.

integer format: int64
retry_after_seconds

Seconds until a retry can pass, or null when it never will for this session.

integer | null format: int64
used
required

Calls already counted in the layer.

integer format: int64
code
required

Machine-readable, stable error code.

string
Allowed values: not_found unauthorized forbidden license_required license_expired fresh_auth_required source_not_released bad_request unprocessable precondition_failed conflict artifact_staging_busy artifact_staging_store_unavailable intervention_attachment_limit method_not_allowed rate_limited too_many_requests quota_exceeded mcp_cap_exceeded form_schema_invalid autosave_not_offered submit_not_offered idempotency_key_reused response_cap_reached required_missing database_error docker_error vault_error internal_error artifact_frames_unavailable identity_native_custody_unconfigured launch_concurrency_limit launch_already_active launch_not_pending launch_budget_exhausted launch_draining launch_side_effects_disabled launch_dispatch_disabled no_eligible_runner launch_image_unavailable pull_request_no_git_branch pull_request_no_project project_credential_missing project_credential_expired project_credential_revoked project_credential_substitution project_parent_credential_not_current project_lineage_invalid project_binding_missing project_binding_mismatch project_not_found project_capability_not_granted project_capability_unknown project_capabilities_required project_history_is_not_authority project_task_not_found project_task_project_missing project_task_not_active project_native_origin_missing project_broader_scope_required project_system_scope_required project_lifetime_invalid project_lifetime_not_finite project_lifetime_exceeds_maximum project_delegation_exceeds_parent project_renewal_not_allowed project_delegation_widened project_audience_mismatch project_deployment_claim_missing project_authority_disabled project_issuer_not_current project_operation_not_durable project_dispatch_gate_refused
details
One of:

Present only on a quota-exceeded 403 — the inline upgrade-CTA payload.

object
key
required

The entitlement feature key that was hit, e.g. apps.max_count.

string
limit
required

The plan’s limit for this key.

integer format: int64
upgrade_url
required

Where to send the user to upgrade.

string
used
required

Current usage (count or bytes, per the key).

integer format: int64
error
required

Human-readable message (the server’s English text; the client may localize by code).

string
launch
One of:

Present on a launch refusal (400/403/409) — the structured facts only the refusing class can fill: occupancy, exhausted budget, or required labels.

object
active

Weighted workspace slots already held by starting/running agent runs.

integer | null format: int64
cap_usd

The budget cap that refused.

number | null format: double
effective_spend_usd

Effective spend of the refusing budget scope (spend + in-flight reservations).

number | null format: double
max

The workspace’s configured agent-concurrency cap.

integer | null format: int64
provider

The provider whose budget cap refused; absent for the workspace-wide cap.

string | null
required_labels

Runner labels a fail-policy placement required and no runner offered.

Array<string>

Example

{
"code": "not_found"
}