# Organization Members

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

Who belongs to an organization, what each may do, and who is invited to join it.

 An invitation is held by an email address until the person it names accepts it under `/v1/me`, declines it, has it withdrawn, or lets it expire, and holds a seat meanwhile. Only the owner grants, revokes or removes `admin`, and only the owner hands ownership on, and only signed in to Mountaya's web application: under a key these acts are a `403` whoever the session names. Every operation here needs a session token beside the key.

## The OrganizationMember object

Somebody who has joined an organization, with the role they hold in it. An invitation that has not been accepted is not a member: it is an `OrganizationInvitation`, listed by `getOrganizationInvitations`.

- `user_id` (string (uuid), required): Identifier of the member's account. It is what names them on `patchOrganizationMember` and `deleteOrganizationMember`, and the `user_id` a session token is minted for when a page acts as them.

- `email` (string (email)): The member's account address. Absent for a member whose account cannot be resolved at that moment, who is listed without it.

- `name` (string): The member's display name, present when the member has set one and their account can be resolved. Unbounded, unlike the name of a resource this API mints: it belongs to the person's account, and no operation here writes it.

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

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

### An example OrganizationMember

```json
{
  "user_id": "7a4e1c98-3b52-4f60-9d81-c05e2f7a83b1",
  "email": "camille@example.com",
  "name": "Camille Rey",
  "role": "contributor",
  "joined_at": "2026-02-03T08:41:27Z"
}
```

## The OrganizationInvitation object

An invitation to join an organization, held by an email address until the person it names accepts or declines it, somebody withdraws it, or it expires. It holds a seat from the moment it is made until then.

It names the address and never an account: whether an account carries the address is not part of any answer, so an invitation reads the same whether or not the person has signed up. The person finds it, once their account has verified the address, through `getMyInvitations`.

- `id` (string (uuid), required): Identifier of the invitation. It is what `getOrganizationInvitation` and `deleteOrganizationInvitation` take, and what the invited person accepts or declines under `/v1/me/invitations`.

- `email` (string (email), required): The address invited, as stored: trimmed and lowercased.

- `role` (string, required, one of: `admin`, `contributor`, `viewer`): The role the person holds once they accept. `owner` is not among the values: it is never granted by invitation.

- `invited_by` (object, required): The member who made the invitation.
  - `id` (string (uuid), required): Identifier of the user this relation is about.

