# Users

> Canonical URL: https://docs.mountaya.com/en/apis/map-studio/reference/users/
> Last updated: 2026-11-26
> Rules for agents: https://docs.mountaya.com/llms.txt#rules-for-agents

The user the session token names, under `/v1/me`: their membership of the key's organization, the display preferences that follow the person into every organization, and the invitations to the key's organization waiting for their answer.

 No path names a user, so no request reads or answers for anybody else. Every operation here needs a session token naming a user beside the key.

## The RelationToUser object

A reference to a user by id alone. Resources name their author with this (`created_by`). No operation resolves an arbitrary user id: a display name is found by matching the id against `getOrganizationMembers`, which lists the organization's members with the name each has set, so an author who has since left the organization, or who never set a name, has none to show.

- `id` (string (uuid), required): Identifier of the user this relation is about.

### An example RelationToUser

```json
{
  "id": "7a3e5d18-4c60-49b2-8f75-e2d1c9a4b607"
}
```

## The Membership object

A person's membership of one organization they have joined. It pairs the person and the organization, so it has no identifier of its own and names both: `user_id` and `organization_id`. It carries the organization's identity with the role, so a client can name the organization and read the person's role in it without a second read.

It is not a trimmed `Organization`: this one is about a PERSON's relationship to an organization. It carries the products the organization holds, so a client can tell whether the organization holds Map Studio without reading the organization itself, and what that person may use of Map Studio there, in `studio_entitlements`, which Mountaya resolves from the organization's agreement and the member's role, so a studio shows what the agreement covers without deciding it itself. An invitation waiting for an answer is not a membership: it is a `UserInvitation`.

- `user_id` (string (uuid), required): Identifier of the person, the user the session token names.

- `organization_id` (string (uuid), required): Identifier of the organization. It is what every organization-scoped operation takes as its `organization_id` path parameter.

- `organization_name` (string, required): The organization's display name, as it appears to its members.

- `organization_capabilities` (array of string, required): The products the organization holds, as `Capability` members, each at most once and sorted alphabetically. Empty when it holds none, as a new organization does. It is what the organization holds, never what this member may do with it: the role and `studio_entitlements` say that.

- `studio_entitlements` (array of string, required): What this person may use of Map Studio in this organization, as `StudioEntitlement` members, each at most once and sorted alphabetically. Mountaya resolves it from what the organization holds and from the role, as `StudioEntitlement` describes: `embed`, `publish`, `video-export` and `video-organization-modes` only where the organization holds Map Publishing, and `white-label` only where it holds White label. A change of agreement or of role reaches it on the next read. Read with a publishable key, it is narrowed by the organization's safety rules, as what the key is served is: `profile-insights` only when `with_profile_analysis` is set, `map-pois` only when `with_overlays` admits the points of interest, and `map-overlays` only when it admits another overlay. It authorizes nothing by itself, since every request is still refused by its own rule.

- `role` (string, required, one of: `owner`, `admin`, `contributor`, `viewer`): What this person may do in this organization.

- `joined_at` (string (date-time), required): When the person joined: when the invitation was accepted, or when the organization was created for its owner.

### An example Membership

```json
{
  "user_id": "7a4e1c98-3b52-4f60-9d81-c05e2f7a83b1",
  "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  "organization_name": "Compagnie des Guides",
  "organization_capabilities": [
    "publishing",
    "studio-online"
  ],
  "role": "contributor",
  "studio_entitlements": [
    "context-menu-insights",
    "copilot",
    "embed",
    "map-overlays",
    "map-pois",
    "profile-insights",
    "publish",
    "video-export",
    "video-organization-modes"
  ],
  "joined_at": "2026-01-14T09:20:11Z"
}
```

## The Preferences object

A user's own display preferences: the language they read in, the theme they see, and the four units every figure this API returns is rendered in. They belong to the PERSON rather than to an organization, so they follow the user across every organization they are a member of.

They shape rendering only. Nothing here changes what an operation returns: a distance comes back in meters whichever length unit is set, and a client formats it. The organization's own defaults, which seed what an embed shows a visitor who has no preferences of their own, are in `OrganizationSettings`.

- `language` (string, required, one of: `en`, `fr`, `es`, `it`, `de`, `zh`, `ja`): The language user-facing content is written in.

- `theme` (string, required, one of: `auto`, `light`, `dark`): The color theme the interface is painted in.

- `length` (string, required, one of: `metric`, `imperial`): The measurement system distances, elevations and lengths are shown in.

- `pace` (string, required, one of: `per-time`, `per-distance`): The form a travel rate is shown in, time over distance or distance over time.

- `slope` (string, required, one of: `degrees`, `percentage`): The unit a gradient is shown in.

- `temperature` (string, required, one of: `celsius`, `fahrenheit`): The unit a temperature is shown in.

### An example Preferences

```json
{
  "language": "fr",
  "theme": "dark",
  "length": "metric",
  "pace": "per-distance",
  "slope": "percentage",
  "temperature": "celsius"
}
```

## The NotificationPreferences object

Which notification emails about an organization a member receives. A member is sent each one unless they turned it off, and a security notification is always sent.

- `organization_id` (string (uuid), required): Identifier of the organization the notifications are about.

- `user_id` (string (uuid), required): Identifier of the member, the user the session token names.

- `notifications` (array of NotificationPreference, required): One entry per notification the member can receive in the organization: the security notifications, `member-role-changed` and `member-removed`, locked on; `collection-deleted`; and for an owner or an admin, `webhook-endpoint-failing` and `webhook-endpoint-disabled`. The `invitation` email goes to an address before it is a member's, and is never listed.
  - `notification` (string, required, one of: `invitation`, `member-role-changed`, `member-removed`, `collection-deleted`, `webhook-endpoint-failing`, `webhook-endpoint-disabled`): The notification.
  - `email` (boolean, required): Whether the member is sent it by email. On by default.
  - `locked` (boolean, required): Whether the member may turn it off. A security notification is always sent, and is locked.
  - `locked_reason` (string | null, required): Why it cannot be turned off, in the request's `Accept-Language`, null on a notification that can.

### An example NotificationPreferences

```json
{
  "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  "user_id": "7a4e1c98-3b52-4f60-9d81-c05e2f7a83b1",
  "notifications": [
    {
      "notification": "member-role-changed",
      "email": true,
      "locked": true,
      "locked_reason": "Security notifications are always sent."
    },
    {
      "notification": "member-removed",
      "email": true,
      "locked": true,
      "locked_reason": "Security notifications are always sent."
    },
    {
      "notification": "collection-deleted",
      "email": false,
      "locked": false,
      "locked_reason": null
    }
  ]
}
```

## List the acting user's memberships

### GET /v1/me/organizations

