Bulk send AR statements
accounting:readOperator-triggered bulk delivery of AR statements to many customer accounts at once.
Sends one statement email per eligible customer covering the requested period
(default: previous calendar month). Mirrors the same per-account loop the monthly
statement cron runs, with a richer report (batch summary + skipped reasons +
failed ids) and explicit account_ids / filter inputs.
Industry parity: NetSuite “Email Statements” bulk action, QuickBooks Online “Create Statements” multi-select send, Acumatica AR Customer Statements form.
Per-account gates (in order): (1) account must have an email on file, (2) email must not be a smoke / test domain, (3) 4-layer customer-email gate (entity disable / per-account opt-out / global unsubscribe / template unsubscribe; statement_email defaults to OFF entity-wide so the entity must explicitly opt in), (4) idempotency within a 30-day rolling window per (entity, recipient, statement_email).
Throttle: processed in chunks of 25 with a 50ms yield between chunks to respect the Postmark 10/sec rate limit. Same chunk size as the cron path.
Dry-run: pass dry_run: true to return the eligible recipient set without sending.
Used by the UI confirm modal to show batch count + per-account skip reasons up front.
Authorizations
API key issued per entity via Settings > Developers > API Keys.
Each key carries scopes (e.g. orders:read, products:write).
Bearer token format: Authorization: Bearer ark_live_ent_Test keys use ark_test_ent_. Both are issued per entity
via Settings > Developers > API Keys.
Body
Explicit list of customer account UUIDs to send to. When set, overrides filter.
Filter-driven eligibility when account_ids is omitted. Mirrors the AR Aging filter set.
Statement period start (ISO date). Defaults to first day of previous calendar month.
Statement period end (ISO date). Defaults to last day of previous calendar month.
Preview mode: returns eligible recipients with skip reasons without sending any email.