- `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. An expired invitation frees its seat and is listed nowhere, and the address may be invited again.

### An example OrganizationInvitation

```json
{
  "id": "3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43",
  "email": "camille@example.com",
  "role": "contributor",
  "invited_by": {
    "id": "1b9d4e72-0c35-4a8f-b6e1-5f2c7d904a18"
  },
  "created_at": "2026-10-20T09:12:44Z",
  "expires_at": "2026-11-19T09:12:44Z"
}
```

## List an organization's members

### GET /v1/organizations/{organization_id}/members

- Operation: `getOrganizationMembers`
- Requires: scope `management` · acting user optional (a session token naming a member, or one minted without `user_id`)
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Returns everybody who has joined the organization, with the role each holds and when they joined. An invitation still waiting for an answer is not a member and is never listed here: `getOrganizationInvitations` lists those, and an invited person appears here once they accept. A member whose account cannot be resolved at that moment is listed without `name` and `email`.

- A session token minted for `api` without `user_id` is asked for no member role on this read; one minted for `studio-embedded` without `user_id` is the `401` a key alone gets. One that names a user is answered only while that user is a member of the organization, in any role, and is a 403 otherwise.
- The writes beside it act as the user the session token names: `patchOrganizationMember` changes a member's role, and `deleteOrganizationMember` removes a member or lets one leave. The owner's own acts, granting, taking away or removing `admin`, an admin leaving and handing the organization to another member, are made only by the owner, signed in to Mountaya's web application.
- The listing pages by cursor. `role` narrows it to the members holding one role, and `sort` orders it by `joined_at`, oldest first unless asked otherwise. 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 naming a user, it is limited to 1200 a minute per user the token names and then to 6000 a minute per organization, and one made with a session token minted without `user_id` is held as the key alone is, to 600 a minute per client IP address and then 6000 per organization; past either, the answer is a `429` carrying `Retry-After`.

Requires a publishable key with the `management` scope AND a session token. A publishable key without a session token is not accepted here: a key written to be shipped in a browser cannot be sufficient on its own to read or change an organization's account.

**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.

**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.

- `role` (string, in query, optional, one of: `owner`, `admin`, `contributor`, `viewer`): List only the members holding this role. Omitted, every member is listed. `owner` names the one owner.

- `sort` (string, in query, optional, default: `joined_at`, one of: `joined_at`, `-joined_at`): The order of the listing: `joined_at`, the earliest to join first, which is the default, or `-joined_at`, the latest first. Members who joined at the same instant are ordered by `user_id`, so the order is total and a page never repeats or skips one of them.

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 members who have joined, in the order `sort` asks for. `extensions.metadata.pagination.next_cursor` asks for the next page, and is `next_cursor: null` on the last one.

- `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 OrganizationMember, required): See [the OrganizationMember object](https://docs.mountaya.com/en/apis/map-studio/reference/organization-members.md#organization-member-object).

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

- `400`: Bad Request
- `401`: Unauthorized
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `management` scope, or the path names an organization other than the key's own, whether or not it exists, or the session token names a user without a role in the organization, as a user who has left it, or whose invitation is still pending, is. Any role passes. A session token minted for `api` without `user_id` is asked for no role: it IS the organization's own backend's credential, minted server-side from its secret key, so it authorizes the read without a member behind it. One minted for `studio-embedded` without `user_id` is the `401` a key alone gets. 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`: Answered only from Mountaya's web application: the path names an organization the person is not a member of, or one that does not exist. The two answer alike, so the path cannot be used to learn which organizations exist. Under a publishable key an identifier other than the key's organization is a `403` instead, whether or not it 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/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/members?role=admin" \
  -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.members.getOrganizationMembers({
  organization_id: "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  query: { role: "admin" },
});

console.log(data);
```

**Python**

```python
import requests

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

Response 200:

```json
{
  "data": [
    {
      "user_id": "7a4e1c98-3b52-4f60-9d81-c05e2f7a83b1",
      "email": "camille@example.com",
      "name": "Camille Rey",
      "role": "contributor",
      "joined_at": "2026-02-03T08:41:27Z"
    }
  ],
  "extensions": {
    "metadata": {
      "pagination": {
        "limit": 50,
        "next_cursor": "eyJ2IjoxLCJzIjoiLXVwZGF0ZWRfYXQifQ"
      }
    }
  }
}
```

## Change a member's role

### PATCH /v1/organizations/{organization_id}/members/{user_id}

- Operation: `patchOrganizationMember`
- Requires: scope `management` · 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 what one member may do in the organization. The role is the whole of what a membership carries that a caller can change; the member keeps their `joined_at`, and the new role governs every request they make from the next one.

- Owner or admin only (403 otherwise).
- Under a key, `admin` is neither granted nor taken away: granting it, and changing the role of a member who holds it, an admin's own role included, is a 403 whoever asks. The owner's session under a key is answered as an admin's, because a session token names whoever the holder of a secret key chose, so these acts are made only by the owner, signed in to Mountaya's web application. A key moves members between `contributor` and `viewer`.
- The owner's role cannot be changed, the owner's own request included: it is a 409. Ownership moves only in Mountaya's web application, where the owner hands it to another member and becomes an admin. `owner` is not a value this takes, so asking for it is a 400.
- A `user_id` that matches no member who has joined the organization is a 404, whether or not an account carries it, and whether or not an invitation to that person is waiting. An invitation's role is not changed here: withdraw it with `deleteOrganizationInvitation` and invite again.
- Sending the role the member already holds changes nothing and answers the member as they stand.
- A change of role changes nothing about seats: a member holds one seat whatever their role, so no role costs more than another and no change is refused for the organization's seats.

Requires a publishable key with the `management` scope AND a session token naming a user, a member with the owner or admin role, whom the request acts as. A session token minted without `user_id` is refused with **401**, and a publishable key without a session token is not accepted here: a key written to be shipped in a browser cannot be sufficient on its own to read or change an organization's account.

