Email connects your organization's own Gmail mailbox, so mail is sent from your address, lists what was sent from it, and manages the Jaah addresses your automations receive email at. An Org Owner or Org Admin connects and disconnects a mailbox and creates and revokes addresses.
Start Gmail connect
Starts connecting the caller's own Gmail to the caller's organization and returns the `authorize_url` to open: Google asks only to send email on the caller's behalf. Nothing is saved until the consent is given; returns 409 when Connect with Google is not set up and 403 when Tenant email is not on the plan. Requires Org Owner or Org Admin.
Get organization email
Returns the organization's Gmail connections (address, how it was connected, last use, last mailbox read and last error; never a secret), its Jaah addresses with the automation each one feeds, the domain they live on (`mail_domain`, empty when email is not received here), whether Tenant email is on its plan (`on_plan`) and whether Connect with Google is offered (`oauth_available`). Requires Org Owner or Org Admin; another organization is a 404.
Create tenant address
Creates a Jaah address the organization receives email at, `<organization>-<10 random characters>@<mail domain>`, with an optional `name` label, for an email automation to name as its source. Returns 403 when Tenant email is not on the plan and 409 when email is not received on this deployment. Requires Org Owner or Org Admin.
Revoke tenant address
Revokes a Jaah address: mail to it no longer reaches the organization, and the automation it fed stops receiving; mail it already received is kept. Returns 204. Requires Org Owner or Org Admin; another organization's address is a 404.
Connect Gmail service account
Connects a Gmail mailbox through a Google Workspace service account with domain-wide delegation: `address` is the mailbox and `key_json` the service account's JSON key file. Google is asked to act as the mailbox for sending and reading before anything is saved, and reconnecting an address replaces its key. Refused with 422 naming what to fix (a malformed address or key, or delegation Google refuses) and with 403 when Tenant email is not on the plan or the caller is not an Org Owner or Org Admin.
Delete Gmail connection
Disconnects a Gmail mailbox: the connection and its stored secret are deleted at once; its sent list is kept. Returns 204. Requires Org Owner or Org Admin.
Get Gmail connection
Returns one of the organization's Gmail connections. Requires Org Owner or Org Admin; another organization's connection is a 404.
List tenant email sends
Lists the messages the organization sent through its Gmail, refused attempts included, newest first: when, from which mailbox, to whom, the subject, `status` (`sent` or `failed`) and why a failed one failed. `connection_id` narrows it to one mailbox, including one since disconnected; rows are kept 365 days. Requires Org Owner or Org Admin.