- Operation: `getMyOrganizations`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member)
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Returns the memberships of the user the session token names, each carrying the organization's name and the products it holds beside the role, so a client can label the organization it acts in, and tell whether it holds Map Studio, without a second read. Under a publishable key that is the user's membership of the key's organization alone: a one-entry list, or an empty one while the user has not joined it, as a user whose invitation is still waiting has not. An invitation is not a membership: `getMyInvitations` lists those.

Each entry also says what the user may use in the studio there: `studio_entitlements`, the features the organization's agreement covers for that member's role, Map Publishing's publishing, video export and embed among them. Read with a key, the features are narrowed by the organization's safety rules, as what the key is served is: the points of interest, the other overlays and the profile analysis each follow the rule that governs them. An Embedded Studio reads its viewer from them, so it shows what the agreement covers with no mapping of products to features of its own.

The listing pages by cursor like every listing of what an organization or its members create, so a client written against it reads `extensions.metadata.pagination.next_cursor` and stops at `null`, which under a publishable key is always the first page. Memberships come in the order of the organizations' names; the order is not the caller's to choose, so the listing takes no `sort`.

Like every read made with a session token, it is limited to 1200 a minute per user the token names and then to 6000 a minute per organization; past either, the answer is a `429` carrying `Retry-After`.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, a member of any role or a user whose invitation to the key's organization is waiting, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

**Query parameters**

- `cursor` (string, in query, optional): Where the page starts: the `next_cursor` the previous page reported at `extensions.metadata.pagination`, sent back unchanged. Omitted, the listing starts at its first item.

  A cursor is opaque: it is not an offset and not an identifier, and a client never builds or edits one, and it is never longer than 1024 characters. It is bound to the operation that issued it, to its filters and its `sort`, and to the scope it listed, such as the organization or the collection in the path or the key's own organization. On `getItineraries`, `getZones` and `getCollections`, whose scope `organization_id` may leave implicit, it is bound as well to the tier of the credential it was issued to, a key alone (or with a session token minted without `user_id`, which reads as one) or a key with a session token naming a member. The next page is asked for the same way. A cursor sent to another operation, with different filters, a different `sort`, another scope or, on those three, another tier of credential, or altered in any way, is a `400` at `["request", "query", "cursor"]`. On every listing, each page applies the read tier of the credential that asks for it. Paging is by position in the sort order rather than by count, so an item whose sort key does not change is never skipped or served twice, whatever is created or deleted between two pages.

- `limit` (integer (int32), in query, optional, default: `50`): How many items one page holds, between 1 and 100; 50 when omitted, on every listing that pages. `extensions.metadata.pagination.limit` reports the size the page was served at. A page shorter than `limit` is not how the end is told: the end is a `next_cursor` of `null`. The page is cut after authorization, so it never widens what a caller can read.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Response** `200`

One page of the acting user's memberships: under a publishable key, the membership in the key's organization as the only entry, or no entry while the user has not joined it. `extensions.metadata.pagination` reads `next_cursor: null` at the end of the listing.

- `extensions` (object, required): The envelope's second half, everything the answer carries that is not the answer itself. Here that is `metadata.pagination` alone: the `limit` this page was served at and the cursor of the next page, `null` on the last.
  - `metadata` (ListMetadata, required): The `extensions.metadata` object every listing that pages returns. It carries the page and nothing else, so `extensions.metadata.pagination` is the one path a client reads paging from. A listing that does not page, a catalog or a usage series, answers with no `extensions` at all.
    - `pagination` (object, required): The page this listing served, and the cursor of the next one.
      - `limit` (integer (int32), required): The page size the listing was served at: the `limit` sent, or 50 when none was.
      - `next_cursor` (string | null, required): The `cursor` that asks for the page after this one, with the same filters and `sort`, or null when this page is the last. A page that is not the last may hold fewer than `limit` items; the end is told by this field alone.

- `data` (array of Membership, required): See [the Membership object](https://docs.mountaya.com/en/apis/map-studio/reference/users.md#membership-object).

**Errors** `400`, `401`, `402`, `403`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: Bad Request
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Embedded Studio, the product the `studio-embedded` scope belongs to and the one a publishable key needs to act as a user. It is agreed rather than bought, so it clears when the organization's agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. The reads that take `publishing` are unaffected. It asks for Embedded Studio alone and never for Map Studio, so an Embedded Studio still reads its viewer when the organization's agreement does not include Map Studio, and `organization_capabilities` and `studio_entitlements` then say what is left.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the user the session token names has neither joined the key's organization nor an invitation to it waiting, as a user who has been removed or has left has not. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
curl -s https://api.mountaya.com/v1/me/organizations \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" | jq '.data'
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";
import { MountayaAdmin } from "@mountaya/client/admin";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});
const admin = new MountayaAdmin(mountaya);

const { data } = await admin.users.getMyOrganizations();

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://api.mountaya.com/v1/me/organizations",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": [
    {
      "user_id": "7a4e1c98-3b52-4f60-9d81-c05e2f7a83b1",
      "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
      "organization_name": "Compagnie des Guides",
      "organization_capabilities": [
        "publishing",
        "studio-online"
      ],
      "role": "contributor",
      "studio_entitlements": [
        "context-menu-insights",
        "copilot",
        "embed",
        "map-overlays",
        "map-pois",
        "profile-insights",
        "publish",
        "video-export",
        "video-organization-modes"
      ],
      "joined_at": "2026-01-14T09:20:11Z"
    }
  ],
  "extensions": {
    "metadata": {
      "pagination": {
        "limit": 50,
        "next_cursor": "eyJ2IjoxLCJzIjoiLXVwZGF0ZWRfYXQifQ"
      }
    }
  }
}
```

## Retrieve the acting user's display preferences

### GET /v1/me/preferences

- Operation: `getMyPreferences`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member)
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Returns the six preferences the user the session token names reads and renders by: the language, the theme, and the units of length, pace, slope and temperature.

They belong to the PERSON, not to an organization, so the same six are read in every organization the user is a member of. They shape rendering only: no operation returns different figures because of them, and a client formats what it is given.

Like every read made with a session token, it is limited to 1200 a minute per user the token names and then to 6000 a minute per organization; past either, the answer is a `429` carrying `Retry-After`.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, a member of the key's organization in any role, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Response** `200`

All six preferences of the user the session token names.

- `extensions` (object): Top-level extensions map for 2xx responses. Mirrors the GraphQL-spec response extensions: a free-form map for response-scoped metadata.
  - `metadata` (object): Response-scoped metadata. Its shape is per-operation: the operation that emits it names the schema, and an operation that documents none never emits this field.

- `data` (Preferences, required): A user's own display preferences: the language they read in, the theme they see, and the four units every figure this API returns is rendered in. They belong to the PERSON rather than to an organization, so they follow the user across every organization they are a member of.

  They shape rendering only. Nothing here changes what an operation returns: a distance comes back in meters whichever length unit is set, and a client formats it. The organization's own defaults, which seed what an embed shows a visitor who has no preferences of their own, are in `OrganizationSettings`.

  See [the Preferences object](https://docs.mountaya.com/en/apis/map-studio/reference/users.md#preferences-object).

**Errors** `400`, `401`, `402`, `403`, `404`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: Bad Request
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Embedded Studio, the product the `studio-embedded` scope belongs to and the one a publishable key needs to act as a user. It is agreed rather than bought, so it clears when the organization's agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. The reads that take `publishing` are unaffected. It asks for Embedded Studio alone and never for Map Studio: preferences belong to the person rather than to anything Map Studio makes.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the user the session token names is not a member of the key's organization, as a user whose invitation is still waiting, or who has been removed or has left, is not. Any role passes. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `404`: The account the session token names does not exist, as when the person deleted it after the token was minted. The answer is the same opaque one an identifier that matches no user gets, and nothing is read. Mint a token for a user who exists.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
curl -s https://api.mountaya.com/v1/me/preferences \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" | jq '.data'
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";
import { MountayaAdmin } from "@mountaya/client/admin";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});
const admin = new MountayaAdmin(mountaya);

const { data } = await admin.users.getMyPreferences();

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://api.mountaya.com/v1/me/preferences",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "language": "fr",
    "theme": "dark",
    "length": "metric",
    "pace": "per-distance",
    "slope": "percentage",
    "temperature": "celsius"
  }
}
```

