Connect a Mail account
const url = 'https://example.com/api/v1/mail/accounts';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"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"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
IMAP transport mode. Cleartext authentication is never allowed.
IMAP transport mode. Cleartext authentication is never allowed.
Responses
Section titled “Responses”object
IMAP transport mode. Cleartext authentication is never allowed.
Connected Account identity for a Mail cache projection (#407, DESIGN §49 I6).
IMAP transport mode. Cleartext authentication is never allowed.
Example
{ "imap_tls_mode": "implicit", "provider": "gmail", "smtp_tls_mode": "implicit"}The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}