**Webhook events** [`organization.member.updated`](https://docs.mountaya.com/en/webhooks/events/organization-member.md#organization-member-updated), recorded by the task `organization.member.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.

- `user_id` (string (uuid), in path, required): Identifier of the member the operation acts on, the `user_id` a member listing carries. Naming the user the session token names is how a member acts on their own membership. An identifier that matches no member who has joined the organization is answered as each operation says, alike whether or not an account carries it, so no status tells a caller which user identifiers 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 role the member holds after the change.

- `role` (string, in body, required, one of: `admin`, `contributor`, `viewer`): The role the member holds after the change. `owner` is not among the values: it is never granted here.

**Response** `200`

The member after the change, holding the role sent.

- `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` (OrganizationMember, required): Somebody who has joined an organization, with the role they hold in it. An invitation that has not been accepted is not a member: it is an `OrganizationInvitation`, listed by `getOrganizationInvitations`.

  See [the OrganizationMember object](https://docs.mountaya.com/en/apis/map-studio/reference/organization-members.md#organization-member-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`, `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
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `management` 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, or is a member who is neither owner nor admin. A user outside the organization and a member without the role answer alike. Granting `admin`, and changing the role of a member who holds it, their own included, are refused here as well, to the owner as to an admin: under a key the owner is answered as an admin, and only the owner makes those changes, signed in to Mountaya's web application. 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`: Nobody with that identifier has joined the organization. An identifier an account carries and one that matches no user answer alike, and so does a person whose invitation is still waiting, so this status cannot be used to learn which user ids exist. The path names the key's own organization: another organization is a `403`.
- `409`: The member in the path is the organization's owner, whose role cannot be changed, the owner's own request included. Nothing is changed. Ownership moves only in Mountaya's web application, after which the former owner is an admin whose role the new owner can change there. A request carrying the same `Idempotency-Key` as one still running is refused here too: its entry is coded `IDEMPOTENCY_KEY_IN_USE` and it carries `Retry-After`, after which the same request is answered with the first one's outcome. A request repeating the key of one whose answer cannot be replayed is refused here as well, its entry coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`: the answer was too large to keep whole, or the request failed with a `5xx` after its write was made. Either way that write was made, and `extensions.metadata` is the `ResponseMetadataIdempotentAnswer` naming how it was answered, so read the resource again rather than sending the write once more.
- `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/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/members/8f14e45f-ceea-467a-9575-3f1b1a2d9c47 \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Content-Type: application/json" \
  -d '{"role": "contributor"}'
```

**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.members.patchOrganizationMember({
  organization_id: "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  user_id: "8f14e45f-ceea-467a-9575-3f1b1a2d9c47",
  body: { role: "contributor" },
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.patch(
    "https://api.mountaya.com/v1/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/members/8f14e45f-ceea-467a-9575-3f1b1a2d9c47",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={"role": "contributor"},
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "user_id": "7a4e1c98-3b52-4f60-9d81-c05e2f7a83b1",
    "email": "camille@example.com",
    "name": "Camille Rey",
    "role": "contributor",
    "joined_at": "2026-02-03T08:41:27Z"
  }
}
```

## Remove a member from an organization, or leave it

### DELETE /v1/organizations/{organization_id}/members/{user_id}

- Operation: `deleteOrganizationMember`
- Requires: scope `management` · 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

Removes one member from the organization. What they created stays with the organization, and their seat is freed. A member naming themself in the path is leaving.

- Removing somebody else takes the owner or admin role. Under a key, removing a member who holds `admin` is a 403 whoever asks: the owner's session under a key is answered as an admin's, and only the owner removes an admin, signed in to Mountaya's web application.
- Leaving is open to contributors and viewers. Under a key, an admin naming themself is a 403, and so is the owner, answered as an admin there: an admin leaves only from Mountaya's web application, since a session token names whoever the holder of a secret key chose.
- The owner cannot be removed, and cannot leave from Mountaya's web application either: either is a 409. The owner hands the organization to another member there first; the former owner is then an admin, who leaves or is removed there.
- Removing is an act on a membership rather than on a resource: for an owner or admin, a `user_id` that matches no member who has joined the organization answers 200 and changes nothing, whether or not an account carries it, so a removal sent again, or racing another, is not an error. An invitation is not a membership and is not withdrawn here: `deleteOrganizationInvitation` withdraws it.
- A member who has left holds no role, so a leave sent again is refused with 403 unless it carries the first request's `Idempotency-Key`, which answers it with the first one's 200.
- The removed member's session tokens act as nobody in the organization from their next request: every operation asking a role refuses them, and every read, every tile and the Data API serve them published content only, as the key alone is served.
- Removing a member, or a member leaving, also ends every MCP connector that person authorized through Mountaya's OAuth consent, whichever organization's key it was bound to, when they joined the organization themself, signed in to Mountaya's web application: by creating it or by accepting its invitation there. The consents are ended for the person, not for this organization. A connector bound to this organization's key stops within a minute; one bound to another organization they still belong to keeps working until its access token expires and, once the consents are ended, cannot renew it, so they authorize it again. The removal is answered `200` once the membership is removed: ending the consents never fails that answer, waits on the provider for at most five seconds, and is retried until it is done. A connector the person authorizes again before it is done, for another organization or for this one once invited back, is ended with the rest, and they authorize it once more.
- A membership accepted under a publishable key, with a session token naming the person, ends none of their consents when it is removed: the organization made it without a session of the person's own, so its removal leaves their connectors to their other organizations alone. A connector bound to this organization's key still stops within a minute, since it is refused while the person is not a member. How the membership was accepted decides, whoever removes it and whichever credential the removal is sent under. A membership accepted before this release counts as accepted in Mountaya's web application, however it was accepted.

Requires a publishable key with the `management` scope AND a session token naming a user, a member of any role, whom the request acts as. A session token minted without `user_id` is refused with **401**, and a publishable key without a session token is not accepted here: a key written to be shipped in a browser cannot be sufficient on its own to read or change an organization's account.

**Webhook events** [`organization.member.deleted`](https://docs.mountaya.com/en/webhooks/events/organization-member.md#organization-member-deleted), recorded by the tasks `organization.member.delete`, `organization.member.leave`.

**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.

- `user_id` (string (uuid), in path, required): Identifier of the member the operation acts on, the `user_id` a member listing carries. Naming the user the session token names is how a member acts on their own membership. An identifier that matches no member who has joined the organization is answered as each operation says, alike whether or not an account carries it, so no status tells a caller which user identifiers 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.

**Response** `200`

The member is removed, or has left, or had not joined. `data` is null; read `getOrganizationMembers` for who is left.

- `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`, `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
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `management` 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: a user who has left it, or whose invitation is still pending, is not one. Removing a member other than the user the session token names takes the owner or admin role. Under a key, removing a member who holds `admin`, and an admin or the owner naming themself, are refused here whoever asks: the owner is answered as an admin there, and those acts are made only from Mountaya's web application. A user outside the organization and a member without the role answer alike. 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`: Answered only from Mountaya's web application: the path names an organization the person is not a member of, or one that does not exist. The two answer alike, so the path cannot be used to learn which organizations exist. Under a publishable key an identifier other than the key's organization is a `403` instead, whether or not it exists. Never for the member in the path: a `user_id` that matches no member who has joined the organization answers `200`, since there is no membership left to remove.
- `409`: The member in the path is the organization's owner, who cannot be removed and, from Mountaya's web application, cannot leave. Nothing is changed. The owner hands ownership on there first; the former owner is then an admin, who can leave or be removed there. A request carrying the same `Idempotency-Key` as one still running is refused here too: its entry is coded `IDEMPOTENCY_KEY_IN_USE` and it carries `Retry-After`, after which the same request is answered with the first one's outcome. A request repeating the key of one whose answer cannot be replayed is refused here as well, its entry coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`: the answer was too large to keep whole, or the request failed with a `5xx` after its write was made. Either way that write was made, and `extensions.metadata` is the `ResponseMetadataIdempotentAnswer` naming how it was answered, so read the resource again rather than sending the write once more.
- `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/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/members/8f14e45f-ceea-467a-9575-3f1b1a2d9c47 \
  -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.members.deleteOrganizationMember({
  organization_id: "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  user_id: "8f14e45f-ceea-467a-9575-3f1b1a2d9c47",
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.delete(
    "https://api.mountaya.com/v1/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/members/8f14e45f-ceea-467a-9575-3f1b1a2d9c47",
    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
}
```

## List an organization's pending invitations

### GET /v1/organizations/{organization_id}/invitations

- Operation: `getOrganizationInvitations`
- Requires: scope `management` · acting user optional (a session token naming a member, or one minted without `user_id`)
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Returns the invitations to the organization still waiting for an answer: the address each names, the role accepting grants, who made it, and when it lapses. An invitation leaves this listing when the person accepts it, and is then a member `getOrganizationMembers` lists, when they decline it, when it is withdrawn, or when it expires thirty days after it was made. Every invitation listed holds a seat.

- It names addresses and never accounts: whether an account carries an address is not part of the answer.
- A session token minted for `api` without `user_id` is asked for no member role on this read; one minted for `studio-embedded` without `user_id` is the `401` a key alone gets. One that names a user is answered only while that user is a member of the organization, in any role, and is a 403 otherwise. Inviting and withdrawing take the owner or admin role.
- The listing pages by cursor. `role` narrows it to the invitations granting one role, and `sort` orders it by `created_at`, newest first unless asked otherwise. 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 naming a user, it is limited to 1200 a minute per user the token names and then to 6000 a minute per organization, and one made with a session token minted without `user_id` is held as the key alone is, to 600 a minute per client IP address and then 6000 per organization; past either, the answer is a `429` carrying `Retry-After`.

Requires a publishable key with the `management` scope AND a session token. A publishable key without a session token is not accepted here: a key written to be shipped in a browser cannot be sufficient on its own to read or change an organization's account.

**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.

**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.

- `role` (string, in query, optional, one of: `admin`, `contributor`, `viewer`): List only the invitations granting this role on acceptance. Omitted, every pending invitation is listed.

- `sort` (string, in query, optional, default: `-created_at`, one of: `-created_at`, `created_at`): The order of the listing: `-created_at`, the newest invitation first, which is the default, or `created_at`, the oldest first. Invitations made at the same instant are ordered by `id`, so the order is total and a page never repeats or skips one of them.

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 an answer, in the order `sort` asks for. `extensions.metadata.pagination.next_cursor` asks for the next page, and is `next_cursor: null` on the last one.

- `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 OrganizationInvitation, required): See [the OrganizationInvitation object](https://docs.mountaya.com/en/apis/map-studio/reference/organization-members.md#organization-invitation-object).

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

- `400`: Bad Request
- `401`: Unauthorized
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `management` scope, or the path names an organization other than the key's own, whether or not it exists, or the session token names a user without a role in the organization, as a user who has left it, or whose invitation is still pending, is. Any role passes. A session token minted for `api` without `user_id` is asked for no role: it IS the organization's own backend's credential, minted server-side from its secret key, so it authorizes the read without a member behind it. One minted for `studio-embedded` without `user_id` is the `401` a key alone gets. 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`: Answered only from Mountaya's web application: the path names an organization the person is not a member of, or one that does not exist. The two answer alike, so the path cannot be used to learn which organizations exist. Under a publishable key an identifier other than the key's organization is a `403` instead, whether or not it 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/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/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.invitations.getOrganizationInvitations({ organization_id: "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b" });

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://api.mountaya.com/v1/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/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",
      "email": "camille@example.com",
      "role": "contributor",
      "invited_by": {
        "id": "1b9d4e72-0c35-4a8f-b6e1-5f2c7d904a18"
      },
      "created_at": "2026-10-20T09:12:44Z",
      "expires_at": "2026-11-19T09:12:44Z"
    }
  ],
  "extensions": {
    "metadata": {
      "pagination": {
        "limit": 50,
        "next_cursor": "eyJ2IjoxLCJzIjoiLXVwZGF0ZWRfYXQifQ"
      }
    }
  }
}
```

## Invite somebody to an organization by email

### POST /v1/organizations/{organization_id}/invitations

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

Invites one address, with the role the person holds once they accept. A client inviting several people sends one request for each. Nothing is sent to the address: telling the person is the caller's to do. The person finds the invitation through `getMyInvitations` once their account has verified the address, under a session token `postSession` mints for them before they have joined, and answers it with `postMyInvitationAccept` or `deleteMyInvitation`.

- Owner or admin only (403 otherwise). Under a key, inviting as `admin` is a 403 whoever asks, the owner included, whose session under a key is answered as an admin's: only the owner invites an admin, signed in to Mountaya's web application.
- Any well-formed address is accepted, stored trimmed and lowercased, and answered alike whether or not an account carries it, so this cannot be used to learn which addresses have accounts. An address no account carries waits for the person to sign up and verify it.
- An address that already belongs to a member, or that already has an invitation waiting for an answer, is a 409 naming which, so a second request for one address never makes a second invitation. To change the role of a waiting invitation, withdraw it with `deleteOrganizationInvitation` and invite again.
- `owner` is never granted by invitation, so asking for it is a 400.
- Every invitation holds a seat from the moment it is made, and seats count the organization's members and its unexpired invitations together. One that would take that count past the seats the organization's agreement allows is a 429 coded `LIMIT_REACHED`, whose `extensions.metadata.limit` reads `seats`; an agreement that names no seat limit allows any number. Invitations sent at the same moment cannot both take the last seat. It clears when a member is removed or leaves, an invitation is declined, withdrawn or lapses, or the organization's agreement allows more seats.
- At most 500 invitations wait at once in an organization: one more is a 429 coded `LIMIT_REACHED`, whose `extensions.metadata.limit` reads `pending-invitations`, and which no agreement raises, so it clears only as invitations are answered, withdrawn or lapse.
- Neither ceiling carries `Retry-After`, since no wait lifts it, and `extensions.metadata` carries how many it allows, `allowed`, and how many are held, `used`. Nothing is invited. The seats are asked before the invitations waiting, and both after every other refusal, so a request refused with a `400`, a `409`, or a `403` for the caller's role is answered that way whatever is left of either.
- An invitation lapses thirty days after it is made if nobody answers it, which frees its seat and lets the address be invited again.
- Invitations are limited to 30 per minute for the user the session token names, and to 200 per day for the organization; past either limit the answer is a `429` carrying `Retry-After`. An invitation counts toward the organization's day only once the user is known to be one of its owners or admins and the request is well formed: one refused with a `400`, or with the `403` of a role that may not send it, never spends it, so nobody outside the organization can use up its day.

Requires a publishable key with the `management` scope AND a session token naming a user, a member with the owner or admin role, whom the request acts as. A session token minted without `user_id` is refused with **401**, and a publishable key without a session token is not accepted here: a key written to be shipped in a browser cannot be sufficient on its own to read or change an organization's account.

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

**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 address to invite and the role it grants on acceptance.

- `email` (string (email), in body, required): The address to invite, any well-formed address, stored trimmed and lowercased. It need not belong to an account: the invitation waits for the person to sign up and verify it. Nothing is sent to it by this operation. Whether an account carries it never changes the answer.

- `role` (string, in body, required, one of: `admin`, `contributor`, `viewer`): The role the person holds once they accept. `owner` is not among the values: it is never granted by invitation. Only the owner invites as `admin`, signed in to Mountaya's web application: under a key, `admin` is a `403` whoever asks.

**Response** `201`

The invitation as made, waiting for an answer and holding a seat. `Location` names it, `/v1/organizations/{organization_id}/invitations/{invitation_id}`.

- `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` (OrganizationInvitation, required): An invitation to join an organization, held by an email address until the person it names accepts or declines it, somebody withdraws it, or it expires. It holds a seat from the moment it is made until then.

  It names the address and never an account: whether an account carries the address is not part of any answer, so an invitation reads the same whether or not the person has signed up. The person finds it, once their account has verified the address, through `getMyInvitations`.

  See [the OrganizationInvitation object](https://docs.mountaya.com/en/apis/map-studio/reference/organization-members.md#organization-invitation-object).

Response headers:

- `Location`: The path of what the request created, relative to this host. A part of an itinerary is addressed under its itinerary, so a new segment's is `/v1/itineraries/{itinerary_id}/segments/{segment_id}`.
- `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`, `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
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `management` 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, or is a member who is neither owner nor admin. Inviting as `admin` is refused here as well, to the owner as to an admin: under a key the owner is answered as an admin, and only the owner invites an admin, signed in to Mountaya's web application. A user outside the organization and a member without the role answer alike. 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`: Answered only from Mountaya's web application: the path names an organization the person is not a member of, or one that does not exist. The two answer alike, so the path cannot be used to learn which organizations exist. Under a publishable key an identifier other than the key's organization is a `403` instead, whether or not it exists.
- `409`: The address already belongs to a member of the organization, or an invitation to it is already waiting for an answer. Nothing is invited. `extensions.metadata` names which: `member.user_id` for the member, whose role `patchOrganizationMember` changes, or `invitation.id` for the invitation, which `deleteOrganizationInvitation` withdraws before the address is invited again with another role. A request carrying the same `Idempotency-Key` as one still running is refused here too: its entry is coded `IDEMPOTENCY_KEY_IN_USE`, names no resource at `extensions.metadata`, and it carries `Retry-After`, after which the same request is answered with the first one's outcome. A request repeating the key of one whose answer cannot be replayed is refused here as well, its entry coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`: the answer was too large to keep whole, or the request failed with a `5xx` after its write was made. Either way that write was made, and `extensions.metadata` is the `ResponseMetadataIdempotentAnswer` naming how it was answered, so read the resource again rather than sending the write once more. Its `location` names the invitation made, `/v1/organizations/{organization_id}/invitations/{invitation_id}`, after a `5xx` as after a `201`.
- `413`: Payload Too Large
- `429`: `TooManyRequestsOrLimitReached`, 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/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/invitations \
  -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 '{"email": "camille@example.com", "role": "contributor"}'