## Update the acting user's display preferences

### PATCH /v1/me/preferences

- Operation: `patchMyPreferences`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member) · an `Idempotency-Key` header, the same on every retry
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Changes any of the six preferences the user the session token names reads and renders by, and returns all six afterwards. Every field is optional and independent: what is sent is changed, what is omitted is left alone, and the reply is the whole set rather than the part that moved.

They belong to the PERSON, not to an organization, so a change follows the user into every organization they are a member of. They shape rendering only: no operation returns different figures because of them, and a client formats what it is given. A user changes their own preferences and nobody else's, so the operation takes no user id: it writes those of the user the session token names.

Any role changes them, a viewer's included, since they change nothing the organization holds.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, a member of the key's organization in any role, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

Records no webhook event. Runs the task `user.preferences.update`.

**Headers**

- `Idempotency-Key` (string, in header, optional): A value the caller chooses once per logical write and sends again, unchanged, on every retry of it, so a write whose answer was lost runs at most once. A UUID is the usual choice; any 1 to 255 printable ASCII characters without a space are accepted. The key is held for 12 hours, for the credential that sent it (the publishable key and the user its session token names) and for this operation.

  The first request runs. A request repeating the key with the same method, path, query and body, sent as the same media type, is answered with the first one's stored status and body, its `Location` and `ETag` included, and carries `Idempotent-Replayed: true`; nothing runs a second time and no limit is charged again. `Content-Type` is compared as the media type it names, with its `charset`, rather than as the header was written, so the letter case of the type and the spacing around its parameters do not make two requests different. `If-Match` is not compared: a key sent again after a `412`, with a fresh tag, is answered with that same `412`, so a write retried with a new tag takes a new key. Every answer below `500` other than a `429` is stored that way, a refusal included, so a retried request that was refused is refused again in the same words. A request refused before the write is reached stores nothing, and a retry with the same key runs again: every `401`, and every `413` refusing a body over the operation's ceiling. The `413` that `postItineraryPreview` answers for the source it has read, a file or a track too large, is stored as any other refusal is.

  A `5xx` answered before anything was written stores nothing and releases the key: a retry with the same key runs again. A `5xx` answered after the write was made keeps the key, and a request repeating it is a `409` whose entry is coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`, as is a request repeating the key of an answer too large to store whole. Either way the write was made: the `409` carries no `Location`, and its `extensions.metadata` (`ResponseMetadataIdempotentAnswer`) names the `status` the first request was answered with and, where that answer carried them, its `location` and `etag`. Read the resource again rather than sending the write once more, which is answered the same way.

  The same key with a different request is a `400` at `["request", "headers", "Idempotency-Key"]`, and nothing runs, whether the first request is still running or was answered. The same request while its first one is still running is a `409` whose entry is coded `IDEMPOTENCY_KEY_IN_USE`, carrying `Retry-After`: send it again once that has passed. Without the header a write runs every time it is sent, which is harmless on the writes `x-idempotent` marks safe to repeat and creates a second resource on the others. A stream's answer is never stored.

  Keys are kept on a best-effort basis. While Mountaya cannot read or record them, a write runs as if it carried no key, so a retry sent in that moment can run it a second time.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Body**

The preferences to change. Send only what is changing.

- `language` (string, in body, optional, one of: `en`, `fr`, `es`, `it`, `de`, `zh`, `ja`): The language user-facing content is written in. Optional and not nullable: omit it to keep the current language.

- `theme` (string, in body, optional, one of: `auto`, `light`, `dark`): The color theme the interface is painted in. Optional and not nullable: omit it to keep the current theme.

- `length` (string, in body, optional, one of: `metric`, `imperial`): The measurement system distances, elevations and lengths are shown in. Optional and not nullable: omit it to keep the current system.

- `pace` (string, in body, optional, one of: `per-time`, `per-distance`): The form a travel rate is shown in, time over distance or distance over time. Optional and not nullable: omit it to keep the current form.

- `slope` (string, in body, optional, one of: `degrees`, `percentage`): The unit a gradient is shown in. Optional and not nullable: omit it to keep the current unit.

- `temperature` (string, in body, optional, one of: `celsius`, `fahrenheit`): The unit a temperature is shown in. Optional and not nullable: omit it to keep the current unit.

**Response** `200`

All six preferences after the change, not only the ones that changed.

- `extensions` (object): Top-level extensions map for 2xx responses. Mirrors the GraphQL-spec response extensions: a free-form map for response-scoped metadata.
  - `metadata` (object): Response-scoped metadata. Its shape is per-operation: the operation that emits it names the schema, and an operation that documents none never emits this field.

- `data` (Preferences, required): A user's own display preferences: the language they read in, the theme they see, and the four units every figure this API returns is rendered in. They belong to the PERSON rather than to an organization, so they follow the user across every organization they are a member of.

  They shape rendering only. Nothing here changes what an operation returns: a distance comes back in meters whichever length unit is set, and a client formats it. The organization's own defaults, which seed what an embed shows a visitor who has no preferences of their own, are in `OrganizationSettings`.

  See [the Preferences object](https://docs.mountaya.com/en/apis/map-studio/reference/users.md#preferences-object).

Response headers:

- `Idempotent-Replayed`: `true` when this answer is the stored answer to an earlier request carrying the same `Idempotency-Key`, replayed rather than run again. Absent on an answer that ran.

**Errors** `400`, `401`, `402`, `403`, `404`, `409`, `413`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: The request was malformed, or a field failed validation: each entry names what, a field-level one at its `path`. The same `Idempotency-Key` sent with another request is refused here too, at `["request", "headers", "Idempotency-Key"]`. A refusal the write itself made is stored for its key, so a repeat of the key is refused again in the same words, marked `Idempotent-Replayed: true`.
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Embedded Studio, the product the `studio-embedded` scope belongs to and the one a publishable key needs to act as a user. It is agreed rather than bought, so it clears when the organization's agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. The reads that take `publishing` are unaffected. It asks for Embedded Studio alone and never for Map Studio, unlike the other `studio-embedded` writes: preferences belong to the person rather than to anything Map Studio makes.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the user the session token names is not a member of the key's organization, as a user whose invitation is still waiting, or who has been removed or has left, is not. Any role passes. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `404`: The account the session token names does not exist, as when the person deleted it after the token was minted. The answer is the same opaque one an identifier that matches no user gets, and nothing is written. Mint a token for a user who exists.
- `409`: `IdempotencyKeyInUse`, given in full at the end of this page.
- `413`: Payload Too Large
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
curl -s -X PATCH https://api.mountaya.com/v1/me/preferences \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Content-Type: application/json" \
  -d '{"length": "imperial", "theme": "dark"}' | jq '.data'
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";
import { MountayaAdmin } from "@mountaya/client/admin";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});
const admin = new MountayaAdmin(mountaya);

const { data } = await admin.users.patchMyPreferences({ body: { length: "imperial", theme: "dark" } });

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.patch(
    "https://api.mountaya.com/v1/me/preferences",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={"length": "imperial", "theme": "dark"},
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "language": "fr",
    "theme": "dark",
    "length": "metric",
    "pace": "per-distance",
    "slope": "percentage",
    "temperature": "celsius"
  }
}
```

