# Which notifications are emailed, and to whom

> GET /v1/notification-settings. The organization's email settings, one per notification kind: whether it is emailed and to whom (all_members, owners, or selected members).

Source: https://legion.ambient.xyz/docs/api/notifications/get-notification-settings

`GET https://api.legion.ambient.xyz/v1/notification-settings`

Authenticate with an API key: `Authorization: Bearer $LEGION_API_KEY`.

The organization's email settings, one per notification kind: whether it is emailed and
to whom (`all_members`, `owners`, or `selected` members). A kind nobody changed has its default:
`host_added`, `host_offline`, `host_online`, `host_approved`, `host_flagged` and `payout_sent` go to
the owners; `rental_failed`, `credit_added` and `out_of_credit` to every member; the rest are not
emailed. `members` is the organization's members, for choosing recipients. `can_edit` is whether the
caller may change them (owners). Every member can read them. Offer alerts and other emails sent to
one person about their own action are not governed by these settings.

## Responses

### 200

The organization's email settings.

- `can_edit`, boolean, required: Whether the caller may change the settings (owners).
- `kinds`, array of NotificationEmailSetting, required
  - `kind`, NotificationKind, required: What a notification is about. Hosts: `host_added` (a host registered and waits for review), `host_approved` (Ambient approved it, also after a quarantine), `host_flagged` (Ambient quarantined it), `host_removed`, `host_offline` (no contact for 5 minutes), `host_online` (back after being offline), `benchmark_completed`. Rentals, the organization's own and those on its hosts: `rental_started`, `rental_stopped`, `rental_failed`. Money: `payout_sent`, `credit_added`, `out_of_credit` (the organization ran out of credit and its rentals were stopped). Team: `member_joined`, `member_removed`. `platform_update`: news from Legion for every organization. `member_removed` is a person removed by an owner or who left. `platform_update` is reserved: nothing emits it yet, and the email settings do not list it until something does. Clients must accept a kind they do not know. Promo codes: `promo_credit_granted` (a promo code's credit or discount was added), `promo_credit_expiring` (promo credit expires within 3 days; once per grant), `promo_redemption_held` (a redemption waits for a person at Ambient to look at it). `host_clock_off`: the clock of one of the organization's hosts has been more than 30 seconds off for 15 minutes; once per episode, with one reminder if it is still off 7 days later, and nothing when it recovers. `host_isolation_off`: one of the organization's approved hosts has not reported user-namespace isolation (`Host.isolation`) for 15 minutes while online, with the command that turns it on and the date from which the host is no longer offered without it; once per episode, with one reminder 2 days before that date if it is still off, and nothing when it is turned on. `host_start_hold`: new rentals are paused on one of the organization's hosts because models keep failing to start on it (`Host.start_hold`); once per pause, with why and how to end it. Auto top-up: `auto_top_up_changed` (a person changed the settings, saved or removed the card; in the feed only by default) and `auto_top_up_paused` (auto top-up stopped charging the card, with why and how to fix it; emailed to owners by default).
  - `email_enabled`, boolean, required
  - `recipients`, NotificationRecipients, required: Who an emailed notification goes to.
  - `member_ids`, array of string (uuid), required: The selected members, when `recipients` is `selected`; empty otherwise.
  - `is_default`, boolean, required: Nobody has changed this kind; it has Legion's default.
- `members`, array of NotificationMember, required: The organization's members, for choosing recipients.
  - `user_id`, string (uuid), required
  - `name`, string, required
  - `email`, string (email), required
  - `role`, OrgRole, required: `owner` and `member` apply within a customer or provider organization.

Example:

```json
{
  "can_edit": false,
  "kinds": [
    {
      "kind": "host_added",
      "email_enabled": false,
      "recipients": "all_members",
      "member_ids": [
        "0192f1a2-7c3d-7e4f-8a9b-0c1d2e3f4a5b"
      ],
      "is_default": false
    }
  ],
  "members": [
    {
      "user_id": "0192f1a2-7c3d-7e4f-8a9b-0c1d2e3f4a5b",
      "name": "string",
      "email": "you@example.com",
      "role": "owner"
    }
  ]
}
```

### 401

Missing, unknown, expired or revoked credentials.

### 403

The caller lacks the permission this operation requires (`forbidden`),
or signed in without having joined an organization yet
(`no_organization`; `getOnboarding` and the invitation and
organization operations under it work), or could not sign in
(`email_unverified`, `account_conflict`, and `domain_not_allowed`). `not_invited` is no longer returned to
session tokens.

`access_not_approved`: a signed-in person who is not approved
for the beta yet. Every operation that takes a credential answers it to
them, except `getMe` and `joinMyWaitlist`; the problem carries
`access` (`waitlisted` or `not_requested`, and the email). Approved
means a member of an organization, holding a pending invitation, or Legion; an API key always belongs to a member.

`oauth_token_mcp_only`: the caller sent an OAuth access token (`lgo_`), which is accepted
only by `mcpMessage` and the tool calls it dispatches. Every other operation answers it, whatever
the token's scope. Use an API key or the Legion web app.

`org_suspended`: the caller's organization is suspended. Every operation that takes a
credential answers it, by session or API key, except `getMe` (which shows `org.suspended_at` and
`org.suspension_reason`) and the support operations under `/v1/support/`.

`terms_not_accepted`: an approved caller who has not accepted
the current version of the Terms of Use and the Acceptable Use Policy. Every operation that takes a credential answers it, except `getMe`,
`acceptLegalDocuments`, `joinMyWaitlist` and the wind-down operations
(`listRentals`, `stopRental`, `deleteRental`, `listHosts`,
`updateListing` with `listed` false, `removeHost`); the problem
carries `legal`. An API key acts for the person who created it, so it
is refused until that person accepts. Terminal
operations also return
`session_required` (called with an API key) and `step_up_required`
(neither a sign-in nor a step-up challenge within the step-up window).

### 500

An unexpected server error. Safe to retry.

## Errors

- 403 [`no_organization`](https://legion.ambient.xyz/docs/errors#no_organization)

## Example request

```sh
curl -s "https://api.legion.ambient.xyz/v1/notification-settings" \
  -H "Authorization: Bearer $LEGION_API_KEY"
```