```

**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.invitations.postOrganizationInvitation({
  organization_id: "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  body: { email: "camille@example.com", role: "contributor" },
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.post(
    "https://api.mountaya.com/v1/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/invitations",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={"email": "camille@example.com", "role": "contributor"},
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 201:

```json
{
  "data": {
    "id": "3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43",
    "email": "camille@example.com",
    "role": "contributor",
    "invited_by": {
      "id": "1b9d4e72-0c35-4a8f-b6e1-5f2c7d904a18"
    },
    "created_at": "2026-10-20T09:12:44Z",
    "expires_at": "2026-11-19T09:12:44Z"
  }
}
```

## Retrieve a pending invitation

### GET /v1/organizations/{organization_id}/invitations/{invitation_id}

- Operation: `getOrganizationInvitation`
- Requires: scope `management` · acting user optional (a session token naming a member, or one minted without `user_id`)
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Returns one invitation to the organization that is still waiting for an answer: the address it names, the role accepting grants, who made it, and when it lapses. Once the person accepts or declines it, or it is withdrawn or lapses, it is gone and its identifier is a 404; a person who accepted is a member `getOrganizationMembers` lists.

- A session token minted for `api` without `user_id` is asked for no member role on this read; one minted for `studio-embedded` without `user_id` is the `401` a key alone gets. One that names a user is answered only while that user is a member of the organization, in any role, and is a 403 otherwise.

Like every read made with a session token naming a user, it is limited to 1200 a minute per user the token names and then to 6000 a minute per organization, and one made with a session token minted without `user_id` is held as the key alone is, to 600 a minute per client IP address and then 6000 per organization; past either, the answer is a `429` carrying `Retry-After`.

Requires a publishable key with the `management` scope AND a session token. A publishable key without a session token is not accepted here: a key written to be shipped in a browser cannot be sufficient on its own to read or change an organization's account.

**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.

- `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`.

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, still waiting for an answer and holding a seat.

- `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` (OrganizationInvitation, required): An invitation to join an organization, held by an email address until the person it names accepts or declines it, somebody withdraws it, or it expires. It holds a seat from the moment it is made until then.

  It names the address and never an account: whether an account carries the address is not part of any answer, so an invitation reads the same whether or not the person has signed up. The person finds it, once their account has verified the address, through `getMyInvitations`.

  See [the OrganizationInvitation object](https://docs.mountaya.com/en/apis/map-studio/reference/organization-members.md#organization-invitation-object).

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

- `400`: Bad Request
- `401`: Unauthorized
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `management` scope, or the path names an organization other than the key's own, whether or not it exists, or the session token names a user without a role in the organization, as a user who has left it, or whose invitation is still pending, is. Any role passes. A session token minted for `api` without `user_id` is asked for no role: it IS the organization's own backend's credential, minted server-side from its secret key, so it authorizes the read without a member behind it. One minted for `studio-embedded` without `user_id` is the `401` a key alone gets. 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 in the organization: none was ever made, or it was accepted, declined or withdrawn, or it lapsed, or it is another organization's. These answer alike, so this status cannot be used to learn which invitation ids exist. The path names the key's own organization: another organization is a `403`.
- `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/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/invitations/3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43 \
  -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.invitations.getOrganizationInvitation({
  organization_id: "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  invitation_id: "3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43",
});

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://api.mountaya.com/v1/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/invitations/3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43",
    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",
    "email": "camille@example.com",
    "role": "contributor",
    "invited_by": {
      "id": "1b9d4e72-0c35-4a8f-b6e1-5f2c7d904a18"
    },
    "created_at": "2026-10-20T09:12:44Z",
    "expires_at": "2026-11-19T09:12:44Z"
  }
}
```

## Withdraw a pending invitation

### DELETE /v1/organizations/{organization_id}/invitations/{invitation_id}

- Operation: `deleteOrganizationInvitation`
- Requires: scope `management` · 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

Withdraws an invitation still waiting for an answer, which frees its seat. The person it names cannot accept it afterwards, and the address may be invited again.

- Owner or admin only (403 otherwise), whatever role the invitation grants: withdrawing grants nothing.
- Withdrawing is an act on the invitation's state rather than on a resource, so an invitation already gone answers 200 and changes nothing: one already declined, withdrawn or lapsed, and an identifier naming no invitation of this organization at all. A withdrawal sent again, or racing the person's own answer, is therefore not an error.
- An invitation already accepted is gone as well: the person is a member, and `deleteOrganizationMember` removes them.

Requires a publishable key with the `management` scope AND a session token naming a user, a member with the owner or admin role, whom the request acts as. A session token minted without `user_id` is refused with **401**, and a publishable key without a session token is not accepted here: a key written to be shipped in a browser cannot be sufficient on its own to read or change an organization's account.

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

**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.

- `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 withdrawn, or was already gone. `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`, `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
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `management` 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, or is a member who is neither owner nor admin. A user outside the organization and a member without the role answer alike. 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`: Answered only from Mountaya's web application: the path names an organization the person is not a member of, or one that does not exist. The two answer alike, so the path cannot be used to learn which organizations exist. Under a publishable key an identifier other than the key's organization is a `403` instead, whether or not it exists. Never for the invitation in the path: one that is gone, or that never was this organization's, answers `200`, since there is nothing left waiting to withdraw, 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/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/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.invitations.deleteOrganizationInvitation({
  organization_id: "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  invitation_id: "3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43",
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.delete(
    "https://api.mountaya.com/v1/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/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
}
```

**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.
- `TooManyRequestsOrLimitReached` (`429`): A limit or a ceiling refused the request, and nothing was done. Its entry says which. `TOO_MANY_REQUESTS`: a limit counted over a window is spent, one the [rate limits](https://docs.mountaya.com/en/apis/conventions/rate-limits.md) page lists or the operation's description names. `Retry-After` says how long until it 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. `LIMIT_REACHED`: a ceiling the operation's description names is reached, a count of something the organization or the person holds rather than a rate. `extensions.metadata` names the ceiling, with how many it allows and how many are held, and no `Retry-After` is sent, since no wait lifts it: the same request is refused the same way until something is freed or the organization's agreement allows more, so it is not sent again as it is. The refusal is not kept for the request's `Idempotency-Key`, so the same request sent with that key once a place is free runs then.
- `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.