## List the invitations waiting for the acting user

### GET /v1/me/invitations

- Operation: `getMyInvitations`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member)
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Returns the invitations waiting for an answer from the user the session token names, each with the organization's name and the products it holds and the role accepting grants, so a person can decide without a second read. Under a publishable key that is the invitations to the key's organization alone.

An invitation is the user's when it was made to an address their account has VERIFIED. One made to an address the account carries unverified is not listed, and is listed from the moment the account verifies it, so nobody reads an invitation by claiming an address they do not hold. A lapsed invitation is not listed.

- A user who has not joined the organization reaches this with the session token `postSession` mints for them because an invitation is waiting for them: that is how an invited person answers before joining.
- `postMyInvitationAccept` accepts an invitation and `deleteMyInvitation` declines it.
- The listing pages by cursor, newest invitation first, with invitations made at the same instant ordered by `id`; the order is not the caller's to choose, so the listing takes no `sort`. Follow `extensions.metadata.pagination.next_cursor` until it reads `null`, which is the end of the listing.

Like every read made with a session token, it is limited to 1200 a minute per user the token names and then to 6000 a minute per organization; past either, the answer is a `429` carrying `Retry-After`.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, a member of any role or a user whose invitation to the key's organization is waiting, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

**Query parameters**

- `cursor` (string, in query, optional): Where the page starts: the `next_cursor` the previous page reported at `extensions.metadata.pagination`, sent back unchanged. Omitted, the listing starts at its first item.

  A cursor is opaque: it is not an offset and not an identifier, and a client never builds or edits one, and it is never longer than 1024 characters. It is bound to the operation that issued it, to its filters and its `sort`, and to the scope it listed, such as the organization or the collection in the path or the key's own organization. On `getItineraries`, `getZones` and `getCollections`, whose scope `organization_id` may leave implicit, it is bound as well to the tier of the credential it was issued to, a key alone (or with a session token minted without `user_id`, which reads as one) or a key with a session token naming a member. The next page is asked for the same way. A cursor sent to another operation, with different filters, a different `sort`, another scope or, on those three, another tier of credential, or altered in any way, is a `400` at `["request", "query", "cursor"]`. On every listing, each page applies the read tier of the credential that asks for it. Paging is by position in the sort order rather than by count, so an item whose sort key does not change is never skipped or served twice, whatever is created or deleted between two pages.

- `limit` (integer (int32), in query, optional, default: `50`): How many items one page holds, between 1 and 100; 50 when omitted, on every listing that pages. `extensions.metadata.pagination.limit` reports the size the page was served at. A page shorter than `limit` is not how the end is told: the end is a `next_cursor` of `null`. The page is cut after authorization, so it never widens what a caller can read.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Response** `200`

One page of the invitations waiting for the acting user, newest first. Empty when none is waiting, a member's usual answer. `extensions.metadata.pagination` reads `next_cursor: null` at the end of the listing.

- `extensions` (object, required): The envelope's second half, everything the answer carries that is not the answer itself. Here that is `metadata.pagination` alone: the `limit` this page was served at and the cursor of the next page, `null` on the last.
  - `metadata` (ListMetadata, required): The `extensions.metadata` object every listing that pages returns. It carries the page and nothing else, so `extensions.metadata.pagination` is the one path a client reads paging from. A listing that does not page, a catalog or a usage series, answers with no `extensions` at all.
    - `pagination` (object, required): The page this listing served, and the cursor of the next one.
      - `limit` (integer (int32), required): The page size the listing was served at: the `limit` sent, or 50 when none was.
      - `next_cursor` (string | null, required): The `cursor` that asks for the page after this one, with the same filters and `sort`, or null when this page is the last. A page that is not the last may hold fewer than `limit` items; the end is told by this field alone.

- `data` (array of UserInvitation, required)
  - `id` (string (uuid), required): Identifier of the invitation, which `postMyInvitationAccept` and `deleteMyInvitation` take.
  - `organization_id` (string (uuid), required): Identifier of the organization the invitation is to.
  - `organization_name` (string, required): The organization's display name, as it appears to its members.
  - `organization_capabilities` (array of string, required): The products the organization holds, as `Capability` members, each at most once and sorted alphabetically, so a person sees what an organization offers before answering. Empty when it holds none.
  - `role` (string, required, one of: `admin`, `contributor`, `viewer`): The role accepting grants.
  - `created_at` (string (date-time), required): When the invitation was made.
  - `expires_at` (string (date-time), required): When the invitation lapses unanswered, thirty days after it was made.

