curl --request POST \
--url https://{dsn}/api/v1/auth/intent \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"provider": "imap",
"email": "ana@fastmail.com",
"name": "Ana Lee",
"imap_host": "imap.fastmail.com",
"imap_port": 993,
"imap_password": "app-password-here",
"smtp_host": "smtp.fastmail.com",
"smtp_port": 465,
"state": "user-42"
}
'{
"$ref": "#/components/examples/ImapAccount/value"
}{
"$ref": "#/components/examples/ImapAccount/value"
}{
"status": 400,
"type": "errors/invalid_parameters",
"title": "Invalid parameters",
"detail": "limit must be between 1 and 250"
}{
"status": 401,
"type": "errors/invalid_credentials",
"title": "Invalid credentials",
"detail": "the mail provider rejected the credentials: invalid_grant"
}{
"status": 404,
"type": "errors/not_found",
"title": "Not found",
"detail": "email email_94a0d77db739407e932c3b97fef44aac not found"
}{
"status": 409,
"type": "errors/already_exists",
"title": "Already exists",
"detail": "ana@fastmail.com is already connected"
}Auth
Start an auth intent
Connects a mailbox from your own app: your app collects the email address and password (an app password for Gmail) and sends them here. The server settings are filled in for well-known providers.
provider: "imap"with the IMAP/SMTP settings: the engine signs in to both servers, then connects the account at once and returns it (201). Wrong settings give401 errors/invalid_credentialsand nothing is stored.
Pass account_id to reconnect an existing account instead (200 for IMAP).
By default only email that arrives after connecting is synced. Add
config: { "initial_sync_enable": true } to also import the mail already in the mailbox
(the last 30 days; initial_sync_days 1 to 30), without email.new events: see
the Initial sync guide (/accounts/initial-sync). Encryption, when left out, follows the
port: 143, 587 and 25 use STARTTLS, other ports SSL.
POST
/
auth
/
intent
curl --request POST \
--url https://{dsn}/api/v1/auth/intent \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"provider": "imap",
"email": "ana@fastmail.com",
"name": "Ana Lee",
"imap_host": "imap.fastmail.com",
"imap_port": 993,
"imap_password": "app-password-here",
"smtp_host": "smtp.fastmail.com",
"smtp_port": 465,
"state": "user-42"
}
'{
"$ref": "#/components/examples/ImapAccount/value"
}{
"$ref": "#/components/examples/ImapAccount/value"
}{
"status": 400,
"type": "errors/invalid_parameters",
"title": "Invalid parameters",
"detail": "limit must be between 1 and 250"
}{
"status": 401,
"type": "errors/invalid_credentials",
"title": "Invalid credentials",
"detail": "the mail provider rejected the credentials: invalid_grant"
}{
"status": 404,
"type": "errors/not_found",
"title": "Not found",
"detail": "email email_94a0d77db739407e932c3b97fef44aac not found"
}{
"status": 409,
"type": "errors/already_exists",
"title": "Already exists",
"detail": "ana@fastmail.com is already connected"
}Body
application/json
Response
Reconnect: the account with its new settings.
running: connected and syncing.errored: syncing keeps failing (server down, network); the engine retries by itself.disconnected: the provider rejected the password or token (reconnect it), or the account is paused in the dashboard (is_locked: true).
Available options:
running, errored, disconnected