Skip to main content
One call connects one mailbox. POST https://api2.getsales.io/unibox/v1/api/sender-profiles/{sid}/mailboxes/connect-imap takes the mailbox’s IMAP and SMTP settings and both passwords, signs in to both servers, and attaches the mailbox to the sender profile. A script that reads a CSV and makes the call once per row connects any number of mailboxes, and every row that fails comes back with its cause. In the app the same connect is the IMAP and SMTP tab of Add mailbox, one mailbox at a time.
Google Workspace takes an app password over IMAP, and most other mail hosts take the mailbox’s own password. Microsoft 365 takes no password over IMAP at all, so a Microsoft 365 mailbox is connected in the app, through Microsoft’s consent page.

Before you start

  • An API key with the can_manage_sender_profiles permission.
  • An email package on the workspace’s plan. Each package is one dedicated email server, set up a few minutes after the purchase, and each connected mailbox takes one of its inboxes. The trial carries no email. A call can name the server with email_server_sid. Without it, the mailbox lands on the oldest active server with an inbox free.
  • The sender profile each mailbox goes to. Create one with POST https://api2.getsales.io/unibox/v1/api/sender-profiles, or reuse one: a sender profile holds several mailboxes, and an email step rotates across its active ones.

Connect one mailbox

A 200 answers the sender profile as item and its mailboxes in result.mailboxes. A new mailbox reads status connecting while its first sync runs and turns active by itself, and only an active mailbox sends. result.bound_existing is true when the mailbox already existed in the workspace it landed on (a mailbox of your own linked gtm-api workspace, for example): it is attached as it is there, and the settings and passwords of the call were not applied. history_since and history_scope choose how much of the mailbox’s existing mail reaches the inbox; the endpoint reference has every field.

When a mailbox is refused

Before the mailbox is created, both servers are signed in to with what you sent, IMAP first, then SMTP. A refusal is a 422 with the code validation_failed, keyed in error.field_errors under the field to change, with the mail server’s cause as its rule:
A mailbox that is taken already is a 409 with the code conflict, and error.context.reason says which way:
  • mailbox_already_connected: this sender profile already has the mailbox (error.context.email_account_sid names it), and nothing was changed. A script run twice over the same rows reads this for every row that connected the first time.
  • mailbox_bound_elsewhere: another sender profile of the workspace has it, named in error.context.sender_profile_sid, with the mailbox in error.context.email_account_sid. Move it instead of connecting it again: POST https://api2.getsales.io/unibox/v1/api/sender-profiles/{sid}/mailboxes/{emailAccountSid}/move on the sender profile that holds it, with this sender profile as to_sender_profile_sid (move_sender_profile_mailbox). The mailbox stays connected and its conversations come with it. A detach there would remove the mailbox.
  • mailbox_in_another_workspace: the mailbox is connected in another workspace. Disconnect it there first.
  • mailbox_held_needs_sign_in: the workspace already holds the address as a Google or Microsoft 365 mailbox, and that mailbox needs a new sign-in (error.context.email_account_sid names it, with its provider and status). A password does not renew it: the sign-in is a consent on a hosted page, so it is done in the app. When error.context.sender_profile_sid is there, a sender profile carries the mailbox: open it, Email, and press Reconnect on the mailbox’s card. When it is absent, no sender profile carries the mailbox: attach it to one first, POST https://api2.getsales.io/unibox/v1/api/sender-profiles/{sid}/mailboxes/attach with the mailbox as email_account_sid (attach_sender_profile_mailbox), then press Reconnect on its card.
  • mailbox_on_another_server: the address is already a mailbox on another email server of the workspace, named in error.context.email_server_sid (and email_server_name when the server has a name), with the mailbox in error.context.email_account_sid. A workspace holds one mailbox per address, so attach that one instead of connecting the address again: the same mailboxes/attach call with its email_account_sid. It stays on its server.
These refusals are about the workspace and its email server, not the mailbox, and carry their reason in error.context.reason (one in a field error):
  • 402 email_inboxes_full: every inbox of the plan is in use, or the plan has none. Detach a mailbox you no longer need, or add inboxes in Settings, Billing.
  • 409 email_server_missing: the workspace has no email server. Add an email package in Settings, Billing.
  • 409 email_server_not_ready: the email server is still being set up or is changing its plan, and status, step and steps say how far it is. Retry in a few minutes.
  • 402 email_server_full: every inbox of that email server is in use (inbox_capacity, inboxes_used).
  • 409 email_server_suspended: billing holds the server (suspended_reason: payment_failed or unpaid).
  • 409 email_server_failed: the server’s setup failed. Pick another server, or contact support.
  • 422 email_server_unknown, on email_server_sid: the workspace holds no email server with that sid.
Retry imap_timeout, smtp_timeout, imap_connection_limit and email_server_not_ready after a pause. Every other cause needs a change to the row or to the plan first.

Provider settings

A script over a CSV

Each row of mailboxes.csv names the sender profile, the mailbox and its servers:
mailboxes.csv
The script prints one line per row, with the cause when a row fails:
Keep the lines the script prints, and run it again over the rows that failed only, once each one is fixed.