Skip to main content
The Email API manages the configuration behind agents that answer email: the custom domains you send and receive from, the inbound addresses that route mail to an agent, and the unsubscribe ledger that suppresses future sends. Every route lives under the /core prefix and is scoped per organization. For how email agents work end to end, see /email/overview. For tokens and the X-Anyreach-Org header, see /api-reference/authentication.

Base URL and auth

https://api.anyreach.ai/core
Send Authorization: Bearer <token> on every request. User personal access tokens (pat_) must also send X-Anyreach-Org: <organization_id>; organization API keys (ak_) carry their org implicitly. Each endpoint additionally requires the scope listed below.

Endpoints

Email domains

A domain registers a custom sending and receiving domain with the email provider (Resend) and tracks its DNS verification status. Creating a domain calls the provider and returns the dns_records you must publish.
MethodPathScopeDescription
GET/email-domainsemail_domains:readList domains, newest first.
POST/email-domainsemail_domains:manageRegister a domain with the provider and return its DNS records.
GET/email-domains/{domain_id}email_domains:readFetch one domain.
POST/email-domains/{domain_id}/verifyemail_domains:manageInitiate provider DNS verification, then store the result.
POST/email-domains/{domain_id}/refreshemail_domains:readRe-read the current provider status and records without re-initiating verification.
DELETE/email-domains/{domain_id}email_domains:manageRemove the domain from the provider (best-effort) and delete the row.
POST /email-domains accepts:
FieldTypeDefaultDescription
domainstring(required)Custom domain, for example acme.com. Lowercased and validated.
providerstringresendEmail provider.
verify initiates verification and records verification_initiated_at. refresh only re-reads status and does not re-initiate, which makes it the right call for a passive status check.

Email addresses

An email address routes inbound mail to a specific agent. The address must be on the default inbound domain or on a domain your organization has already verified.
MethodPathScopeDescription
GET/email-addressesemail_addresses:readList addresses, enriched with the routed agent’s id, name, and version.
POST/email-addressesemail_addresses:manageCreate an inbound routing address.
PATCH/email-addresses/{address_id}email_addresses:manageUpdate routing, sender, or enabled state.
DELETE/email-addresses/{address_id}email_addresses:manageDelete the address.
POST /email-addresses accepts:
FieldTypeDefaultDescription
addressstring(required)Inbound mailbox address. The local part allows letters, numbers, and hyphens.
providerstringresendEmail provider.
agent_idstringnullAgent to answer this address; its latest published version is resolved. Alternative to inbound_agent_version_id.
inbound_agent_version_idstringnullSpecific agent version that answers mail to this address.
outbound_from_addressstringaddressVerified sender used for replies. Defaults to address.
enabledbooleantrueServe the agent on this address.
PATCH /email-addresses/{address_id} accepts inbound_agent_version_id, outbound_from_address, and enabled. Only the fields you send are changed; sending inbound_agent_version_id: null explicitly unassigns the agent.
If the address is on a non-default domain that the organization has not verified, POST /email-addresses returns 400. Add and verify the domain under email domains first.

Unsubscribes

The unsubscribe ledger holds suppressed recipients. Suppressions are added automatically on STOP keywords, bounces, and complaints; deleting a row resubscribes that recipient.
MethodPathScopeDescription
GET/unsubscribesunsubscribes:readList suppressions, newest first.
DELETE/unsubscribes/{suppression_id}unsubscribes:manageResubscribe by removing a suppression row.

Messaging preview

A dry-run render used by the agent editor’s live preview. It does not send anything.
MethodPathScopeDescription
POST/messaging/previewagents:readRender a sample message for a channel without sending.
POST /messaging/preview accepts:
FieldTypeDefaultDescription
channelstring(required)One of email, text, sms.
propertiesobject{}Channel render properties.
sample_agent_responsestring(sample)Body text to render.
contextobjectnullOptional render context.
Scopes ending in :read are also satisfied by the matching :manage scope, and agents:read is satisfied by agents:manage.

Errors

StatusWhen
400Invalid body, a PATCH with no fields, or an address on an unverified non-default domain.
404The domain, address, or suppression id does not exist.
409Duplicate domain (already registered) or duplicate address (already in use). Addresses are unique across the platform.
502The email provider returned an error during create, verify, or refresh.

Provider webhooks

Two endpoints receive callbacks from the email provider (Resend). They are signature-verified and dispatched by event type; they are not part of your authenticated surface and you do not call them.
MethodPathDescription
POST/messaging/webhook/{provider}Inbound and status events for a provider, dispatched by event type.
POST/messaging/status/{provider}Delivery-status callbacks; also tolerates inbound events routed to it.
Both verify the request signature against the provider adapter and return 403 on an invalid signature. They use neither bearer tokens nor scopes, so do not send them traffic.

Email overview

How email agents receive, thread, and reply to mail.

Authentication

Tokens, scopes, and the X-Anyreach-Org header.