**Errors** `400`, `401`, `402`, `403`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: Bad Request
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Embedded Studio, the product the `studio-embedded` scope belongs to and the one a publishable key needs to act as a user. It is agreed rather than bought, so it clears when the organization's agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. The reads that take `publishing` are unaffected. It asks for Embedded Studio alone and never for Map Studio, so an invited person reads their invitation whatever else the organization holds.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the user the session token names has neither joined the key's organization nor an invitation to it waiting, as a user who has been removed or has left, or whose invitation lapsed or was withdrawn, has not. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
curl -s https://api.mountaya.com/v1/me/invitations \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" | jq '.data'
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";
import { MountayaAdmin } from "@mountaya/client/admin";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});
const admin = new MountayaAdmin(mountaya);

const { data } = await admin.users.getMyInvitations();

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://api.mountaya.com/v1/me/invitations",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": [
    {
      "id": "3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43",
      "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
      "organization_name": "Compagnie des Guides",
      "organization_capabilities": [
        "publishing",
        "studio-online"
      ],
      "role": "contributor",
      "created_at": "2026-10-20T09:12:44Z",
      "expires_at": "2026-11-19T09:12:44Z"
    }
  ],
  "extensions": {
    "metadata": {
      "pagination": {
        "limit": 50,
        "next_cursor": "eyJ2IjoxLCJzIjoiLXVwZGF0ZWRfYXQifQ"
      }
    }
  }
}
```

## Decline an invitation

### DELETE /v1/me/invitations/{invitation_id}

- Operation: `deleteMyInvitation`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member) · an `Idempotency-Key` header, the same on every retry
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Declines an invitation waiting for the user the session token names, which frees the seat it held. The organization sees it leave `getOrganizationInvitations`, and may invite the address again.

- Only the invited person declines, and only an invitation that is theirs: one made to an address their account has verified, to the key's organization.
- Declining is an act on the invitation's state rather than on a resource, so an identifier naming nothing waiting for this user answers 200 and changes nothing: an invitation already declined, withdrawn or lapsed, another person's, one to an address the account has not verified, and one that never existed. A decline racing a withdrawal is therefore not an error, and nobody learns from it which invitation ids exist.
- A user whose declined invitation was their only tie to the organization holds nothing there afterwards, so a decline they send again is refused with 403 unless it carries the first request's `Idempotency-Key`, which answers it with the first one's 200.
- An invitation already accepted is gone as well: the person is a member, and leaves with `deleteOrganizationMember`.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, the invited person, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

**Webhook events** [`organization.invitation.declined`](https://docs.mountaya.com/en/webhooks/events/organization-invitation.md#organization-invitation-declined), recorded by the task `organization.invitation.decline`.

**Path parameters**

- `invitation_id` (string (uuid), in path, required): Identifier of the invitation, the `id` an `OrganizationInvitation` or a `UserInvitation` carries. One that names no invitation this caller may see, an expired one included, is answered as each operation says: a read or an acceptance answers it `404`, and a withdrawal or a decline, which leave it gone either way, answer `200`.

**Headers**

- `Idempotency-Key` (string, in header, optional): A value the caller chooses once per logical write and sends again, unchanged, on every retry of it, so a write whose answer was lost runs at most once. A UUID is the usual choice; any 1 to 255 printable ASCII characters without a space are accepted. The key is held for 12 hours, for the credential that sent it (the publishable key and the user its session token names) and for this operation.

  The first request runs. A request repeating the key with the same method, path, query and body, sent as the same media type, is answered with the first one's stored status and body, its `Location` and `ETag` included, and carries `Idempotent-Replayed: true`; nothing runs a second time and no limit is charged again. `Content-Type` is compared as the media type it names, with its `charset`, rather than as the header was written, so the letter case of the type and the spacing around its parameters do not make two requests different. `If-Match` is not compared: a key sent again after a `412`, with a fresh tag, is answered with that same `412`, so a write retried with a new tag takes a new key. Every answer below `500` other than a `429` is stored that way, a refusal included, so a retried request that was refused is refused again in the same words. A request refused before the write is reached stores nothing, and a retry with the same key runs again: every `401`, and every `413` refusing a body over the operation's ceiling. The `413` that `postItineraryPreview` answers for the source it has read, a file or a track too large, is stored as any other refusal is.

  A `5xx` answered before anything was written stores nothing and releases the key: a retry with the same key runs again. A `5xx` answered after the write was made keeps the key, and a request repeating it is a `409` whose entry is coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`, as is a request repeating the key of an answer too large to store whole. Either way the write was made: the `409` carries no `Location`, and its `extensions.metadata` (`ResponseMetadataIdempotentAnswer`) names the `status` the first request was answered with and, where that answer carried them, its `location` and `etag`. Read the resource again rather than sending the write once more, which is answered the same way.

  The same key with a different request is a `400` at `["request", "headers", "Idempotency-Key"]`, and nothing runs, whether the first request is still running or was answered. The same request while its first one is still running is a `409` whose entry is coded `IDEMPOTENCY_KEY_IN_USE`, carrying `Retry-After`: send it again once that has passed. Without the header a write runs every time it is sent, which is harmless on the writes `x-idempotent` marks safe to repeat and creates a second resource on the others. A stream's answer is never stored.

  Keys are kept on a best-effort basis. While Mountaya cannot read or record them, a write runs as if it carried no key, so a retry sent in that moment can run it a second time.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Response** `200`

The invitation is declined, or nothing with that identifier was waiting for this user. `data` is null.

- `extensions` (object): Top-level extensions map for 2xx responses. Mirrors the GraphQL-spec response extensions: a free-form map for response-scoped metadata.
  - `metadata` (object): Response-scoped metadata. Its shape is per-operation: the operation that emits it names the schema, and an operation that documents none never emits this field.

- `data` (any | null, required): Always null: this operation answers with no payload.

Response headers:

- `Idempotent-Replayed`: `true` when this answer is the stored answer to an earlier request carrying the same `Idempotency-Key`, replayed rather than run again. Absent on an answer that ran.

**Errors** `400`, `401`, `402`, `403`, `404`, `409`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: The request was malformed, or a field failed validation: each entry names what, a field-level one at its `path`. The same `Idempotency-Key` sent with another request is refused here too, at `["request", "headers", "Idempotency-Key"]`. A refusal the write itself made is stored for its key, so a repeat of the key is refused again in the same words, marked `Idempotent-Replayed: true`.
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Embedded Studio, the product the `studio-embedded` scope belongs to and the one a publishable key needs to act as a user. It is agreed rather than bought, so it clears when the organization's agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. The reads that take `publishing` are unaffected. It asks for Embedded Studio alone and never for Map Studio: declining takes something down, and an act that takes something down is never refused for Map Studio.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the user the session token names has neither joined the key's organization nor an invitation to it waiting, as a user who has been removed or has left, or whose invitation lapsed or was withdrawn, has not. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `404`: Never answered: an identifier naming nothing waiting for the user the session token names answers `200`, since there is nothing left to decline, so the path cannot be used to learn which invitation ids exist.
- `409`: `IdempotencyKeyInUse`, given in full at the end of this page.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
curl -s -X DELETE https://api.mountaya.com/v1/me/invitations/3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43 \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token"
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";
import { MountayaAdmin } from "@mountaya/client/admin";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});
const admin = new MountayaAdmin(mountaya);

