Skip to main content
POST
Email Activity Report
New to reports? See the Reports guide for what a report is and why generation is asynchronous.
This endpoint sends outbound email on the org’s behalf and packages every rep’s activity numbers into files that leave the system, so it’s gated like a management action rather than a plain read. Rendering the activity report needs WeasyPrint, which only the render-worker Docker image installs — the API image doesn’t — so this endpoint never renders anything itself. It queues an ActivityReportWorkflow on the Temporal CX_REPORTS_TASK_QUEUE and returns as soon as the workflow is accepted; the workflow does the fetch → render → email work asynchronously and lands the result in the caller’s inbox. Because the render dependencies are only installed in the render-worker image, this endpoint can 503 in any deployment where that workflow’s imports aren’t available — that’s an environment gap, not a request error.
The recipient is never a request field. The email address and display name are resolved server-side from the caller’s own identity (token.sub → Logto user lookup) — there’s no to/email field you can set on the body. Accepting an arbitrary address here would turn this into a way to mail an org’s entire activity history to anyone, off-org. If the caller’s Logto profile has no email address, the request fails with 400 rather than silently dropping the send.
The report window is always sent as explicit bounds rather than a relative phrase — this endpoint doesn’t interpret vocabulary like “this week” itself, so the caller resolves that into literal date_from/date_to plus pre-rendered display labels before sending the request.

Auth

Requires a CRM manage scope (any *:manage, e.g. deals:manage) and an active organization on the token. Gated on manage rather than read because it mails every rep’s numbers out of the app; viewing the same data in the Reports tab only needs CRM read.

Response

202 Accepted — the workflow was queued; delivery itself happens asynchronously.

Errors

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

The report window is sent as explicit bounds, never a relative phrase.

This endpoint does not interpret date vocabulary like "this week" — the caller resolves it into literal date_from/date_to plus the display labels it wants rendered, so the report reads exactly as the caller intended rather than re-deriving the window from a second definition that could drift.

date_from
string | null

Inclusive start of the report window (ISO date/datetime). Must be an explicit bound; relative phrases are not interpreted.

date_to
string | null

Inclusive end of the report window (ISO date/datetime). Must be an explicit bound; relative phrases are not interpreted.

period_long
string
default:""

Long display label for the window, e.g. "Last 7 days · 4 - 10 Aug 2026", rendered in the generated report's header.

period_short
string
default:""

Shorter display label for the same window, rendered where the report layout is narrow.

compare_long
string
default:""

Display label for the comparison period shown alongside the main window, if any.

types
string[] | null

Activity types to include (e.g. "call", "email"); omit or null for every type.

owner_ids
string[] | null

Logto user ids to scope the report to; omit or null for every rep.

formats
string[]

Row-export attachment formats to generate; only "xlsx" and "csv" are honored, anything else is silently dropped.

row_conditions
string[]

Raw PostgREST filter expressions applied to the row-level export, mirroring whatever feed filters (search/source/linkage) the caller had applied.

Response

Successful Response

The response is of type Response Email Activity Report Reports Activity Email Post · object.