Skip to content

Connect a Mail account

POST
/api/v1/mail/accounts
curl --request POST \
--url https://example.com/api/v1/mail/accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "app_password": "example", "email": "example", "imap_host": "example", "imap_port": 1, "imap_tls_mode": "implicit", "provider": "gmail", "smtp_app_password": "example", "smtp_host": "example", "smtp_port": 1, "smtp_tls_mode": "implicit", "smtp_username": "example", "username": "example" }'

Requires a signed-in User. It checks the account settings, saves the credentials and queues the first sync. It returns 409 when the account is already connected, or a provider error when the connection check fails. Route: /api/v1/mail/accounts. Inputs: . Do not automatically replay this operation after an uncertain result.

Media typeapplication/json
object
app_password
required
string
email
required
string
imap_host
required
string
imap_port
required
integer format: int32
imap_tls_mode
required

IMAP transport mode. Cleartext authentication is never allowed.

string
Allowed values: implicit starttls
provider
required
string
Allowed values: gmail icloud fastmail custom
smtp_app_password
string | null
smtp_host
required
string
smtp_port
required
integer format: int32
smtp_tls_mode
required

IMAP transport mode. Cleartext authentication is never allowed.

string
Allowed values: implicit starttls
smtp_username
required
string
username
required
string
Media typeapplication/json
object
created_at
required
string
email
required
string
enabled
required
boolean
id
required
string
imap_host
required
string
imap_port
required
integer format: int32
imap_tls_mode
required

IMAP transport mode. Cleartext authentication is never allowed.

string
Allowed values: implicit starttls
integration_account
required
boolean
integration_account_id

Connected Account identity for a Mail cache projection (#407, DESIGN §49 I6).

string | null
last_attempt_at
string | null
last_error
string | null
last_sync_at
string | null
provider
required
string
Allowed values: gmail icloud fastmail custom
retry_after
string | null
smtp_host
required
string
smtp_port
required
integer format: int32
smtp_tls_mode
required

IMAP transport mode. Cleartext authentication is never allowed.

string
Allowed values: implicit starttls
smtp_username
required
string
username
required
string
Example
{
"imap_tls_mode": "implicit",
"provider": "gmail",
"smtp_tls_mode": "implicit"
}
Media typeapplication/json

The standard API error response: { "error": { ... } }.

object
error
required

Error details.

object
code
required

Stable machine-readable code.

string
Allowed values: bad_request unauthorized forbidden not_found conflict name_conflict_case name_too_long push_endpoint_rejected too_many_requests internal service_unavailable
details
One of:

Optional field or operation details.

object
key
additional properties
string
message
required

Safe text for logs or a user-facing error message.

string
Example
{
"error": {
"code": "bad_request"
}
}
Media typeapplication/json

The standard API error response: { "error": { ... } }.

object
error
required

Error details.

object
code
required

Stable machine-readable code.

string
Allowed values: bad_request unauthorized forbidden not_found conflict name_conflict_case name_too_long push_endpoint_rejected too_many_requests internal service_unavailable
details
One of:

Optional field or operation details.

object
key
additional properties
string
message
required

Safe text for logs or a user-facing error message.

string
Example
{
"error": {
"code": "bad_request"
}
}
Media typeapplication/json

The standard API error response: { "error": { ... } }.

object
error
required

Error details.

object
code
required

Stable machine-readable code.

string
Allowed values: bad_request unauthorized forbidden not_found conflict name_conflict_case name_too_long push_endpoint_rejected too_many_requests internal service_unavailable
details
One of:

Optional field or operation details.

object
key
additional properties
string
message
required

Safe text for logs or a user-facing error message.

string
Example
{
"error": {
"code": "bad_request"
}
}
Media typeapplication/json

The standard API error response: { "error": { ... } }.

object
error
required

Error details.

object
code
required

Stable machine-readable code.

string
Allowed values: bad_request unauthorized forbidden not_found conflict name_conflict_case name_too_long push_endpoint_rejected too_many_requests internal service_unavailable
details
One of:

Optional field or operation details.

object
key
additional properties
string
message
required

Safe text for logs or a user-facing error message.

string
Example
{
"error": {
"code": "bad_request"
}
}
Media typeapplication/json

The standard API error response: { "error": { ... } }.

object
error
required

Error details.

object
code
required

Stable machine-readable code.

string
Allowed values: bad_request unauthorized forbidden not_found conflict name_conflict_case name_too_long push_endpoint_rejected too_many_requests internal service_unavailable
details
One of:

Optional field or operation details.

object
key
additional properties
string
message
required

Safe text for logs or a user-facing error message.

string
Example
{
"error": {
"code": "bad_request"
}
}