const { data } = await admin.users.deleteMyInvitation({ invitation_id: "3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43" });

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.delete(
    "https://api.mountaya.com/v1/me/invitations/3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": null
}
```

## Accept an invitation

### POST /v1/me/invitations/{invitation_id}/accept

- Operation: `postMyInvitationAccept`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member) · an `Idempotency-Key` header, the same on every retry
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Accepts an invitation waiting for the user the session token names, which makes them a member of the organization with the role it grants, and answers the membership. The invitation is consumed: it leaves `getMyInvitations` and `getOrganizationInvitations`, and the person is listed by `getOrganizationMembers` from then on.

- Only the invited person accepts. An invitation is theirs when it was made to an address their account has verified, and is to the key's organization. Any other identifier is a 404: an invitation to an address the account has not verified, another person's, one already answered, withdrawn or lapsed, and one that names nothing all answer alike.
- It takes no seat. The invitation has held its seat since it was made, so accepting is never refused for the organization's seats.
- The session token the person used before joining needs no replacing: it acts as the member, in the role granted, from the next request.
- Accepting consumes the invitation, so the same request sent again is a 404 and changes nothing, unless it carries the first request's `Idempotency-Key`, which answers it with the first one's 200.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, the invited person, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

**Webhook events** [`organization.invitation.accepted`](https://docs.mountaya.com/en/webhooks/events/organization-invitation.md#organization-invitation-accepted), [`organization.member.created`](https://docs.mountaya.com/en/webhooks/events/organization-member.md#organization-member-created), [`organization.invitation.deleted`](https://docs.mountaya.com/en/webhooks/events/organization-invitation.md#organization-invitation-deleted), recorded by the task `organization.invitation.accept`.

**Path parameters**

- `invitation_id` (string (uuid), in path, required): Identifier of the invitation, the `id` an `OrganizationInvitation` or a `UserInvitation` carries. One that names no invitation this caller may see, an expired one included, is answered as each operation says: a read or an acceptance answers it `404`, and a withdrawal or a decline, which leave it gone either way, answer `200`.

**Headers**

- `Idempotency-Key` (string, in header, optional): A value the caller chooses once per logical write and sends again, unchanged, on every retry of it, so a write whose answer was lost runs at most once. A UUID is the usual choice; any 1 to 255 printable ASCII characters without a space are accepted. The key is held for 12 hours, for the credential that sent it (the publishable key and the user its session token names) and for this operation.

  The first request runs. A request repeating the key with the same method, path, query and body, sent as the same media type, is answered with the first one's stored status and body, its `Location` and `ETag` included, and carries `Idempotent-Replayed: true`; nothing runs a second time and no limit is charged again. `Content-Type` is compared as the media type it names, with its `charset`, rather than as the header was written, so the letter case of the type and the spacing around its parameters do not make two requests different. `If-Match` is not compared: a key sent again after a `412`, with a fresh tag, is answered with that same `412`, so a write retried with a new tag takes a new key. Every answer below `500` other than a `429` is stored that way, a refusal included, so a retried request that was refused is refused again in the same words. A request refused before the write is reached stores nothing, and a retry with the same key runs again: every `401`, and every `413` refusing a body over the operation's ceiling. The `413` that `postItineraryPreview` answers for the source it has read, a file or a track too large, is stored as any other refusal is.

  A `5xx` answered before anything was written stores nothing and releases the key: a retry with the same key runs again. A `5xx` answered after the write was made keeps the key, and a request repeating it is a `409` whose entry is coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`, as is a request repeating the key of an answer too large to store whole. Either way the write was made: the `409` carries no `Location`, and its `extensions.metadata` (`ResponseMetadataIdempotentAnswer`) names the `status` the first request was answered with and, where that answer carried them, its `location` and `etag`. Read the resource again rather than sending the write once more, which is answered the same way.

  The same key with a different request is a `400` at `["request", "headers", "Idempotency-Key"]`, and nothing runs, whether the first request is still running or was answered. The same request while its first one is still running is a `409` whose entry is coded `IDEMPOTENCY_KEY_IN_USE`, carrying `Retry-After`: send it again once that has passed. Without the header a write runs every time it is sent, which is harmless on the writes `x-idempotent` marks safe to repeat and creates a second resource on the others. A stream's answer is never stored.

  Keys are kept on a best-effort basis. While Mountaya cannot read or record them, a write runs as if it carried no key, so a retry sent in that moment can run it a second time.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Response** `200`

The membership the invitation became, with the role it granted and `joined_at` set to the moment of acceptance.

- `extensions` (object): Top-level extensions map for 2xx responses. Mirrors the GraphQL-spec response extensions: a free-form map for response-scoped metadata.
  - `metadata` (object): Response-scoped metadata. Its shape is per-operation: the operation that emits it names the schema, and an operation that documents none never emits this field.

- `data` (Membership, required): A person's membership of one organization they have joined. It pairs the person and the organization, so it has no identifier of its own and names both: `user_id` and `organization_id`. It carries the organization's identity with the role, so a client can name the organization and read the person's role in it without a second read.

  It is not a trimmed `Organization`: this one is about a PERSON's relationship to an organization. It carries the products the organization holds, so a client can tell whether the organization holds Map Studio without reading the organization itself, and what that person may use of Map Studio there, in `studio_entitlements`, which Mountaya resolves from the organization's agreement and the member's role, so a studio shows what the agreement covers without deciding it itself. An invitation waiting for an answer is not a membership: it is a `UserInvitation`.

  See [the Membership object](https://docs.mountaya.com/en/apis/map-studio/reference/users.md#membership-object).

Response headers:

- `Idempotent-Replayed`: `true` when this answer is the stored answer to an earlier request carrying the same `Idempotency-Key`, replayed rather than run again. Absent on an answer that ran.

**Errors** `400`, `401`, `402`, `403`, `404`, `409`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: The request was malformed, or a field failed validation: each entry names what, a field-level one at its `path`. The same `Idempotency-Key` sent with another request is refused here too, at `["request", "headers", "Idempotency-Key"]`. A refusal the write itself made is stored for its key, so a repeat of the key is refused again in the same words, marked `Idempotent-Replayed: true`.
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Embedded Studio, the product the `studio-embedded` scope belongs to and the one a publishable key needs to act as a user. It is agreed rather than bought, so it clears when the organization's agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. The reads that take `publishing` are unaffected. It asks for Embedded Studio alone and never for Map Studio.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the user the session token names has neither joined the key's organization nor an invitation to it waiting, as a user who has been removed or has left, or whose invitation lapsed or was withdrawn, has not. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `404`: No invitation with that identifier is waiting for the user the session token names in the key's organization: none was ever made, or it was made to an address their account has not verified, or to somebody else, or to another organization, or it was already accepted, declined or withdrawn, or it lapsed. These answer alike, so this status cannot be used to learn which invitation ids exist. An acceptance sent again with the first request's `Idempotency-Key` is answered with the first one's 200 instead.
- `409`: `IdempotencyKeyInUse`, given in full at the end of this page.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
curl -s -X POST https://api.mountaya.com/v1/me/invitations/3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43/accept \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Idempotency-Key: $(uuidgen)"
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";
import { MountayaAdmin } from "@mountaya/client/admin";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});
const admin = new MountayaAdmin(mountaya);

