Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DataTalksClub/datamailer/llms.txt
Use this file to discover all available pages before exploring further.
GET /api/contacts/{contact_id}/history gives your application a full scoped view of a contact’s email activity: every campaign they were included in, every transactional message sent to them, and every email event attached to their contact record. Results are scoped to the authenticated client’s audience so that one client cannot read another client’s send history for the same contact.
Endpoint
Authentication
Requires a Bearer token for the client whose slug is passed as theclient query parameter.
Path parameters
The internal Datamailer contact ID. Must be a contact that has a client-scoped subscription record in the specified audience.
Query parameters
Slug of the audience to scope campaign recipient history to.
Slug of the authenticated client. Scopes both campaign and transactional history.
Maximum number of email events to return per page. Must be between
1 and 100. Campaign recipients and transactional messages are also independently capped at limit rows — they are not paginated separately.Email event ID to paginate from. Pass the value of
next_cursor from the previous response to retrieve the next page of events. Omit for the first page.Response
Internal Datamailer contact ID.
Normalized (lowercased) email address of the contact.
Slug of the audience the history is scoped to.
Slug of the client the history is scoped to.
Campaign recipient records for this contact in campaigns belonging to the specified audience and client, ordered by
created_at descending. Capped at limit rows.Transactional messages sent to this contact by the authenticated client, ordered by
created_at descending. Capped at limit rows. Not audience-scoped — includes all transactional sends from this client to this contact.Email events for this contact scoped to the client and audience, ordered by event
id descending. Paginated via cursor and next_cursor.The event ID to pass as the
cursor query parameter to retrieve the next page of events. null when there are no further pages.Example
Request
Response
Paginating events
Passnext_cursor as the cursor parameter on the next request to retrieve older events:
Privacy: secret tracking tokens, unsubscribe token hashes, and delivery link tokens stored on
CampaignRecipient and TransactionalMessage records are never included in the history response. Only safe display fields are returned.Scope:
campaign_recipients is filtered to campaigns whose audience and client match the query parameters. transactional_messages is filtered by client only — transactional sends are not audience-scoped. events includes events where client matches or is null, and audience matches or is null, keeping provider webhook events (which may lack audience context) visible.Error codes
| Field | Error code | Meaning |
|---|---|---|
contact_id | not_found | No contact with that ID, or no client subscription in this audience. Returns HTTP 404. |
audience | required | audience was missing or blank. |
audience | not_found | No audience with that slug in the client’s organization. |
client | required | client was missing or blank. |
client | forbidden | client does not match the authenticated client. Returns HTTP 403. |
limit | must_be_integer | limit query parameter could not be parsed as an integer. |
limit | must_be_between_1_and_100 | limit is outside the allowed range of 1–100. |
cursor | must_be_integer | cursor query parameter could not be parsed as an integer. |
cursor | must_be_positive | cursor is less than 1. |