const { data } = await admin.users.postMyInvitationAccept({ invitation_id: "3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43" });

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.post(
    "https://api.mountaya.com/v1/me/invitations/3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43/accept",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "user_id": "7a4e1c98-3b52-4f60-9d81-c05e2f7a83b1",
    "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "organization_name": "Compagnie des Guides",
    "organization_capabilities": [
      "publishing",
      "studio-online"
    ],
    "role": "contributor",
    "studio_entitlements": [
      "context-menu-insights",
      "copilot",
      "embed",
      "map-overlays",
      "map-pois",
      "profile-insights",
      "publish",
      "video-export",
      "video-organization-modes"
    ],
    "joined_at": "2026-01-14T09:20:11Z"
  }
}
```

## Retrieve the acting user's notification emails for an organization

### GET /v1/me/organizations/{organization_id}/notification-preferences

- Operation: `getMyOrganizationNotificationPreferences`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member)
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Returns which notification emails about the organization the user the session token names receives. Every one is on until the member turns it off, and the security notifications, a role changed or a removal made by somebody else, are always sent: they are listed locked, with the reason.

- An owner and an admin are listed the notifications about the organization's webhook endpoints as well; a contributor and a viewer are not, and are sent none.
- The invitation email goes to an address before it belongs to a member, and is never listed.

Like every read made with a session token, it is limited to 1200 a minute per user the token names and then to 6000 a minute per organization; past either, the answer is a `429` carrying `Retry-After`.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, a member of the key's organization in any role, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

**Path parameters**

- `organization_id` (string (uuid), in path, required): Identifier of the organization the operation acts on. A publishable key reaches only its own organization: any other identifier is a 403, whether or not it exists, so the parameter cannot be used to probe which organization ids exist.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Response** `200`

The notification emails the user receives about the organization.

- `extensions` (object): Top-level extensions map for 2xx responses. Mirrors the GraphQL-spec response extensions: a free-form map for response-scoped metadata.
  - `metadata` (object): Response-scoped metadata. Its shape is per-operation: the operation that emits it names the schema, and an operation that documents none never emits this field.

- `data` (NotificationPreferences, required): Which notification emails about an organization a member receives. A member is sent each one unless they turned it off, and a security notification is always sent.

  See [the NotificationPreferences object](https://docs.mountaya.com/en/apis/map-studio/reference/users.md#notification-preferences-object).

**Errors** `400`, `401`, `402`, `403`, `404`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: Bad Request
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Embedded Studio, the product the `studio-embedded` scope belongs to and the one a publishable key needs to act as a user. It is agreed rather than bought, so it clears when the organization's agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. It asks for Embedded Studio alone and never for Map Studio: notification emails belong to the person rather than to anything Map Studio makes.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the path names an organization other than the key's own, whether or not it exists, or the user the session token names is not a member of the key's organization, as a user whose invitation is still waiting, or who has been removed or has left, is not. Any role passes. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `404`: The account the session token names does not exist, as when the person deleted it after the token was minted. The answer is the same opaque one an identifier that matches no user gets. Mint a token for a user who exists.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
curl -s https://api.mountaya.com/v1/me/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/notification-preferences \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" | jq '.data.notifications'
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";
import { MountayaAdmin } from "@mountaya/client/admin";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});
const admin = new MountayaAdmin(mountaya);

const { data } = await admin.users.getMyOrganizationNotificationPreferences({ organization_id: "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b" });

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://api.mountaya.com/v1/me/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/notification-preferences",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "user_id": "7a4e1c98-3b52-4f60-9d81-c05e2f7a83b1",
    "notifications": [
      {
        "notification": "member-role-changed",
        "email": true,
        "locked": true,
        "locked_reason": "Security notifications are always sent."
      },
      {
        "notification": "member-removed",
        "email": true,
        "locked": true,
        "locked_reason": "Security notifications are always sent."
      },
      {
        "notification": "collection-deleted",
        "email": false,
        "locked": false,
        "locked_reason": null
      }
    ]
  }
}
```

## Turn the acting user's notification emails for an organization on or off

### PATCH /v1/me/organizations/{organization_id}/notification-preferences

- Operation: `patchMyOrganizationNotificationPreferences`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member) · an `Idempotency-Key` header, the same on every retry
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Turns notification emails about the organization on or off for the user the session token names, and answers them all afterwards. A notification left out keeps its setting. A user changes their own and nobody else's, so the operation takes no user id: it writes those of the user the session token names.

- A security notification, `member-role-changed` or `member-removed`, is always sent: naming one is a `400` naming it, and nothing is changed. So is naming `invitation`, which no member is sent, or a webhook endpoint's notification as a contributor or a viewer.
- Any role changes them, a viewer's included, since they change nothing the organization holds.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, a member of the key's organization in any role, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

Records no webhook event. Runs the task `organization.member.notification_preferences.update`.

**Path parameters**

- `organization_id` (string (uuid), in path, required): Identifier of the organization the operation acts on. A publishable key reaches only its own organization: any other identifier is a 403, whether or not it exists, so the parameter cannot be used to probe which organization ids exist.

**Headers**

- `Idempotency-Key` (string, in header, optional): A value the caller chooses once per logical write and sends again, unchanged, on every retry of it, so a write whose answer was lost runs at most once. A UUID is the usual choice; any 1 to 255 printable ASCII characters without a space are accepted. The key is held for 12 hours, for the credential that sent it (the publishable key and the user its session token names) and for this operation.

  The first request runs. A request repeating the key with the same method, path, query and body, sent as the same media type, is answered with the first one's stored status and body, its `Location` and `ETag` included, and carries `Idempotent-Replayed: true`; nothing runs a second time and no limit is charged again. `Content-Type` is compared as the media type it names, with its `charset`, rather than as the header was written, so the letter case of the type and the spacing around its parameters do not make two requests different. `If-Match` is not compared: a key sent again after a `412`, with a fresh tag, is answered with that same `412`, so a write retried with a new tag takes a new key. Every answer below `500` other than a `429` is stored that way, a refusal included, so a retried request that was refused is refused again in the same words. A request refused before the write is reached stores nothing, and a retry with the same key runs again: every `401`, and every `413` refusing a body over the operation's ceiling. The `413` that `postItineraryPreview` answers for the source it has read, a file or a track too large, is stored as any other refusal is.

  A `5xx` answered before anything was written stores nothing and releases the key: a retry with the same key runs again. A `5xx` answered after the write was made keeps the key, and a request repeating it is a `409` whose entry is coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`, as is a request repeating the key of an answer too large to store whole. Either way the write was made: the `409` carries no `Location`, and its `extensions.metadata` (`ResponseMetadataIdempotentAnswer`) names the `status` the first request was answered with and, where that answer carried them, its `location` and `etag`. Read the resource again rather than sending the write once more, which is answered the same way.

  The same key with a different request is a `400` at `["request", "headers", "Idempotency-Key"]`, and nothing runs, whether the first request is still running or was answered. The same request while its first one is still running is a `409` whose entry is coded `IDEMPOTENCY_KEY_IN_USE`, carrying `Retry-After`: send it again once that has passed. Without the header a write runs every time it is sent, which is harmless on the writes `x-idempotent` marks safe to repeat and creates a second resource on the others. A stream's answer is never stored.

  Keys are kept on a best-effort basis. While Mountaya cannot read or record them, a write runs as if it carried no key, so a retry sent in that moment can run it a second time.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Body**

The notifications to turn on or off. Send only what is changing.

- `notifications` (array of NotificationPreferenceUpdate, in body, required): One entry per notification to set, at least one, each notification at most once: naming one twice is a `400` naming the second.
  - `notification` (string, required, one of: `invitation`, `member-role-changed`, `member-removed`, `collection-deleted`, `webhook-endpoint-failing`, `webhook-endpoint-disabled`): The notification. A locked one, a security notification, is a `400` naming it, and so is one the member is not listed for, such as a webhook endpoint's for a member who is neither owner nor admin.
  - `email` (boolean, required): Whether the member is sent it by email.

**Response** `200`

Every notification email the user receives about the organization after the change, not only the ones that changed.

- `extensions` (object): Top-level extensions map for 2xx responses. Mirrors the GraphQL-spec response extensions: a free-form map for response-scoped metadata.
  - `metadata` (object): Response-scoped metadata. Its shape is per-operation: the operation that emits it names the schema, and an operation that documents none never emits this field.

- `data` (NotificationPreferences, required): Which notification emails about an organization a member receives. A member is sent each one unless they turned it off, and a security notification is always sent.

  See [the NotificationPreferences object](https://docs.mountaya.com/en/apis/map-studio/reference/users.md#notification-preferences-object).

Response headers:

- `Idempotent-Replayed`: `true` when this answer is the stored answer to an earlier request carrying the same `Idempotency-Key`, replayed rather than run again. Absent on an answer that ran.

**Errors** `400`, `401`, `402`, `403`, `404`, `409`, `413`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: The request was malformed, or a field failed validation: each entry names what, a field-level one at its `path`. A locked notification, one the member is not listed for, and a notification named twice are each refused at its position in `notifications`, and nothing is changed. The same `Idempotency-Key` sent with another request is refused here too, at `["request", "headers", "Idempotency-Key"]`. A refusal the write itself made is stored for its key, so a repeat of the key is refused again in the same words, marked `Idempotent-Replayed: true`.
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Embedded Studio, the product the `studio-embedded` scope belongs to and the one a publishable key needs to act as a user. It is agreed rather than bought, so it clears when the organization's agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. It asks for Embedded Studio alone and never for Map Studio: notification emails belong to the person rather than to anything Map Studio makes.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the path names an organization other than the key's own, whether or not it exists, or the user the session token names is not a member of the key's organization, as a user whose invitation is still waiting, or who has been removed or has left, is not. Any role passes. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `404`: The account the session token names does not exist, as when the person deleted it after the token was minted. The answer is the same opaque one an identifier that matches no user gets. Mint a token for a user who exists.
- `409`: `IdempotencyKeyInUse`, given in full at the end of this page.
- `413`: Payload Too Large
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
curl -s -X PATCH https://api.mountaya.com/v1/me/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/notification-preferences \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"notifications": [{"notification": "collection-deleted", "email": false}]}'
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";
import { MountayaAdmin } from "@mountaya/client/admin";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});
const admin = new MountayaAdmin(mountaya);

const { data } = await admin.users.patchMyOrganizationNotificationPreferences({
  organization_id: "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  body: {
    notifications: [{ notification: "collection-deleted", email: false }],
  },
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.patch(
    "https://api.mountaya.com/v1/me/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/notification-preferences",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "notifications": [{"notification": "collection-deleted", "email": False}],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "user_id": "7a4e1c98-3b52-4f60-9d81-c05e2f7a83b1",
    "notifications": [
      {
        "notification": "member-role-changed",
        "email": true,
        "locked": true,
        "locked_reason": "Security notifications are always sent."
      },
      {
        "notification": "member-removed",
        "email": true,
        "locked": true,
        "locked_reason": "Security notifications are always sent."
      },
      {
        "notification": "collection-deleted",
        "email": false,
        "locked": false,
        "locked_reason": null
      }
    ]
  }
}
```

**Error answers the operations of this page share**

- `TooManyRequests` (`429`): A limit on this operation's requests is spent: the [rate limits](https://docs.mountaya.com/en/apis/conventions/rate-limits.md) page lists every one, the unknown publishable keys one address may present among them, and the operation's description names any of its own. The request was counted and nothing was done. `Retry-After` says how long until the limit lifts; wait that long, with a little jitter of your own, and send the request again. Where the operation takes an `Idempotency-Key`, a write sent again with the same key runs once.
- `IdempotencyKeyInUse` (`409`): The `Idempotency-Key` this request carries is one an earlier request was sent with, and the answer to that one cannot be given here. Nothing was done by this request. Its entry says which. `IDEMPOTENCY_KEY_IN_USE`: the first request is still running. Wait the `Retry-After` this carries and send the same request again, which is then answered with the first request's outcome. `IDEMPOTENCY_ANSWER_UNAVAILABLE`: the first request's write was made, and its answer cannot be given again, because it was too large to keep whole, because the request failed with a `5xx` after the write was made, or because it carried a credential shown only once, which is never kept. `extensions.metadata` names the status it was answered with, and its `Location` and `ETag` where it carried them; a create whose operation says so names what it made there after a `5xx` too. Read the resource again rather than sending the write once more, which is answered the same way. A credential cannot be read again: where the operation says its answer carries one, the one it created is at `metadata.location`, so revoke that one and create another.
