# Organizations

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

An organization and its settings: the workspace itineraries, zones and collections belong to.

 `getOrganization` takes a publishable key with the `publishing` scope, or a share token, and `postOrganizationLookup` takes no credential at all; every other operation here needs a session token beside the key.

## The Organization object

An organization: the workspace itineraries, zones and collections belong to, together with the settings that shape its embeds. What the organization's agreement entitles it to is not part of it: the products a person's organizations hold are read as `organization_capabilities` on `getMyOrganizations`, and the one entitlement an embed paints by is `white_label`, which every read carries.

- `created_at` (string (date-time), required): Timestamp of the organization's creation.

- `etag` (string, required): The version of the organization's own fields, the one the `ETag` of a read of it carries, opaque and compared whole. Send it as `If-Match` to make `patchOrganization` conditional. A change to the settings moves the settings' own `etag` and not this one, so a rename and a settings edit made at the same moment never refuse each other.

- `id` (string (uuid), required): Identifier of the organization, and the value every `{organization_id}` path takes.

- `name` (string, required): Display name of the organization.

- `awaiting_agreement` (boolean, required): Whether the organization was created to be covered by an agreement with Mountaya, which `agreement_requested` on `postOrganization` asks for, and no agreement has been set for it. It reads false again once one is. It never grants anything: an organization awaiting its agreement holds no product, and it is the agreement, once set, that grants the products it names. It tells a client to wait for the agreement rather than to ask for a card.

- `settings` (object, required): The settings that shape the organization's embeds. They are changed through `patchOrganizationSettings` rather than through an organization update.
  - `etag` (string, required): The version of the settings, the one the `ETag` of a read of them carries, opaque and compared whole. Send it as `If-Match` to make `patchOrganizationSettings` conditional. The settings are versioned apart from the organization's own fields, so a settings edit never refuses a rename made at the same moment, nor the other way round.
  - `default_props` (object, required): What an embed starts with when it names nothing itself: language, units, theme and the rest. An embed may override any of these per instance.
    - `preferred_language` (string, required, one of: `en`, `fr`, `es`, `it`, `de`, `zh`, `ja`): Language an embed's interface and place names start in.
    - `preferred_theme` (string, required, one of: `auto`, `light`, `dark`): Color theme an embed starts in. `auto` follows the visitor's operating-system preference.
    - `preferred_unit_length` (string, required, one of: `metric`, `imperial`): Unit distances and elevations are displayed in.
    - `preferred_unit_pace` (string, required, one of: `per-time`, `per-distance`): Form travel rates are expressed in. `per-time` renders a speed (km/h with metric, mph with imperial); `per-distance` renders a pace, the reciprocal (min/km with metric, min/mi with imperial). The unit *system* still comes from `preferred_unit_length`; this chooses only the form.
    - `preferred_unit_slope` (string, required, one of: `degrees`, `percentage`): Unit gradients are displayed in, on both the elevation profile and the segment readouts.
    - `preferred_unit_temperature` (string, required, one of: `celsius`, `fahrenheit`): Unit temperatures are displayed in.
    - `segments_color` (string, required): Single color every itinerary segment is painted in on an embed, on both the map lines and the elevation profile bands. An empty string means each segment keeps its own color. Applies to an embed only, never to a shared itinerary view.

      A hex code with a leading hash, in three-digit or six-digit form; a three-digit value is stored expanded to six digits and lowercased, so `#F00` is accepted and read back as `#ff0000`. The empty string is the only other accepted value. Anything else is a 400.
    - `terrain` (string, required): Slug of the terrain an embed loads first, drawn from the terrain catalog the tiles API's layers manifest publishes. Only the initial selection: a visitor may switch to any terrain `with_terrains` permits. A slug absent from the manifest leaves the map on the Mountaya default terrain.
    - `terrain_variant` (string, required, one of: `light`, `dark`): Visual style the terrain starts in, for terrains that publish both a light and a dark rendering.
    - `with_access_restrictions` (boolean, required): Whether the stretches of an itinerary's route whose access is restricted are drawn, as stripes and a warning icon per kind, read from the `itinerary_restrictions` layer of the itinerary tiles. No safety rule governs it.
    - `with_collection_itineraries` (boolean, required): Whether a collection embed draws the itineraries the collection contains. It is the default a collection tile request without `with_itineraries` falls back to. Capped by `safety_rules.with_collection_itineraries`, which withholds the layer server-side when false.
    - `with_collection_zones` (boolean, required): Whether a collection embed draws the zones the collection contains, which are its published public zones, each as last published, since the embed reads as the public does. It is the default a collection tile request without `with_zones` falls back to. Capped by `safety_rules.with_collection_zones`, which withholds the layer server-side when false.
    - `with_directions_control` (boolean, required): Whether the directions control is offered, opening the turn-by-turn directions of the itinerary's routed segments as they were stored, to read, print or download as a PDF. It computes no route: a visitor never routes between points of their own. No safety rule governs it.
    - `with_download_control` (boolean, required): Whether the export control is offered, letting a visitor download an itinerary in any of the export formats (GPX, FIT, TCX, GeoJSON, KML, KMZ and CSV). No safety rule governs it.
    - `with_navigation_control` (boolean, required): Whether the map navigation controls, the zoom and compass buttons, are shown. An embed never offers geolocation, whatever this says, because it never asks a visitor for their location. No safety rule governs it; the zoom range a visitor can actually reach is set by `safety_rules.zoom_min` and `safety_rules.zoom_max`.
    - `with_overlays` (array of string, required): Slugs of the terrain overlays offered in the overlay picker. **An empty array, or one holding the entry `"*"` anywhere, offers the whole catalog**; any other list narrows the picker to those slugs and drops a category left with nothing to show. Note that this is a display list only and its empty case reads the OPPOSITE way from `safety_rules.with_overlays`, where an empty array denies every overlay. An overlay offered here but absent from the safety rule renders no tiles.
    - `with_overlays_control` (boolean, required): Whether the overlay time cursor is offered, letting a visitor move an overlay backwards or forwards in time. Capped by `safety_rules.with_overlays_control`, which, when false, refuses a tile asked for more than 15 minutes from the current instant on every overlay the server draws per instant.

      It governs the time cursor alone. It neither offers nor hides the layers control: which overlays a visitor may switch on and off is `with_overlays`, capped by `safety_rules.with_overlays`, and which terrains the switcher offers is `with_terrains`, so an embed whose overlays are drawn only at the present instant still offers every overlay its cap admits.
    - `with_preferences_control` (boolean, required): Whether the preferences control is offered, letting a visitor change the units (distance, travel rate, slope and temperature) and the interface language for their visit. The theme is not among them: an embed keeps the publisher's `preferred_theme`. No safety rule governs it; it never persists anything to the organization.
    - `with_profile_analysis` (boolean, required): Whether the profile's computed terrain analysis is shown: the surface and way-type bars under the elevation chart, and the surface, way type, trail difficulty, slope and aspect readings of its hover readout. Capped by `safety_rules.with_profile_analysis`, which strips the analysis from the payload server-side when false, so turning this on against a false rule shows nothing.

      Read AGAINST `with_profile_elevation`: on a pointer device the bars are revealed by hovering the elevation curve and are aligned to its distance axis, so the analysis shows nothing while the chart is off.
    - `with_profile_characteristics` (boolean, required): Whether the itinerary's summary characteristics (distance, ascent, descent, duration) are shown alongside the profile. No safety rule governs it.
    - `with_profile_elevation` (boolean, required): Whether the elevation profile chart is shown. Capped by `safety_rules.with_profile_elevation`, which forces the control off and disables it when false.
    - `with_profile_pace_control` (boolean, required): Whether the pace control is offered on the elevation profile, letting a visitor enter their own travel rate and read the itinerary re-timed for it. Resolution runs URL query parameter, then this object, then the Mountaya default, like the rest of this object. The override is session-local and persists nothing: the itinerary's committed speeds are untouched, every other visitor reads the author's figures, and clearing the field restores them. No safety rule governs it; the re-time reveals nothing a visitor cannot already read.

      Requires BOTH `with_profile_elevation` and `with_profile_characteristics`, for two different reasons. The chart, because the rate is read against the curve it re-times. The characteristics row, because that row is WHERE the field renders, beside the segment chooser. With either of them off the field is withheld however the embed is configured.
    - `with_streetview_control` (boolean, required): Whether the street-level imagery control is offered. No safety rule governs it.
    - `with_terrains` (array of string, required): Slugs of the terrains offered in the terrain switcher. **An empty array, or one holding the entry `"*"` anywhere, offers every terrain in the manifest**; any other list narrows the switcher to those slugs. This is the one allowlist with no safety rule behind it. Enforcement is client-side only, which is why it sits here rather than on `EmbeddedStudioSafetyRules`: terrain tiles carry no organization-private data, so restricting the switcher is a presentation choice, not a security boundary. Treat it accordingly.
  - `safety_rules` (object, required): The ceilings an embed cannot raise, whatever it asks for. Unlike `default_props`, these are enforced rather than defaulted: an embed that requests a zoom outside the allowed window is refused, not clamped silently by the client.
    - `boundaries` (array of Boundaries, required): Named geographic regions outside which tiles are refused. A tile request made with a publishable key whose coordinates fall in none of them is rejected with a validation error, which caps how far an embed can pan. **An EMPTY array means no geographic restriction**, so every tile is in range. That makes this list opt-in, unlike `with_overlays`. The zoom range applies either way. Tiles scoped to a single already-authorized resource skip the boundary check (refusing them would hide nothing the caller cannot already read) but still honour the zoom range.
      - `bbox` (array of number (double), required): Bounding box as [minLongitude, minLatitude, maxLongitude, maxLatitude] in WGS 84 decimal degrees. This is the flat four-tuple every bounding box on every Mountaya surface uses, so a client reads one shape everywhere. Exactly four numbers, longitude first in each pair; the minimum corner comes first.

        The bound is WGS 84's own: a coordinate outside it names no point on Earth, and this box is evaluated on every tile request that carries one, so a nonsensical value is not merely inert. `items` holds the widest of the two ranges because a tuple's positions cannot be typed apart in JSON Schema; the per-position latitude range is enforced where the box is written.
      - `name` (string, required): Display name of the bounded region. Bounded in length because it is stored per organization and echoed back on every settings read.
    - `domains` (array of string, required): The pages allowed to call the API from a browser with the organization's publishable keys, and the sites allowed to frame Mountaya's hosted embed. A request is compared by its `Origin`, falling back to `Referer`, after normalization, which ignores letter case and a leading `www.`. Mountaya's own pages are always allowed, whatever the list holds: its web application, and for the API alone its documentation, whose explorer runs the queries a reader sends with their own key. The list is checked against the page a browser names, and only then: a request naming no page, as a server sends, or as a page sends under a `no-referrer` policy that strips `Referer` from a request that carries no `Origin`, such as an image or a map tile, is not checked against it at all. It is therefore not an access control on the key: it decides which pages may use the key from a browser that names them, while the publishable key and, when required, the session token are what gate a request.

      **An EMPTY array allows no page but Mountaya's own**, on the API and for the hosted embed alike: a browser on any other page is refused with a `403`, and no other site can frame the embed. An organization lists every site that uses its keys or shows its embed, and `localhost` with the port of its development server while it builds; a request naming no page, from its own servers, a command line or a native app, keeps working with an empty list. A page that names the `null` origin, a sandboxed frame, a `data:` URL or a `file:` page, is refused, whatever the list holds.

      An entry is `host[:port]`: a host name, `localhost`, an IPv4 address or an IPv6 address in brackets, optionally followed by a port, such as `guides.example.com` or `localhost:3000`. A host name is made of letters, digits, hyphens and underscores in dot-separated labels. Anything else is a `400` naming the entry, a scheme, a path, a query, a wildcard and `null` among them: entries are compared whole, so a wildcard such as `*.example.com` would match nothing, and `null` is the origin every sandboxed frame sends. A host with an underscore and an IPv6 address are allowed on the API but cannot frame the hosted embed, because no browser accepts either in the `frame-ancestors` policy that names the sites allowed to frame a page.

      It holds as many entries as the organization's agreement allows, 1 by default: the `allowed-domains` limit, which an agreement may raise, lower or make unlimited. An entry naming the loopback, `localhost`, a name under `.localhost`, an address in `127.0.0.0/8` or `[::1]`, with or without a port, is not counted toward it: a page on a developer's own machine is no site of the organization's. A write that would leave more counted entries than that limit, and more than the list counts now, is a `429` coded `LIMIT_REACHED` at `allowed-domains`, and nothing is changed. A list counting more than a lowered limit is kept as it is: its entries may be edited or removed, and no counted entry added until it counts fewer than the limit.

      Apart from that limit, the list holds 100 entries at most, loopback ones included, whatever the agreement allows, since it is walked on every publishable-key request and sent whole in the policy that names the sites allowed to frame the hosted embed. More is a `400` naming the list.

      Who sets it depends on how the organization is covered. On a self-serve organization, whose keys serve the Data API, it is its administrators', written with `patchOrganizationSettings`. On an organization covered by an agreement its sites are set by Mountaya, as the agreement states, and a `patchOrganizationSettings` that adds, removes or changes a counted entry is a `403`; its administrators still add and remove its loopback entries themselves, so a developer lists `localhost:5173` without asking Mountaya.
    - `require_session_token` (boolean, required): Whether a publishable-key request that a key alone would otherwise be served must carry a session token, minted by the publisher's backend, in the `X-Session-Token` header, or in the `session_token` query parameter where that form is read: every Tile API and Data API request. When true, a request carrying only the key is refused with a `401`; when false, a valid publishable key plus an allowed page, or no page named at all, is enough. A new organization starts with it off, so an organization with no backend can embed once it lists its sites, which makes the domain allowlist the only visitor gate in that configuration.

      It decides whether a request may be made, not what it reads. A token minted without `user_id`, which is what a backend mints for a visitor nobody signed in, satisfies it and is served exactly what the key alone would be: the published snapshot, public-only listings and tiles cut from published content. Only a token naming a member reads the organization's drafts.

      Required on every write, with no default: a settings write that left it out would otherwise be read as turning enforcement off.

      What it governs is what a key reaches alone. Every `management` and every `studio-embedded` operation requires a session token whatever this says, and the Data API requires one on every request, so on the Map Studio API it governs the `publishing` reads, and on the Tile API every request a key makes. It is NOT limited to the embed or to the Tile API: with it on, the `publishing` reads are refused without a token too, so turning it on for an embed also changes what a server-to-server integration reading with the same key must send.
    - `with_collection_itineraries` (boolean, required): Whether an embed may render the itineraries of a collection. A collection tile request picks the itinerary layer with its `with_itineraries` query parameter, and falls back to `default_props.with_collection_itineraries` without one. When this rule is false, a request made with a publishable key has the layer withheld whatever either of those says, and whatever its `itinerary_id` names: the rule can switch the layer off, never on.
    - `with_collection_zones` (boolean, required): Whether an embed may render the zones of a collection. A collection tile request picks the zone layer with its `with_zones` query parameter, and falls back to `default_props.with_collection_zones` without one. When this rule is false, a request made with a publishable key has the layer withheld whatever either of those says, as with the itinerary layer.
    - `with_overlays` (array of string, required): Slugs of the terrain overlays an embed may request. **An EMPTY array denies every overlay**, which is the deliberate secure default, as `domains` reads an empty list and the opposite of how `boundaries` reads one. An entry `"*"`, anywhere in the list, allows all of them. Any other list is an exact-slug allowlist, and an overlay tile for an unlisted slug is refused to a publishable key and to a share link of the organization alike. Note that `EmbeddedStudioDefaultProps.with_overlays` is a *display* list read by the client with the opposite empty-case meaning (empty there means "offer the whole catalog"); this one is the enforced cap.

      An entry is an overlay slug from `GET /v1/layers`, exactly as it is spelled there, or the wildcard `"*"`. Mountaya sets no other entry, so every slug listed draws that overlay; an overlay later withdrawn from the catalog is denied by its entry rather than erroring.

      It is always set by Mountaya, as the organization's agreement states, on every organization: a `patchOrganizationSettings` that changes it is a `403`, and one that sends it as it stands, in any order, changes nothing. It governs what a publishable key and a share link draw. The organization's own members, in Mountaya's studio, are drawn every overlay while the organization holds Map Studio.
    - `with_overlays_control` (boolean, required): Whether an embed visitor may move an overlay's time cursor. When false, a tile of an overlay whose `capabilities.server.timestamp` is true (the weather and snow overlays) asked for an instant more than 15 minutes from the current one is a `403`, a share-token request included, so the visitor sees the present state only and cannot browse history or forecast. An overlay whose tiles do not change with the instant is drawn whatever instant is sent.

      It takes away the time cursor alone: which overlays a visitor may switch on is `with_overlays`, and a false here neither hides the layers control nor refuses an overlay drawn at the present instant. Granting it grants forecast and history beyond 15 minutes, nothing else.

      It is always set by Mountaya, as the organization's agreement states, on every organization: a `patchOrganizationSettings` that changes it is a `403`, and one that sends it as it stands changes nothing.
    - `with_profile_analysis` (boolean, required): Whether an embed may receive the computed terrain analysis of an itinerary's segments: `surface_info`, `way_type_info` and `trail_difficulty_info`. When false those three are null in the itinerary payload served to embeds: they are removed from the response, not merely hidden by the client. `road_access_info`, `slope_info`, `speed_info` and the durations are always served. Whether a share-token view receives the three does not depend on this rule.
    - `with_profile_elevation` (boolean, required): Whether an embed may show the elevation profile chart. Consumed by the embed surface, which forces the corresponding control off and disables it when this is false, so a publisher cannot re-enable it per embed.
    - `zoom_max` (integer (int32), required): Highest zoom level for which tiles are served. A request above it is refused, which is the anti-scrape ceiling: it bounds how much detail an embed can pull. Enforced on every tile request made with a publishable key, including for tiles scoped to a single authorized resource; a share-token request is not held to it. The client pulls its camera maximum slightly inside this value to leave headroom for pitch and terrain drift. A new organization starts at 18.

      The bounds are the tile surface's own: `z` is `0..22` on every tile operation, so a ceiling outside that range can never refuse anything a structurally valid request could ask for.
    - `zoom_min` (integer (int32), required): Lowest zoom level for which tiles are served. A request below it is refused, which bounds how far out an embed can zoom. Enforced wherever `zoom_max` is. Set it equal to or near `zoom_max` only deliberately: the client has to widen a degenerate range to keep a valid camera, so a very narrow window is honoured at the tile layer but approximated at the camera. A value above `zoom_max` is a 400 naming `zoom_min`: an inverted range would refuse every tile, which reads to a visitor as a map that never loads. A new organization starts at 8.
  - `theme` (object, required): The organization's colors and typography for an embed. Always present: unset fields carry their neutral value rather than being absent, so a renderer reads every one of them unconditionally.
    - `colors` (object, required): The color scale an embed renders with.
      - `ui` (array of string, required): The 10-stop UI color scale, ordered lightest to darkest. Exactly 10 entries: a shorter or longer array is rejected rather than padded.

        Six-digit form only, and case-insensitive: a scale is stored and returned in the case it was written in rather than normalized, so compare these case-insensitively. `segments_color`, which is a color rather than a scale, is the one that is lowercased on the way in.

- `updated_at` (string (date-time), required): Timestamp of the organization's last change. Always present: it equals `created_at` until the organization is first changed.

- `white_label` (boolean, required): Whether the organization may suppress the Mountaya mark on its embedded maps and exported video, which its agreement decides. It is the one entitlement this contract returns on the organization, so an embed decides whether to paint the mark from the read it already makes. When it cannot be read at that moment it reads `false`, which paints the mark.

  It never suppresses tile attribution. MapTiler, OpenStreetMap and meteoblue credits are a licence obligation and stay on every map, whatever the organization holds.

### An example Organization

```json
{
  "id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  "name": "Compagnie des Guides",
  "etag": "\"d7\"",
  "white_label": false,
  "awaiting_agreement": false,
  "created_at": "2026-01-14T09:20:11Z",
  "updated_at": "2026-08-01T02:14:07Z",
  "settings": {
    "etag": "\"d3\"",
    "default_props": {
      "preferred_language": "en",
      "preferred_theme": "light",
      "preferred_unit_length": "metric",
      "preferred_unit_pace": "per-time",
      "preferred_unit_slope": "degrees",
      "preferred_unit_temperature": "celsius",
      "segments_color": "",
      "terrain": "topo",
      "terrain_variant": "light",
      "with_access_restrictions": true,
      "with_collection_itineraries": true,
      "with_collection_zones": true,
      "with_directions_control": false,
      "with_download_control": false,
      "with_navigation_control": true,
      "with_overlays": [],
      "with_overlays_control": false,
      "with_preferences_control": true,
      "with_profile_analysis": true,
      "with_profile_characteristics": true,
      "with_profile_elevation": true,
      "with_profile_pace_control": true,
      "with_streetview_control": false,
      "with_terrains": []
    },
    "safety_rules": {
      "boundaries": [
        {
          "name": "Massif du Mont-Blanc",
          "bbox": [
            6.6,
            45.75,
            7.1,
            46
          ]
        }
      ],
      "domains": [
        "guides.example.com"
      ],
      "require_session_token": true,
      "with_collection_itineraries": true,
      "with_collection_zones": true,
      "with_overlays": [],
      "with_overlays_control": false,
      "with_profile_analysis": true,
      "with_profile_elevation": true,
      "zoom_max": 18,
      "zoom_min": 8
    },
    "theme": {
      "colors": {
        "ui": [
          "#ecefff",
          "#d5dafb",
          "#a9b1f1",
          "#7a87e9",
          "#5362e1",
          "#3a4bdd",
          "#2c40dc",
          "#1f32c4",
          "#182cb0",
          "#0a259c"
        ]
      }
    }
  }
}
```

## The OrganizationSettings object

The settings that shape an organization's embeds, its Map Publishing settings, in three independent groups: the default props an embed starts from, the safety rules constraining what an embed may do, and the map theme. Each group is replaced whole rather than merged, so a partial update carries the complete group it changes.

- `etag` (string, required): The version of the settings, the one the `ETag` of a read of them carries, opaque and compared whole. Send it as `If-Match` to make `patchOrganizationSettings` conditional. The settings are versioned apart from the organization's own fields, so a settings edit never refuses a rename made at the same moment, nor the other way round.

- `default_props` (object, required): What an embed starts with when it names nothing itself: language, units, theme and the rest. An embed may override any of these per instance.
  - `preferred_language` (string, required, one of: `en`, `fr`, `es`, `it`, `de`, `zh`, `ja`): Language an embed's interface and place names start in.
  - `preferred_theme` (string, required, one of: `auto`, `light`, `dark`): Color theme an embed starts in. `auto` follows the visitor's operating-system preference.
  - `preferred_unit_length` (string, required, one of: `metric`, `imperial`): Unit distances and elevations are displayed in.
  - `preferred_unit_pace` (string, required, one of: `per-time`, `per-distance`): Form travel rates are expressed in. `per-time` renders a speed (km/h with metric, mph with imperial); `per-distance` renders a pace, the reciprocal (min/km with metric, min/mi with imperial). The unit *system* still comes from `preferred_unit_length`; this chooses only the form.
  - `preferred_unit_slope` (string, required, one of: `degrees`, `percentage`): Unit gradients are displayed in, on both the elevation profile and the segment readouts.
  - `preferred_unit_temperature` (string, required, one of: `celsius`, `fahrenheit`): Unit temperatures are displayed in.
  - `segments_color` (string, required): Single color every itinerary segment is painted in on an embed, on both the map lines and the elevation profile bands. An empty string means each segment keeps its own color. Applies to an embed only, never to a shared itinerary view.

    A hex code with a leading hash, in three-digit or six-digit form; a three-digit value is stored expanded to six digits and lowercased, so `#F00` is accepted and read back as `#ff0000`. The empty string is the only other accepted value. Anything else is a 400.
  - `terrain` (string, required): Slug of the terrain an embed loads first, drawn from the terrain catalog the tiles API's layers manifest publishes. Only the initial selection: a visitor may switch to any terrain `with_terrains` permits. A slug absent from the manifest leaves the map on the Mountaya default terrain.
  - `terrain_variant` (string, required, one of: `light`, `dark`): Visual style the terrain starts in, for terrains that publish both a light and a dark rendering.
  - `with_access_restrictions` (boolean, required): Whether the stretches of an itinerary's route whose access is restricted are drawn, as stripes and a warning icon per kind, read from the `itinerary_restrictions` layer of the itinerary tiles. No safety rule governs it.
  - `with_collection_itineraries` (boolean, required): Whether a collection embed draws the itineraries the collection contains. It is the default a collection tile request without `with_itineraries` falls back to. Capped by `safety_rules.with_collection_itineraries`, which withholds the layer server-side when false.
  - `with_collection_zones` (boolean, required): Whether a collection embed draws the zones the collection contains, which are its published public zones, each as last published, since the embed reads as the public does. It is the default a collection tile request without `with_zones` falls back to. Capped by `safety_rules.with_collection_zones`, which withholds the layer server-side when false.
  - `with_directions_control` (boolean, required): Whether the directions control is offered, opening the turn-by-turn directions of the itinerary's routed segments as they were stored, to read, print or download as a PDF. It computes no route: a visitor never routes between points of their own. No safety rule governs it.
  - `with_download_control` (boolean, required): Whether the export control is offered, letting a visitor download an itinerary in any of the export formats (GPX, FIT, TCX, GeoJSON, KML, KMZ and CSV). No safety rule governs it.
  - `with_navigation_control` (boolean, required): Whether the map navigation controls, the zoom and compass buttons, are shown. An embed never offers geolocation, whatever this says, because it never asks a visitor for their location. No safety rule governs it; the zoom range a visitor can actually reach is set by `safety_rules.zoom_min` and `safety_rules.zoom_max`.
  - `with_overlays` (array of string, required): Slugs of the terrain overlays offered in the overlay picker. **An empty array, or one holding the entry `"*"` anywhere, offers the whole catalog**; any other list narrows the picker to those slugs and drops a category left with nothing to show. Note that this is a display list only and its empty case reads the OPPOSITE way from `safety_rules.with_overlays`, where an empty array denies every overlay. An overlay offered here but absent from the safety rule renders no tiles.
  - `with_overlays_control` (boolean, required): Whether the overlay time cursor is offered, letting a visitor move an overlay backwards or forwards in time. Capped by `safety_rules.with_overlays_control`, which, when false, refuses a tile asked for more than 15 minutes from the current instant on every overlay the server draws per instant.

    It governs the time cursor alone. It neither offers nor hides the layers control: which overlays a visitor may switch on and off is `with_overlays`, capped by `safety_rules.with_overlays`, and which terrains the switcher offers is `with_terrains`, so an embed whose overlays are drawn only at the present instant still offers every overlay its cap admits.
  - `with_preferences_control` (boolean, required): Whether the preferences control is offered, letting a visitor change the units (distance, travel rate, slope and temperature) and the interface language for their visit. The theme is not among them: an embed keeps the publisher's `preferred_theme`. No safety rule governs it; it never persists anything to the organization.
  - `with_profile_analysis` (boolean, required): Whether the profile's computed terrain analysis is shown: the surface and way-type bars under the elevation chart, and the surface, way type, trail difficulty, slope and aspect readings of its hover readout. Capped by `safety_rules.with_profile_analysis`, which strips the analysis from the payload server-side when false, so turning this on against a false rule shows nothing.

    Read AGAINST `with_profile_elevation`: on a pointer device the bars are revealed by hovering the elevation curve and are aligned to its distance axis, so the analysis shows nothing while the chart is off.
  - `with_profile_characteristics` (boolean, required): Whether the itinerary's summary characteristics (distance, ascent, descent, duration) are shown alongside the profile. No safety rule governs it.
  - `with_profile_elevation` (boolean, required): Whether the elevation profile chart is shown. Capped by `safety_rules.with_profile_elevation`, which forces the control off and disables it when false.
  - `with_profile_pace_control` (boolean, required): Whether the pace control is offered on the elevation profile, letting a visitor enter their own travel rate and read the itinerary re-timed for it. Resolution runs URL query parameter, then this object, then the Mountaya default, like the rest of this object. The override is session-local and persists nothing: the itinerary's committed speeds are untouched, every other visitor reads the author's figures, and clearing the field restores them. No safety rule governs it; the re-time reveals nothing a visitor cannot already read.

    Requires BOTH `with_profile_elevation` and `with_profile_characteristics`, for two different reasons. The chart, because the rate is read against the curve it re-times. The characteristics row, because that row is WHERE the field renders, beside the segment chooser. With either of them off the field is withheld however the embed is configured.
  - `with_streetview_control` (boolean, required): Whether the street-level imagery control is offered. No safety rule governs it.
  - `with_terrains` (array of string, required): Slugs of the terrains offered in the terrain switcher. **An empty array, or one holding the entry `"*"` anywhere, offers every terrain in the manifest**; any other list narrows the switcher to those slugs. This is the one allowlist with no safety rule behind it. Enforcement is client-side only, which is why it sits here rather than on `EmbeddedStudioSafetyRules`: terrain tiles carry no organization-private data, so restricting the switcher is a presentation choice, not a security boundary. Treat it accordingly.

- `safety_rules` (object, required): The ceilings an embed cannot raise, whatever it asks for. Unlike `default_props`, these are enforced rather than defaulted: an embed that requests a zoom outside the allowed window is refused, not clamped silently by the client.
  - `boundaries` (array of Boundaries, required): Named geographic regions outside which tiles are refused. A tile request made with a publishable key whose coordinates fall in none of them is rejected with a validation error, which caps how far an embed can pan. **An EMPTY array means no geographic restriction**, so every tile is in range. That makes this list opt-in, unlike `with_overlays`. The zoom range applies either way. Tiles scoped to a single already-authorized resource skip the boundary check (refusing them would hide nothing the caller cannot already read) but still honour the zoom range.
    - `bbox` (array of number (double), required): Bounding box as [minLongitude, minLatitude, maxLongitude, maxLatitude] in WGS 84 decimal degrees. This is the flat four-tuple every bounding box on every Mountaya surface uses, so a client reads one shape everywhere. Exactly four numbers, longitude first in each pair; the minimum corner comes first.

      The bound is WGS 84's own: a coordinate outside it names no point on Earth, and this box is evaluated on every tile request that carries one, so a nonsensical value is not merely inert. `items` holds the widest of the two ranges because a tuple's positions cannot be typed apart in JSON Schema; the per-position latitude range is enforced where the box is written.
    - `name` (string, required): Display name of the bounded region. Bounded in length because it is stored per organization and echoed back on every settings read.
  - `domains` (array of string, required): The pages allowed to call the API from a browser with the organization's publishable keys, and the sites allowed to frame Mountaya's hosted embed. A request is compared by its `Origin`, falling back to `Referer`, after normalization, which ignores letter case and a leading `www.`. Mountaya's own pages are always allowed, whatever the list holds: its web application, and for the API alone its documentation, whose explorer runs the queries a reader sends with their own key. The list is checked against the page a browser names, and only then: a request naming no page, as a server sends, or as a page sends under a `no-referrer` policy that strips `Referer` from a request that carries no `Origin`, such as an image or a map tile, is not checked against it at all. It is therefore not an access control on the key: it decides which pages may use the key from a browser that names them, while the publishable key and, when required, the session token are what gate a request.

    **An EMPTY array allows no page but Mountaya's own**, on the API and for the hosted embed alike: a browser on any other page is refused with a `403`, and no other site can frame the embed. An organization lists every site that uses its keys or shows its embed, and `localhost` with the port of its development server while it builds; a request naming no page, from its own servers, a command line or a native app, keeps working with an empty list. A page that names the `null` origin, a sandboxed frame, a `data:` URL or a `file:` page, is refused, whatever the list holds.

    An entry is `host[:port]`: a host name, `localhost`, an IPv4 address or an IPv6 address in brackets, optionally followed by a port, such as `guides.example.com` or `localhost:3000`. A host name is made of letters, digits, hyphens and underscores in dot-separated labels. Anything else is a `400` naming the entry, a scheme, a path, a query, a wildcard and `null` among them: entries are compared whole, so a wildcard such as `*.example.com` would match nothing, and `null` is the origin every sandboxed frame sends. A host with an underscore and an IPv6 address are allowed on the API but cannot frame the hosted embed, because no browser accepts either in the `frame-ancestors` policy that names the sites allowed to frame a page.

    It holds as many entries as the organization's agreement allows, 1 by default: the `allowed-domains` limit, which an agreement may raise, lower or make unlimited. An entry naming the loopback, `localhost`, a name under `.localhost`, an address in `127.0.0.0/8` or `[::1]`, with or without a port, is not counted toward it: a page on a developer's own machine is no site of the organization's. A write that would leave more counted entries than that limit, and more than the list counts now, is a `429` coded `LIMIT_REACHED` at `allowed-domains`, and nothing is changed. A list counting more than a lowered limit is kept as it is: its entries may be edited or removed, and no counted entry added until it counts fewer than the limit.

    Apart from that limit, the list holds 100 entries at most, loopback ones included, whatever the agreement allows, since it is walked on every publishable-key request and sent whole in the policy that names the sites allowed to frame the hosted embed. More is a `400` naming the list.

    Who sets it depends on how the organization is covered. On a self-serve organization, whose keys serve the Data API, it is its administrators', written with `patchOrganizationSettings`. On an organization covered by an agreement its sites are set by Mountaya, as the agreement states, and a `patchOrganizationSettings` that adds, removes or changes a counted entry is a `403`; its administrators still add and remove its loopback entries themselves, so a developer lists `localhost:5173` without asking Mountaya.
  - `require_session_token` (boolean, required): Whether a publishable-key request that a key alone would otherwise be served must carry a session token, minted by the publisher's backend, in the `X-Session-Token` header, or in the `session_token` query parameter where that form is read: every Tile API and Data API request. When true, a request carrying only the key is refused with a `401`; when false, a valid publishable key plus an allowed page, or no page named at all, is enough. A new organization starts with it off, so an organization with no backend can embed once it lists its sites, which makes the domain allowlist the only visitor gate in that configuration.

    It decides whether a request may be made, not what it reads. A token minted without `user_id`, which is what a backend mints for a visitor nobody signed in, satisfies it and is served exactly what the key alone would be: the published snapshot, public-only listings and tiles cut from published content. Only a token naming a member reads the organization's drafts.

    Required on every write, with no default: a settings write that left it out would otherwise be read as turning enforcement off.

    What it governs is what a key reaches alone. Every `management` and every `studio-embedded` operation requires a session token whatever this says, and the Data API requires one on every request, so on the Map Studio API it governs the `publishing` reads, and on the Tile API every request a key makes. It is NOT limited to the embed or to the Tile API: with it on, the `publishing` reads are refused without a token too, so turning it on for an embed also changes what a server-to-server integration reading with the same key must send.
  - `with_collection_itineraries` (boolean, required): Whether an embed may render the itineraries of a collection. A collection tile request picks the itinerary layer with its `with_itineraries` query parameter, and falls back to `default_props.with_collection_itineraries` without one. When this rule is false, a request made with a publishable key has the layer withheld whatever either of those says, and whatever its `itinerary_id` names: the rule can switch the layer off, never on.
  - `with_collection_zones` (boolean, required): Whether an embed may render the zones of a collection. A collection tile request picks the zone layer with its `with_zones` query parameter, and falls back to `default_props.with_collection_zones` without one. When this rule is false, a request made with a publishable key has the layer withheld whatever either of those says, as with the itinerary layer.
  - `with_overlays` (array of string, required): Slugs of the terrain overlays an embed may request. **An EMPTY array denies every overlay**, which is the deliberate secure default, as `domains` reads an empty list and the opposite of how `boundaries` reads one. An entry `"*"`, anywhere in the list, allows all of them. Any other list is an exact-slug allowlist, and an overlay tile for an unlisted slug is refused to a publishable key and to a share link of the organization alike. Note that `EmbeddedStudioDefaultProps.with_overlays` is a *display* list read by the client with the opposite empty-case meaning (empty there means "offer the whole catalog"); this one is the enforced cap.

    An entry is an overlay slug from `GET /v1/layers`, exactly as it is spelled there, or the wildcard `"*"`. Mountaya sets no other entry, so every slug listed draws that overlay; an overlay later withdrawn from the catalog is denied by its entry rather than erroring.

    It is always set by Mountaya, as the organization's agreement states, on every organization: a `patchOrganizationSettings` that changes it is a `403`, and one that sends it as it stands, in any order, changes nothing. It governs what a publishable key and a share link draw. The organization's own members, in Mountaya's studio, are drawn every overlay while the organization holds Map Studio.
  - `with_overlays_control` (boolean, required): Whether an embed visitor may move an overlay's time cursor. When false, a tile of an overlay whose `capabilities.server.timestamp` is true (the weather and snow overlays) asked for an instant more than 15 minutes from the current one is a `403`, a share-token request included, so the visitor sees the present state only and cannot browse history or forecast. An overlay whose tiles do not change with the instant is drawn whatever instant is sent.

    It takes away the time cursor alone: which overlays a visitor may switch on is `with_overlays`, and a false here neither hides the layers control nor refuses an overlay drawn at the present instant. Granting it grants forecast and history beyond 15 minutes, nothing else.

    It is always set by Mountaya, as the organization's agreement states, on every organization: a `patchOrganizationSettings` that changes it is a `403`, and one that sends it as it stands changes nothing.
  - `with_profile_analysis` (boolean, required): Whether an embed may receive the computed terrain analysis of an itinerary's segments: `surface_info`, `way_type_info` and `trail_difficulty_info`. When false those three are null in the itinerary payload served to embeds: they are removed from the response, not merely hidden by the client. `road_access_info`, `slope_info`, `speed_info` and the durations are always served. Whether a share-token view receives the three does not depend on this rule.
  - `with_profile_elevation` (boolean, required): Whether an embed may show the elevation profile chart. Consumed by the embed surface, which forces the corresponding control off and disables it when this is false, so a publisher cannot re-enable it per embed.
  - `zoom_max` (integer (int32), required): Highest zoom level for which tiles are served. A request above it is refused, which is the anti-scrape ceiling: it bounds how much detail an embed can pull. Enforced on every tile request made with a publishable key, including for tiles scoped to a single authorized resource; a share-token request is not held to it. The client pulls its camera maximum slightly inside this value to leave headroom for pitch and terrain drift. A new organization starts at 18.

    The bounds are the tile surface's own: `z` is `0..22` on every tile operation, so a ceiling outside that range can never refuse anything a structurally valid request could ask for.
  - `zoom_min` (integer (int32), required): Lowest zoom level for which tiles are served. A request below it is refused, which bounds how far out an embed can zoom. Enforced wherever `zoom_max` is. Set it equal to or near `zoom_max` only deliberately: the client has to widen a degenerate range to keep a valid camera, so a very narrow window is honoured at the tile layer but approximated at the camera. A value above `zoom_max` is a 400 naming `zoom_min`: an inverted range would refuse every tile, which reads to a visitor as a map that never loads. A new organization starts at 8.

- `theme` (object, required): The organization's colors and typography for an embed. Always present: unset fields carry their neutral value rather than being absent, so a renderer reads every one of them unconditionally.
  - `colors` (object, required): The color scale an embed renders with.
    - `ui` (array of string, required): The 10-stop UI color scale, ordered lightest to darkest. Exactly 10 entries: a shorter or longer array is rejected rather than padded.

      Six-digit form only, and case-insensitive: a scale is stored and returned in the case it was written in rather than normalized, so compare these case-insensitively. `segments_color`, which is a color rather than a scale, is the one that is lowercased on the way in.

### An example OrganizationSettings

```json
{
  "etag": "\"d3\"",
  "default_props": {
    "preferred_language": "en",
    "preferred_theme": "light",
    "preferred_unit_length": "metric",
    "preferred_unit_pace": "per-time",
    "preferred_unit_slope": "degrees",
    "preferred_unit_temperature": "celsius",
    "segments_color": "",
    "terrain": "topo",
    "terrain_variant": "light",
    "with_access_restrictions": true,
    "with_collection_itineraries": true,
    "with_collection_zones": true,
    "with_directions_control": false,
    "with_download_control": false,
    "with_navigation_control": true,
    "with_overlays": [],
    "with_overlays_control": false,
    "with_preferences_control": true,
    "with_profile_analysis": true,
    "with_profile_characteristics": true,
    "with_profile_elevation": true,
    "with_profile_pace_control": true,
    "with_streetview_control": false,
    "with_terrains": []
  },
  "safety_rules": {
    "boundaries": [
      {
        "name": "Massif du Mont-Blanc",
        "bbox": [
          6.6,
          45.75,
          7.1,
          46
        ]
      }
    ],
    "domains": [
      "guides.example.com"
    ],
    "require_session_token": true,
    "with_collection_itineraries": true,
    "with_collection_zones": true,
    "with_overlays": [],
    "with_overlays_control": false,
    "with_profile_analysis": true,
    "with_profile_elevation": true,
    "zoom_max": 18,
    "zoom_min": 8
  },
  "theme": {
    "colors": {
      "ui": [
        "#ecefff",
        "#d5dafb",
        "#a9b1f1",
        "#7a87e9",
        "#5362e1",
        "#3a4bdd",
        "#2c40dc",
        "#1f32c4",
        "#182cb0",
        "#0a259c"
      ]
    }
  }
}
```

## Create an organization

### POST /v1/organizations

- Operation: `postOrganization`
- 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

Creates an organization and makes the user the session token names its owner.

- The new organization is not reachable with the key that created it. A publishable key acts on its own organization only, so every operation naming the new one is a `403` under that key, and no operation in this contract issues a key into another organization. Its subscription, keys and settings are managed with a key issued in it.
- It starts with no subscription and holds no product, so every operation that needs one answers `402` until it does. There are two ways in. Self-serve, its first card opens the metered Data API subscription, through `postOrganizationBillingProvision`, `postOrganizationBillingPaymentMethodSetup` and `postOrganizationBillingPaymentMethod` in that order, and from then it holds `data` for as long as that subscription is in force. Under an agreement with Mountaya, which `agreement_requested` asks for, it holds exactly the products the agreement names once it is set: Map Studio, Map Publishing, the Tile API, Embedded Studio and White label are only ever granted this way. Until then `awaiting_agreement` reads true and the organization is not asked for a card.
- Creating it also opens its billing account, whichever of the two ways it takes, normally within seconds of the answer and otherwise by the next weekly check at the latest: nothing is charged and no subscription is opened. Until the account is open, the billing operations that need one answer as they do for an organization without one, and `postOrganizationBillingProvision` opens it at once.
- The optional `website` seeds the embed domain allowlist from its host, so a new organization's keys work from its own site from the start. Omit it and the allowlist starts empty: no page but Mountaya's own can call the API with the organization's keys from a browser, and no site but Mountaya's own can frame its hosted embed, until it is set: by `patchOrganizationSettings` on a self-serve organization, and by Mountaya, as the agreement states, once an agreement covers it. Calls from the organization's own servers, which name no page, work either way.
- A name of more than 30 characters as sent, or of fewer than 2 once leading and trailing whitespace is trimmed, is a 400.
- Send an `Idempotency-Key`: a create sent again without one makes a second organization. A create sent again with it, after the first failed with a `5xx` once the organization was made, is the `409` coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`, whose `extensions.metadata.location` names the organization made, `/v1/organizations/{organization_id}`, so carry on with that one rather than creating it again.
- Each user creates at most 10 organizations a minute and 50 a day. Past either, the request is a `429` carrying `Retry-After`, and nothing is created.

Requires a publishable key with the `management` scope AND a session token naming a user, a member with a write 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.created`](https://docs.mountaya.com/en/webhooks/events/organization.md#organization-created), [`organization.member.created`](https://docs.mountaya.com/en/webhooks/events/organization-member.md#organization-member-created), recorded by the task `organization.create`.

**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 organization's name, optionally the website whose host seeds its embed domain allowlist, and whether it is meant to be covered by an agreement.

- `name` (string, in body, required): Display name of the organization: 2 to 30 characters as sent, and still at least 2 once leading and trailing whitespace is trimmed, which is the form it is stored in. A name is one line: a tab, a line break or a line separator between two of its characters is a `400`, and one at either end is trimmed with the whitespace there.

- `website` (string (uri), in body, optional): The organization's website as a full URL, scheme included. Its host seeds the embed domain allowlist, which is why the scheme is required rather than merely conventional: a bare host, or a scheme that is not http or https, would land in the allowlist and silently deny every embed. An empty string is accepted and seeds nothing. A host longer than the 253 characters a domain name may run to is a `400` at `website`, the limit every entry of the allowlist is held to.

  Set once, at creation. `patchOrganization` takes the name alone, so there is no operation in this contract that changes the website afterwards.

  The ceiling is the conventional URL one rather than the 500 a waypoint's link carries. A waypoint link is one of many on a place a person authored; this is one address per organization.

- `agreement_requested` (boolean, in body, optional): Whether the organization is meant to be covered by an agreement with Mountaya rather than by a card. True records that choice, which `awaiting_agreement` on the organization then reports until an agreement is set, and the organization holds no product until that agreement grants the ones it names. It grants nothing itself and opens nothing. Omitted or false, the organization is self-serve: it holds no product until its first card opens the metered Data API subscription.

**Response** `201`

The organization as created, with the user the session token names as its owner, no subscription and no product yet. `Location` names it, `/v1/organizations/{organization_id}`, and `ETag` carries its `etag`.

- `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` (Organization, required): An organization: the workspace itineraries, zones and collections belong to, together with the settings that shape its embeds. What the organization's agreement entitles it to is not part of it: the products a person's organizations hold are read as `organization_capabilities` on `getMyOrganizations`, and the one entitlement an embed paints by is `white_label`, which every read carries.

  See [the Organization object](https://docs.mountaya.com/en/apis/map-studio/reference/organizations.md#organization-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}`.
- `ETag`: The version of the resource this answer returns, an opaque strong tag in double quotes, equal to that resource's `etag` field. Send it back as `If-Match` to make a write conditional on nobody having changed the resource since. It changes whenever what this read returns changes; compare it whole and never parse it. Present on every answer that returns the resource, and on the `412` that refuses a stale `If-Match`.
- `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`, `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 user the session token names is not a member of the key's organization, or holds a role there that reads only. 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.
- `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 POST https://api.mountaya.com/v1/organizations \
  -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 '{"name": "Compagnie des Guides", "website": "https://guides.example.com"}'
```

**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.organizations.postOrganization({
  body: {
    name: "Compagnie des Guides",
    website: "https://guides.example.com",
  },
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.post(
    "https://api.mountaya.com/v1/organizations",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "name": "Compagnie des Guides",
        "website": "https://guides.example.com",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 201:

```json
{
  "data": {
    "id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "name": "Compagnie des Guides",
    "etag": "\"d7\"",
    "white_label": false,
    "awaiting_agreement": false,
    "created_at": "2026-01-14T09:20:11Z",
    "updated_at": "2026-08-01T02:14:07Z",
    "settings": {
      "etag": "\"d3\"",
      "default_props": {
        "preferred_language": "en",
        "preferred_theme": "light",
        "preferred_unit_length": "metric",
        "preferred_unit_pace": "per-time",
        "preferred_unit_slope": "degrees",
        "preferred_unit_temperature": "celsius",
        "segments_color": "",
        "terrain": "topo",
        "terrain_variant": "light",
        "with_access_restrictions": true,
        "with_collection_itineraries": true,
        "with_collection_zones": true,
        "with_directions_control": false,
        "with_download_control": false,
        "with_navigation_control": true,
        "with_overlays": [],
        "with_overlays_control": false,
        "with_preferences_control": true,
        "with_profile_analysis": true,
        "with_profile_characteristics": true,
        "with_profile_elevation": true,
        "with_profile_pace_control": true,
        "with_streetview_control": false,
        "with_terrains": []
      },
      "safety_rules": {
        "boundaries": [
          {
            "name": "Massif du Mont-Blanc",
            "bbox": [
              6.6,
              45.75,
              7.1,
              46
            ]
          }
        ],
        "domains": [
          "guides.example.com"
        ],
        "require_session_token": true,
        "with_collection_itineraries": true,
        "with_collection_zones": true,
        "with_overlays": [],
        "with_overlays_control": false,
        "with_profile_analysis": true,
        "with_profile_elevation": true,
        "zoom_max": 18,
        "zoom_min": 8
      },
      "theme": {
        "colors": {
          "ui": [
            "#ecefff",
            "#d5dafb",
            "#a9b1f1",
            "#7a87e9",
            "#5362e1",
            "#3a4bdd",
            "#2c40dc",
            "#1f32c4",
            "#182cb0",
            "#0a259c"
          ]
        }
      }
    }
  }
}
```

## Resolve the organization a publishable key belongs to

### POST /v1/organizations/lookup

- Operation: `postOrganizationLookup`
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Takes a publishable key and returns the organization it was minted for. It is the bootstrap read an embed host makes before it knows anything: given only the key it was configured with, it needs the branding, the theme and the `safety_rules` its host page will be checked against, and it has no organization id to ask `getOrganization` with.

It is the one operation here that takes NO credential. The key travels in the body as the subject of the question rather than in `X-API-Key` as the answer to one, which is why sending it as a header does nothing. The answer is the organization exactly as `getOrganization` serves it: its identity, its settings and `white_label`, which is everything an embed paints by and nothing about the account behind it. Neither blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first) applies here.

UNKNOWN, REVOKED and UNDER-SCOPED keys, and every key of a canceled organization, all answer `404` with the same body. What an embed needs is the `publishing` scope, or the `studio-embedded` scope that includes it, and no other scope is asked for. A key that exists but carries neither is refused exactly as one that never existed, so this cannot be used to sort real keys from invented ones, and there is deliberately no `403` for the same reason: a refusal that said "this key is real but not for you" would be the oracle the single answer exists to close.

Whether the organization holds Map Publishing is not asked here: an organization whose agreement does not include it is answered `200` all the same, and the reads its embed then makes, `getOrganization` among them, answer the plain `402` `PAYMENT_REQUIRED` while it does not. So a `200` says the key can open an embed, not that the embed will draw.

It is limited to 60 requests a minute per client IP address rather than per organization, since there is no organization until it answers, an IPv6 address counted by its `/64` prefix. Every request counts, a `404` included, and one past the limit is a `429` carrying `Retry-After`, the seconds left in the minute. The limit is best effort.

Takes no credential.

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 publishable key to resolve.

- `publishable_key` (string, in body, required): The publishable key to resolve. It is sent in the BODY rather than in the `X-API-Key` header, and that is the whole shape of this operation: the key is the subject of the question, not the credential answering it.

  A key that does not exist, one that has been revoked, one that carries neither the `publishing` scope nor the `studio-embedded` scope that includes it, and one whose organization has been canceled all answer 404 alike, so this cannot be used to sort real keys from invented ones.

**Response** `200`

The organization the key belongs to, as `getOrganization` serves it, with its settings and `white_label`.

- `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` (Organization, required): An organization: the workspace itineraries, zones and collections belong to, together with the settings that shape its embeds. What the organization's agreement entitles it to is not part of it: the products a person's organizations hold are read as `organization_capabilities` on `getMyOrganizations`, and the one entitlement an embed paints by is `white_label`, which every read carries.

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

Response headers:

- `ETag`: The version of the resource this answer returns, an opaque strong tag in double quotes, equal to that resource's `etag` field. Send it back as `If-Match` to make a write conditional on nobody having changed the resource since. It changes whenever what this read returns changes; compare it whole and never parse it. Present on every answer that returns the resource, and on the `412` that refuses a stale `If-Match`.

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

- `400`: Bad Request
- `404`: No organization is reachable from that key. It does not exist, or it is revoked, or it carries neither the `publishing` scope nor the `studio-embedded` scope that includes it, or its organization is canceled. These answer alike and always will, so a caller can learn that this key will not embed a map and nothing further.
- `413`: Payload Too Large
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# The key goes in the BODY. Sending it as X-API-Key does nothing here.
curl -s -X POST https://api.mountaya.com/v1/organizations/lookup \
  -H "Content-Type: application/json" \
  -d '{"publishable_key": "pk_9f3c2a71b845d0e4c7a6b3f180d92e5a"}' | jq '.data'
```

**TypeScript**

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

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

const { data } = await mountaya.studio.organizations.postOrganizationLookup({
  body: { publishable_key: "pk_9f3c2a71b845d0e4c7a6b3f180d92e5a" },
});

console.log(data);
```

**Python**

```python
import requests

response = requests.post(
    "https://api.mountaya.com/v1/organizations/lookup",
    json={"publishable_key": "pk_9f3c2a71b845d0e4c7a6b3f180d92e5a"},
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "name": "Compagnie des Guides",
    "etag": "\"d7\"",
    "white_label": false,
    "awaiting_agreement": false,
    "created_at": "2026-01-14T09:20:11Z",
    "updated_at": "2026-08-01T02:14:07Z",
    "settings": {
      "etag": "\"d3\"",
      "default_props": {
        "preferred_language": "en",
        "preferred_theme": "light",
        "preferred_unit_length": "metric",
        "preferred_unit_pace": "per-time",
        "preferred_unit_slope": "degrees",
        "preferred_unit_temperature": "celsius",
        "segments_color": "",
        "terrain": "topo",
        "terrain_variant": "light",
        "with_access_restrictions": true,
        "with_collection_itineraries": true,
        "with_collection_zones": true,
        "with_directions_control": false,
        "with_download_control": false,
        "with_navigation_control": true,
        "with_overlays": [],
        "with_overlays_control": false,
        "with_preferences_control": true,
        "with_profile_analysis": true,
        "with_profile_characteristics": true,
        "with_profile_elevation": true,
        "with_profile_pace_control": true,
        "with_streetview_control": false,
        "with_terrains": []
      },
      "safety_rules": {
        "boundaries": [
          {
            "name": "Massif du Mont-Blanc",
            "bbox": [
              6.6,
              45.75,
              7.1,
              46
            ]
          }
        ],
        "domains": [
          "guides.example.com"
        ],
        "require_session_token": true,
        "with_collection_itineraries": true,
        "with_collection_zones": true,
        "with_overlays": [],
        "with_overlays_control": false,
        "with_profile_analysis": true,
        "with_profile_elevation": true,
        "zoom_max": 18,
        "zoom_min": 8
      },
      "theme": {
        "colors": {
          "ui": [
            "#ecefff",
            "#d5dafb",
            "#a9b1f1",
            "#7a87e9",
            "#5362e1",
            "#3a4bdd",
            "#2c40dc",
            "#1f32c4",
            "#182cb0",
            "#0a259c"
          ]
        }
      }
    }
  }
}
```

## Retrieve an organization

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

- Operation: `getOrganization`
- Requires: scope `publishing`
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Returns the organization: its name, whether it awaits its agreement, whether it may leave the Mountaya mark off its maps (`white_label`), and the Map Publishing settings that shape what an embed of it looks like.

Every credential is served the same object. Nothing is trimmed for a publishable key or a share token: the settings an embed needs to paint itself, `safety_rules.domains` among them, are what this bootstrap read exists to serve. What the organization's agreement entitles it to is read elsewhere: the products it holds as `organization_capabilities` on `getMyOrganizations`, and its subscription with `getOrganizationBillingSubscription`.

The path names the key's own organization: a key reaches its own organization and no other, and naming another is a `403` whether or not it exists. A share token reaches the organization that owns what its link names, because a share view is an embed: it paints the same layers, reads the same branding and needs the same settings to do it. Naming any other organization under a share token is the same `403`.

An embed that does not know which organization it belongs to resolves one from its own key with `postOrganizationLookup`, which takes the key itself rather than an id.

Reads are limited per minute. A publishable key sent without a session token, or with one minted without `user_id`, is held to 600 per client IP address and then 6000 per organization; a key with a session token naming a user to 1200 per user the token names and then 6000 per organization, counted apart from the reads made under the key alone; and a share token to 600 per client IP address and then 6000 per organization that owns the link. Past any of them the read is a `429` carrying `Retry-After`. A share token not resolved moments earlier is refused the same way when its client IP address has had 60 unknown share tokens refused within the minute.

A publishable key needs the `publishing` scope, or the `studio-embedded` scope that includes it. A share token carries its own authority and needs none.

**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 organization, with its settings and `white_label`, and its current `etag` in `ETag`.

- `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` (Organization, required): An organization: the workspace itineraries, zones and collections belong to, together with the settings that shape its embeds. What the organization's agreement entitles it to is not part of it: the products a person's organizations hold are read as `organization_capabilities` on `getMyOrganizations`, and the one entitlement an embed paints by is `white_label`, which every read carries.

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

Response headers:

- `ETag`: The version of the resource this answer returns, an opaque strong tag in double quotes, equal to that resource's `etag` field. Send it back as `If-Match` to make a write conditional on nobody having changed the resource since. It changes whenever what this read returns changes; compare it whole and never parse it. Present on every answer that returns the resource, and on the `412` that refuses a stale `If-Match`.

**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 Map Publishing, the product the `publishing` scope belongs to. Map Publishing is granted by the organization's agreement with Mountaya, so this is answered to an organization whose agreement does not include it, and it clears when the 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`. A share-token request is never refused this way. Under a key carrying `studio-embedded`, the organization is refused for Map Publishing only when it holds neither Map Publishing nor Embedded Studio with Map Studio, so an organization that edits in an Embedded Studio reads its work back without Map Publishing.
- `403`: The credential is valid and this operation is not open to it: the key carries neither the `publishing` scope nor the `studio-embedded` scope that includes it, or the path names an organization other than the key's own, or, under a share token, other than the one that owns what its link names, whether or not it exists. 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; a share token is held to Mountaya's own origin rather than to that list.
- `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, and under a share token one other than the organization that owns what its link names, 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 \
  -H "X-API-Key: pk_your_publishable_key" | jq '.data'
```

**TypeScript**

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

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

const { data } = await admin.organizations.getOrganization({ 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",
    headers={
        "X-API-Key": "pk_your_publishable_key",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "name": "Compagnie des Guides",
    "etag": "\"d7\"",
    "white_label": false,
    "awaiting_agreement": false,
    "created_at": "2026-01-14T09:20:11Z",
    "updated_at": "2026-08-01T02:14:07Z",
    "settings": {
      "etag": "\"d3\"",
      "default_props": {
        "preferred_language": "en",
        "preferred_theme": "light",
        "preferred_unit_length": "metric",
        "preferred_unit_pace": "per-time",
        "preferred_unit_slope": "degrees",
        "preferred_unit_temperature": "celsius",
        "segments_color": "",
        "terrain": "topo",
        "terrain_variant": "light",
        "with_access_restrictions": true,
        "with_collection_itineraries": true,
        "with_collection_zones": true,
        "with_directions_control": false,
        "with_download_control": false,
        "with_navigation_control": true,
        "with_overlays": [],
        "with_overlays_control": false,
        "with_preferences_control": true,
        "with_profile_analysis": true,
        "with_profile_characteristics": true,
        "with_profile_elevation": true,
        "with_profile_pace_control": true,
        "with_streetview_control": false,
        "with_terrains": []
      },
      "safety_rules": {
        "boundaries": [
          {
            "name": "Massif du Mont-Blanc",
            "bbox": [
              6.6,
              45.75,
              7.1,
              46
            ]
          }
        ],
        "domains": [
          "guides.example.com"
        ],
        "require_session_token": true,
        "with_collection_itineraries": true,
        "with_collection_zones": true,
        "with_overlays": [],
        "with_overlays_control": false,
        "with_profile_analysis": true,
        "with_profile_elevation": true,
        "zoom_max": 18,
        "zoom_min": 8
      },
      "theme": {
        "colors": {
          "ui": [
            "#ecefff",
            "#d5dafb",
            "#a9b1f1",
            "#7a87e9",
            "#5362e1",
            "#3a4bdd",
            "#2c40dc",
            "#1f32c4",
            "#182cb0",
            "#0a259c"
          ]
        }
      }
    }
  }
}
```

## Update an organization

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

- Operation: `patchOrganization`
- 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 the organization's own fields, merged into what is stored: a field left out keeps its value, and an empty object changes nothing and answers the organization as it stands. The display name is the whole of what is settable here: the Map Publishing settings are `patchOrganizationSettings`, the products the account holds follow from its agreement or its Data API subscription, and its limits from its agreement or the defaults. A change made here therefore cannot carry one of those along by accident.

- Owner or admin only (403 otherwise).
- A name of more than 30 characters as sent, or of fewer than 2 once leading and trailing whitespace is trimmed, is a 400.
- It does not change the name invoices are addressed to once one has been set through `patchOrganizationBillingInfo`.
- `If-Match` makes it conditional on the organization's `etag`. The settings carry an `etag` of their own, so a settings change made in the meantime never refuses this one.

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

- `If-Match` (string, in header, optional): Makes the write conditional on the resource still being the version the caller read: the `ETag` an earlier answer carried, which is also that resource's `etag` field, or `*` for any version. When the resource has changed since, the write is refused with `412` `PRECONDITION_FAILED`, nothing is changed, and the answer carries the current `ETag`, so the caller reads the resource again and decides. Omitted, the write is unconditional and the last write wins.

  One strong tag in double quotes, or `*`. A list of tags, a weak tag (`W/`) or any other spelling is a `400` naming the header. A resource the caller cannot see is answered `404` before the condition is asked, so a stale tag never tells a caller anything a read would not.

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 organization fields to change. Every field is optional; an omitted field keeps its current value.

- `name` (string, in body, optional): Display name of the organization: 2 to 30 characters as sent, and still at least 2 once leading and trailing whitespace is trimmed, which is the form it is stored in. Optional and not nullable: omit it to keep the current name. A name is one line: a tab, a line break or a line separator between two of its characters is a `400`, and one at either end is trimmed with the whitespace there.

**Response** `200`

The organization after the change, in full, with its new `etag` in `ETag`.

- `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` (Organization, required): An organization: the workspace itineraries, zones and collections belong to, together with the settings that shape its embeds. What the organization's agreement entitles it to is not part of it: the products a person's organizations hold are read as `organization_capabilities` on `getMyOrganizations`, and the one entitlement an embed paints by is `white_label`, which every read carries.

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

Response headers:

- `ETag`: The version of the resource this answer returns, an opaque strong tag in double quotes, equal to that resource's `etag` field. Send it back as `If-Match` to make a write conditional on nobody having changed the resource since. It changes whenever what this read returns changes; compare it whole and never parse it. Present on every answer that returns the resource, and on the `412` that refuses a stale `If-Match`.
- `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`, `412`, `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. 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`: `IdempotencyKeyInUse`, given in full at the end of this page.
- `412`: `PreconditionFailed`, 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/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Content-Type: application/json" \
  -d '{"name": "Compagnie des Guides"}'
```

**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.organizations.patchOrganization({
  organization_id: "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  body: { name: "Compagnie des Guides" },
});

console.log(data);
```

**Python**

```python
import requests
import uuid

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

Response 200:

```json
{
  "data": {
    "id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "name": "Compagnie des Guides",
    "etag": "\"d7\"",
    "white_label": false,
    "awaiting_agreement": false,
    "created_at": "2026-01-14T09:20:11Z",
    "updated_at": "2026-08-01T02:14:07Z",
    "settings": {
      "etag": "\"d3\"",
      "default_props": {
        "preferred_language": "en",
        "preferred_theme": "light",
        "preferred_unit_length": "metric",
        "preferred_unit_pace": "per-time",
        "preferred_unit_slope": "degrees",
        "preferred_unit_temperature": "celsius",
        "segments_color": "",
        "terrain": "topo",
        "terrain_variant": "light",
        "with_access_restrictions": true,
        "with_collection_itineraries": true,
        "with_collection_zones": true,
        "with_directions_control": false,
        "with_download_control": false,
        "with_navigation_control": true,
        "with_overlays": [],
        "with_overlays_control": false,
        "with_preferences_control": true,
        "with_profile_analysis": true,
        "with_profile_characteristics": true,
        "with_profile_elevation": true,
        "with_profile_pace_control": true,
        "with_streetview_control": false,
        "with_terrains": []
      },
      "safety_rules": {
        "boundaries": [
          {
            "name": "Massif du Mont-Blanc",
            "bbox": [
              6.6,
              45.75,
              7.1,
              46
            ]
          }
        ],
        "domains": [
          "guides.example.com"
        ],
        "require_session_token": true,
        "with_collection_itineraries": true,
        "with_collection_zones": true,
        "with_overlays": [],
        "with_overlays_control": false,
        "with_profile_analysis": true,
        "with_profile_elevation": true,
        "zoom_max": 18,
        "zoom_min": 8
      },
      "theme": {
        "colors": {
          "ui": [
            "#ecefff",
            "#d5dafb",
            "#a9b1f1",
            "#7a87e9",
            "#5362e1",
            "#3a4bdd",
            "#2c40dc",
            "#1f32c4",
            "#182cb0",
            "#0a259c"
          ]
        }
      }
    }
  }
}
```

## Retrieve an organization's Map Publishing settings

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

- Operation: `getOrganizationSettings`
- 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 settings that shape an organization's embeds: the default props a viewer starts from, the map theme, and the safety rules a visitor can never exceed. Read it against the same object the PATCH beside it replaces: this is the whole of what that operation writes, and nothing else.

- 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. Changing the settings takes the owner or admin role, which is why the PATCH needs a session token naming a user and this read does not.
- The settings carry an `etag` of their own, versioned apart from the organization's: a settings change moves it and leaves the organization's alone, and a rename moves the organization's and leaves this one alone, so neither ever refuses the other.

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.

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 settings that shape the organization's embeds, with their own `etag` in `ETag`.

- `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` (OrganizationSettings, required): The settings that shape an organization's embeds, its Map Publishing settings, in three independent groups: the default props an embed starts from, the safety rules constraining what an embed may do, and the map theme. Each group is replaced whole rather than merged, so a partial update carries the complete group it changes.

  See [the OrganizationSettings object](https://docs.mountaya.com/en/apis/map-studio/reference/organizations.md#organization-settings-object).

Response headers:

- `ETag`: The version of the resource this answer returns, an opaque strong tag in double quotes, equal to that resource's `etag` field. Send it back as `If-Match` to make a write conditional on nobody having changed the resource since. It changes whenever what this read returns changes; compare it whole and never parse it. Present on every answer that returns the resource, and on the `412` that refuses a stale `If-Match`.

**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
# Any member role reads them, and an api session minted without `user_id`
# needs none. Changing them takes the owner or admin role, which is why the
# PATCH needs a session token naming a user and this read does not.
curl -s https://api.mountaya.com/v1/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/settings \
  -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.organizations.getOrganizationSettings({ 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/settings",
    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": {
    "etag": "\"d3\"",
    "default_props": {
      "preferred_language": "en",
      "preferred_theme": "light",
      "preferred_unit_length": "metric",
      "preferred_unit_pace": "per-time",
      "preferred_unit_slope": "degrees",
      "preferred_unit_temperature": "celsius",
      "segments_color": "",
      "terrain": "topo",
      "terrain_variant": "light",
      "with_access_restrictions": true,
      "with_collection_itineraries": true,
      "with_collection_zones": true,
      "with_directions_control": false,
      "with_download_control": false,
      "with_navigation_control": true,
      "with_overlays": [],
      "with_overlays_control": false,
      "with_preferences_control": true,
      "with_profile_analysis": true,
      "with_profile_characteristics": true,
      "with_profile_elevation": true,
      "with_profile_pace_control": true,
      "with_streetview_control": false,
      "with_terrains": []
    },
    "safety_rules": {
      "boundaries": [
        {
          "name": "Massif du Mont-Blanc",
          "bbox": [
            6.6,
            45.75,
            7.1,
            46
          ]
        }
      ],
      "domains": [
        "guides.example.com"
      ],
      "require_session_token": true,
      "with_collection_itineraries": true,
      "with_collection_zones": true,
      "with_overlays": [],
      "with_overlays_control": false,
      "with_profile_analysis": true,
      "with_profile_elevation": true,
      "zoom_max": 18,
      "zoom_min": 8
    },
    "theme": {
      "colors": {
        "ui": [
          "#ecefff",
          "#d5dafb",
          "#a9b1f1",
          "#7a87e9",
          "#5362e1",
          "#3a4bdd",
          "#2c40dc",
          "#1f32c4",
          "#182cb0",
          "#0a259c"
        ]
      }
    }
  }
}
```

## Update an organization's Map Publishing settings

### PATCH /v1/organizations/{organization_id}/settings

- Operation: `patchOrganizationSettings`
- 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

Applies a partial update to the settings that shape an organization's embeds: the default props, the map theme, and the safety rules. Only the groups present in the request body are replaced; the omitted groups are preserved. A group that is present carries every one of its fields, so a partial group is a 400 rather than a partial change.

- Owner or admin only (403 otherwise). That is the role difference from the GET beside it, and the reason this one needs a session token naming a user.
- `If-Match` makes it conditional on the settings' own `etag`, which only a settings change moves: a rename made in the meantime never refuses it.
- Three safety rules are set by Mountaya, and a request sends them as they stand: `safety_rules.with_overlays` and `safety_rules.with_overlays_control` on every organization, and the sites of `safety_rules.domains` on an organization covered by an agreement. A `safety_rules` group that changes any of them is a `403` whose entry names that field, and nothing is changed. `with_overlays` is compared as a set, so the order of its slugs changes nothing, and the sites of `domains` are compared as a set once each entry is normalized the way it is stored, its loopback entries (`localhost`, a name under `.localhost`, `127.0.0.0/8`, `[::1]`) left out: an administrator adds and removes those on any organization. A self-serve organization's administrators set its `domains` whole.
- `safety_rules.domains` holds as many counted entries as the organization's agreement allows, 1 unless it says otherwise, a loopback entry never counting: a request that would leave more, and more than the list counts now, is refused at `allowed-domains`, a `429` coded `LIMIT_REACHED` with no `Retry-After`, and nothing is changed. Remove one first, or agree a higher limit. A list counting more than a lowered limit is kept: its entries may be edited or removed, and no counted entry added until it counts fewer than the limit.
- The organization's limits, the per-minute rate limits and monthly allowances among them, are not settings and are not here: they are the organization's agreement's, and a caller that exhausts one is refused by the surface that limit governs.

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

- `If-Match` (string, in header, optional): Makes the write conditional on the resource still being the version the caller read: the `ETag` an earlier answer carried, which is also that resource's `etag` field, or `*` for any version. When the resource has changed since, the write is refused with `412` `PRECONDITION_FAILED`, nothing is changed, and the answer carries the current `ETag`, so the caller reads the resource again and decides. Omitted, the write is unconditional and the last write wins.

  One strong tag in double quotes, or `*`. A list of tags, a weak tag (`W/`) or any other spelling is a `400` naming the header. A resource the caller cannot see is answered `404` before the condition is asked, so a stale tag never tells a caller anything a read would not.

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 settings groups to replace. Every group is optional; a group that is present is replaced whole and carries every one of its fields, and a group that is absent is left as it is.

- `default_props` (object, in body, optional): What an embed starts with when it names nothing itself. Sent whole: the object REPLACES the stored one rather than merging into it, and every field in it is required, so a group that leaves one out is a 400 rather than a partial change.
  - `preferred_language` (string, required, one of: `en`, `fr`, `es`, `it`, `de`, `zh`, `ja`): Language an embed's interface and place names start in.
  - `preferred_theme` (string, required, one of: `auto`, `light`, `dark`): Color theme an embed starts in. `auto` follows the visitor's operating-system preference.
  - `preferred_unit_length` (string, required, one of: `metric`, `imperial`): Unit distances and elevations are displayed in.
  - `preferred_unit_pace` (string, required, one of: `per-time`, `per-distance`): Form travel rates are expressed in. `per-time` renders a speed (km/h with metric, mph with imperial); `per-distance` renders a pace, the reciprocal (min/km with metric, min/mi with imperial). The unit *system* still comes from `preferred_unit_length`; this chooses only the form.
  - `preferred_unit_slope` (string, required, one of: `degrees`, `percentage`): Unit gradients are displayed in, on both the elevation profile and the segment readouts.
  - `preferred_unit_temperature` (string, required, one of: `celsius`, `fahrenheit`): Unit temperatures are displayed in.
  - `segments_color` (string, required): Single color every itinerary segment is painted in on an embed, on both the map lines and the elevation profile bands. An empty string means each segment keeps its own color. Applies to an embed only, never to a shared itinerary view.

    A hex code with a leading hash, in three-digit or six-digit form; a three-digit value is stored expanded to six digits and lowercased, so `#F00` is accepted and read back as `#ff0000`. The empty string is the only other accepted value. Anything else is a 400.
  - `terrain` (string, required): Slug of the terrain an embed loads first, drawn from the terrain catalog the tiles API's layers manifest publishes. Only the initial selection: a visitor may switch to any terrain `with_terrains` permits. A slug absent from the manifest leaves the map on the Mountaya default terrain.
  - `terrain_variant` (string, required, one of: `light`, `dark`): Visual style the terrain starts in, for terrains that publish both a light and a dark rendering.
  - `with_access_restrictions` (boolean, required): Whether the stretches of an itinerary's route whose access is restricted are drawn, as stripes and a warning icon per kind, read from the `itinerary_restrictions` layer of the itinerary tiles. No safety rule governs it.
  - `with_collection_itineraries` (boolean, required): Whether a collection embed draws the itineraries the collection contains. It is the default a collection tile request without `with_itineraries` falls back to. Capped by `safety_rules.with_collection_itineraries`, which withholds the layer server-side when false.
  - `with_collection_zones` (boolean, required): Whether a collection embed draws the zones the collection contains, which are its published public zones, each as last published, since the embed reads as the public does. It is the default a collection tile request without `with_zones` falls back to. Capped by `safety_rules.with_collection_zones`, which withholds the layer server-side when false.
  - `with_directions_control` (boolean, required): Whether the directions control is offered, opening the turn-by-turn directions of the itinerary's routed segments as they were stored, to read, print or download as a PDF. It computes no route: a visitor never routes between points of their own. No safety rule governs it.
  - `with_download_control` (boolean, required): Whether the export control is offered, letting a visitor download an itinerary in any of the export formats (GPX, FIT, TCX, GeoJSON, KML, KMZ and CSV). No safety rule governs it.
  - `with_navigation_control` (boolean, required): Whether the map navigation controls, the zoom and compass buttons, are shown. An embed never offers geolocation, whatever this says, because it never asks a visitor for their location. No safety rule governs it; the zoom range a visitor can actually reach is set by `safety_rules.zoom_min` and `safety_rules.zoom_max`.
  - `with_overlays` (array of string, required): Slugs of the terrain overlays offered in the overlay picker. **An empty array, or one holding the entry `"*"` anywhere, offers the whole catalog**; any other list narrows the picker to those slugs and drops a category left with nothing to show. Note that this is a display list only and its empty case reads the OPPOSITE way from `safety_rules.with_overlays`, where an empty array denies every overlay. An overlay offered here but absent from the safety rule renders no tiles.
  - `with_overlays_control` (boolean, required): Whether the overlay time cursor is offered, letting a visitor move an overlay backwards or forwards in time. Capped by `safety_rules.with_overlays_control`, which, when false, refuses a tile asked for more than 15 minutes from the current instant on every overlay the server draws per instant.

    It governs the time cursor alone. It neither offers nor hides the layers control: which overlays a visitor may switch on and off is `with_overlays`, capped by `safety_rules.with_overlays`, and which terrains the switcher offers is `with_terrains`, so an embed whose overlays are drawn only at the present instant still offers every overlay its cap admits.
  - `with_preferences_control` (boolean, required): Whether the preferences control is offered, letting a visitor change the units (distance, travel rate, slope and temperature) and the interface language for their visit. The theme is not among them: an embed keeps the publisher's `preferred_theme`. No safety rule governs it; it never persists anything to the organization.
  - `with_profile_analysis` (boolean, required): Whether the profile's computed terrain analysis is shown: the surface and way-type bars under the elevation chart, and the surface, way type, trail difficulty, slope and aspect readings of its hover readout. Capped by `safety_rules.with_profile_analysis`, which strips the analysis from the payload server-side when false, so turning this on against a false rule shows nothing.

    Read AGAINST `with_profile_elevation`: on a pointer device the bars are revealed by hovering the elevation curve and are aligned to its distance axis, so the analysis shows nothing while the chart is off.
  - `with_profile_characteristics` (boolean, required): Whether the itinerary's summary characteristics (distance, ascent, descent, duration) are shown alongside the profile. No safety rule governs it.
  - `with_profile_elevation` (boolean, required): Whether the elevation profile chart is shown. Capped by `safety_rules.with_profile_elevation`, which forces the control off and disables it when false.
  - `with_profile_pace_control` (boolean, required): Whether the pace control is offered on the elevation profile, letting a visitor enter their own travel rate and read the itinerary re-timed for it. Resolution runs URL query parameter, then this object, then the Mountaya default, like the rest of this object. The override is session-local and persists nothing: the itinerary's committed speeds are untouched, every other visitor reads the author's figures, and clearing the field restores them. No safety rule governs it; the re-time reveals nothing a visitor cannot already read.

    Requires BOTH `with_profile_elevation` and `with_profile_characteristics`, for two different reasons. The chart, because the rate is read against the curve it re-times. The characteristics row, because that row is WHERE the field renders, beside the segment chooser. With either of them off the field is withheld however the embed is configured.
  - `with_streetview_control` (boolean, required): Whether the street-level imagery control is offered. No safety rule governs it.
  - `with_terrains` (array of string, required): Slugs of the terrains offered in the terrain switcher. **An empty array, or one holding the entry `"*"` anywhere, offers every terrain in the manifest**; any other list narrows the switcher to those slugs. This is the one allowlist with no safety rule behind it. Enforcement is client-side only, which is why it sits here rather than on `EmbeddedStudioSafetyRules`: terrain tiles carry no organization-private data, so restricting the switcher is a presentation choice, not a security boundary. Treat it accordingly.

- `theme` (object, in body, optional): The organization's colors and typography for an embed. Sent whole: the object REPLACES the stored one rather than merging into it, and every field in it is required.
  - `colors` (object, required): The color scale an embed renders with.
    - `ui` (array of string, required): The 10-stop UI color scale, ordered lightest to darkest. Exactly 10 entries: a shorter or longer array is rejected rather than padded.

      Six-digit form only, and case-insensitive: a scale is stored and returned in the case it was written in rather than normalized, so compare these case-insensitively. `segments_color`, which is a color rather than a scale, is the one that is lowercased on the way in.

- `safety_rules` (object, in body, optional): The ceilings an embed cannot raise. Sent whole: the object REPLACES the stored one rather than merging into it, and every rule in it is required, `require_session_token` included, so a group that leaves one out is a 400 rather than a change that drops it. `with_overlays`, `with_overlays_control`, and `domains` on an organization covered by an agreement, are sent as they stand, since Mountaya sets them: changing any of them is a `403`.
  - `boundaries` (array of Boundaries, required): Named geographic regions outside which tiles are refused. A tile request made with a publishable key whose coordinates fall in none of them is rejected with a validation error, which caps how far an embed can pan. **An EMPTY array means no geographic restriction**, so every tile is in range. That makes this list opt-in, unlike `with_overlays`. The zoom range applies either way. Tiles scoped to a single already-authorized resource skip the boundary check (refusing them would hide nothing the caller cannot already read) but still honour the zoom range.
    - `bbox` (array of number (double), required): Bounding box as [minLongitude, minLatitude, maxLongitude, maxLatitude] in WGS 84 decimal degrees. This is the flat four-tuple every bounding box on every Mountaya surface uses, so a client reads one shape everywhere. Exactly four numbers, longitude first in each pair; the minimum corner comes first.

      The bound is WGS 84's own: a coordinate outside it names no point on Earth, and this box is evaluated on every tile request that carries one, so a nonsensical value is not merely inert. `items` holds the widest of the two ranges because a tuple's positions cannot be typed apart in JSON Schema; the per-position latitude range is enforced where the box is written.
    - `name` (string, required): Display name of the bounded region. Bounded in length because it is stored per organization and echoed back on every settings read.
  - `domains` (array of string, required): The pages allowed to call the API from a browser with the organization's publishable keys, and the sites allowed to frame Mountaya's hosted embed. A request is compared by its `Origin`, falling back to `Referer`, after normalization, which ignores letter case and a leading `www.`. Mountaya's own pages are always allowed, whatever the list holds: its web application, and for the API alone its documentation, whose explorer runs the queries a reader sends with their own key. The list is checked against the page a browser names, and only then: a request naming no page, as a server sends, or as a page sends under a `no-referrer` policy that strips `Referer` from a request that carries no `Origin`, such as an image or a map tile, is not checked against it at all. It is therefore not an access control on the key: it decides which pages may use the key from a browser that names them, while the publishable key and, when required, the session token are what gate a request.

    **An EMPTY array allows no page but Mountaya's own**, on the API and for the hosted embed alike: a browser on any other page is refused with a `403`, and no other site can frame the embed. An organization lists every site that uses its keys or shows its embed, and `localhost` with the port of its development server while it builds; a request naming no page, from its own servers, a command line or a native app, keeps working with an empty list. A page that names the `null` origin, a sandboxed frame, a `data:` URL or a `file:` page, is refused, whatever the list holds.

    An entry is `host[:port]`: a host name, `localhost`, an IPv4 address or an IPv6 address in brackets, optionally followed by a port, such as `guides.example.com` or `localhost:3000`. A host name is made of letters, digits, hyphens and underscores in dot-separated labels. Anything else is a `400` naming the entry, a scheme, a path, a query, a wildcard and `null` among them: entries are compared whole, so a wildcard such as `*.example.com` would match nothing, and `null` is the origin every sandboxed frame sends. A host with an underscore and an IPv6 address are allowed on the API but cannot frame the hosted embed, because no browser accepts either in the `frame-ancestors` policy that names the sites allowed to frame a page.

    It holds as many entries as the organization's agreement allows, 1 by default: the `allowed-domains` limit, which an agreement may raise, lower or make unlimited. An entry naming the loopback, `localhost`, a name under `.localhost`, an address in `127.0.0.0/8` or `[::1]`, with or without a port, is not counted toward it: a page on a developer's own machine is no site of the organization's. A write that would leave more counted entries than that limit, and more than the list counts now, is a `429` coded `LIMIT_REACHED` at `allowed-domains`, and nothing is changed. A list counting more than a lowered limit is kept as it is: its entries may be edited or removed, and no counted entry added until it counts fewer than the limit.

    Apart from that limit, the list holds 100 entries at most, loopback ones included, whatever the agreement allows, since it is walked on every publishable-key request and sent whole in the policy that names the sites allowed to frame the hosted embed. More is a `400` naming the list.

    Who sets it depends on how the organization is covered. On a self-serve organization, whose keys serve the Data API, it is its administrators', written with `patchOrganizationSettings`. On an organization covered by an agreement its sites are set by Mountaya, as the agreement states, and a `patchOrganizationSettings` that adds, removes or changes a counted entry is a `403`; its administrators still add and remove its loopback entries themselves, so a developer lists `localhost:5173` without asking Mountaya.
  - `require_session_token` (boolean, required): Whether a publishable-key request that a key alone would otherwise be served must carry a session token, minted by the publisher's backend, in the `X-Session-Token` header, or in the `session_token` query parameter where that form is read: every Tile API and Data API request. When true, a request carrying only the key is refused with a `401`; when false, a valid publishable key plus an allowed page, or no page named at all, is enough. A new organization starts with it off, so an organization with no backend can embed once it lists its sites, which makes the domain allowlist the only visitor gate in that configuration.

    It decides whether a request may be made, not what it reads. A token minted without `user_id`, which is what a backend mints for a visitor nobody signed in, satisfies it and is served exactly what the key alone would be: the published snapshot, public-only listings and tiles cut from published content. Only a token naming a member reads the organization's drafts.

    Required on every write, with no default: a settings write that left it out would otherwise be read as turning enforcement off.

    What it governs is what a key reaches alone. Every `management` and every `studio-embedded` operation requires a session token whatever this says, and the Data API requires one on every request, so on the Map Studio API it governs the `publishing` reads, and on the Tile API every request a key makes. It is NOT limited to the embed or to the Tile API: with it on, the `publishing` reads are refused without a token too, so turning it on for an embed also changes what a server-to-server integration reading with the same key must send.
  - `with_collection_itineraries` (boolean, required): Whether an embed may render the itineraries of a collection. A collection tile request picks the itinerary layer with its `with_itineraries` query parameter, and falls back to `default_props.with_collection_itineraries` without one. When this rule is false, a request made with a publishable key has the layer withheld whatever either of those says, and whatever its `itinerary_id` names: the rule can switch the layer off, never on.
  - `with_collection_zones` (boolean, required): Whether an embed may render the zones of a collection. A collection tile request picks the zone layer with its `with_zones` query parameter, and falls back to `default_props.with_collection_zones` without one. When this rule is false, a request made with a publishable key has the layer withheld whatever either of those says, as with the itinerary layer.
  - `with_overlays` (array of string, required): Slugs of the terrain overlays an embed may request. **An EMPTY array denies every overlay**, which is the deliberate secure default, as `domains` reads an empty list and the opposite of how `boundaries` reads one. An entry `"*"`, anywhere in the list, allows all of them. Any other list is an exact-slug allowlist, and an overlay tile for an unlisted slug is refused to a publishable key and to a share link of the organization alike. Note that `EmbeddedStudioDefaultProps.with_overlays` is a *display* list read by the client with the opposite empty-case meaning (empty there means "offer the whole catalog"); this one is the enforced cap.

    An entry is an overlay slug from `GET /v1/layers`, exactly as it is spelled there, or the wildcard `"*"`. Mountaya sets no other entry, so every slug listed draws that overlay; an overlay later withdrawn from the catalog is denied by its entry rather than erroring.

    It is always set by Mountaya, as the organization's agreement states, on every organization: a `patchOrganizationSettings` that changes it is a `403`, and one that sends it as it stands, in any order, changes nothing. It governs what a publishable key and a share link draw. The organization's own members, in Mountaya's studio, are drawn every overlay while the organization holds Map Studio.
  - `with_overlays_control` (boolean, required): Whether an embed visitor may move an overlay's time cursor. When false, a tile of an overlay whose `capabilities.server.timestamp` is true (the weather and snow overlays) asked for an instant more than 15 minutes from the current one is a `403`, a share-token request included, so the visitor sees the present state only and cannot browse history or forecast. An overlay whose tiles do not change with the instant is drawn whatever instant is sent.

    It takes away the time cursor alone: which overlays a visitor may switch on is `with_overlays`, and a false here neither hides the layers control nor refuses an overlay drawn at the present instant. Granting it grants forecast and history beyond 15 minutes, nothing else.

    It is always set by Mountaya, as the organization's agreement states, on every organization: a `patchOrganizationSettings` that changes it is a `403`, and one that sends it as it stands changes nothing.
  - `with_profile_analysis` (boolean, required): Whether an embed may receive the computed terrain analysis of an itinerary's segments: `surface_info`, `way_type_info` and `trail_difficulty_info`. When false those three are null in the itinerary payload served to embeds: they are removed from the response, not merely hidden by the client. `road_access_info`, `slope_info`, `speed_info` and the durations are always served. Whether a share-token view receives the three does not depend on this rule.
  - `with_profile_elevation` (boolean, required): Whether an embed may show the elevation profile chart. Consumed by the embed surface, which forces the corresponding control off and disables it when this is false, so a publisher cannot re-enable it per embed.
  - `zoom_max` (integer (int32), required): Highest zoom level for which tiles are served. A request above it is refused, which is the anti-scrape ceiling: it bounds how much detail an embed can pull. Enforced on every tile request made with a publishable key, including for tiles scoped to a single authorized resource; a share-token request is not held to it. The client pulls its camera maximum slightly inside this value to leave headroom for pitch and terrain drift. A new organization starts at 18.

    The bounds are the tile surface's own: `z` is `0..22` on every tile operation, so a ceiling outside that range can never refuse anything a structurally valid request could ask for.
  - `zoom_min` (integer (int32), required): Lowest zoom level for which tiles are served. A request below it is refused, which bounds how far out an embed can zoom. Enforced wherever `zoom_max` is. Set it equal to or near `zoom_max` only deliberately: the client has to widen a degenerate range to keep a valid camera, so a very narrow window is honoured at the tile layer but approximated at the camera. A value above `zoom_max` is a 400 naming `zoom_min`: an inverted range would refuse every tile, which reads to a visitor as a map that never loads. A new organization starts at 8.

**Response** `200`

The settings after the change, in full: the groups that were replaced and the groups that were left alone, with the settings' new `etag` in `ETag`.

- `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` (OrganizationSettings, required): The settings that shape an organization's embeds, its Map Publishing settings, in three independent groups: the default props an embed starts from, the safety rules constraining what an embed may do, and the map theme. Each group is replaced whole rather than merged, so a partial update carries the complete group it changes.

  See [the OrganizationSettings object](https://docs.mountaya.com/en/apis/map-studio/reference/organizations.md#organization-settings-object).

Response headers:

- `ETag`: The version of the resource this answer returns, an opaque strong tag in double quotes, equal to that resource's `etag` field. Send it back as `If-Match` to make a write conditional on nobody having changed the resource since. It changes whenever what this read returns changes; compare it whole and never parse it. Present on every answer that returns the resource, and on the `412` that refuses a stale `If-Match`.
- `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`, `412`, `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. The role requirement is the difference from `getOrganizationSettings`, which any member reads. A body that changes a safety rule Mountaya sets is refused here too, with an entry whose `path` names that field: `safety_rules.with_overlays` and `safety_rules.with_overlays_control` on any organization, and a site of `safety_rules.domains` on an organization covered by an agreement, whose loopback entries its administrators still change. Nothing is changed, and sending the value in force clears it. 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`: `IdempotencyKeyInUse`, given in full at the end of this page.
- `412`: `PreconditionFailed`, given in full at the end of this page.
- `413`: Payload Too Large
- `429`: `TooManyRequestsOrLimitReached`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# Groups are replaced wholesale, not merged: send safety_rules complete. Omitted
# GROUPS are preserved; a sent group missing a FIELD is a 400. Mountaya sets
# with_overlays and with_overlays_control, and the sites among the domains of an
# organization covered by an agreement (its localhost entries stay yours), and a
# group that changes one is a 403, so read the group and send it back with the
# one rule changed.
URL=https://api.mountaya.com/v1/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/settings
curl -s "$URL" \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  | jq '{safety_rules: (.data.safety_rules + {require_session_token: true})}' \
  | curl -s -X PATCH "$URL" \
      -H "X-API-Key: pk_your_publishable_key" \
      -H "X-Session-Token: sess_your_session_token" \
      -H "Content-Type: application/json" \
      -d @-
```

**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.organizations.patchOrganizationSettings({
  organization_id: "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  body: {
    theme: {
      colors: {
        ui: [
          "#ecefff",
          "#d5dafb",
          "#a9b1f1",
          "#7a87e9",
          "#5362e1",
          "#3a4bdd",
          "#2c40dc",
          "#1f32c4",
          "#182cb0",
          "#0a259c",
        ],
      },
    },
  },
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.patch(
    "https://api.mountaya.com/v1/organizations/d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b/settings",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "theme": {
            "colors": {
                "ui": [
                    "#ecefff",
                    "#d5dafb",
                    "#a9b1f1",
                    "#7a87e9",
                    "#5362e1",
                    "#3a4bdd",
                    "#2c40dc",
                    "#1f32c4",
                    "#182cb0",
                    "#0a259c",
                ],
            },
        },
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "etag": "\"d3\"",
    "default_props": {
      "preferred_language": "en",
      "preferred_theme": "light",
      "preferred_unit_length": "metric",
      "preferred_unit_pace": "per-time",
      "preferred_unit_slope": "degrees",
      "preferred_unit_temperature": "celsius",
      "segments_color": "",
      "terrain": "topo",
      "terrain_variant": "light",
      "with_access_restrictions": true,
      "with_collection_itineraries": true,
      "with_collection_zones": true,
      "with_directions_control": false,
      "with_download_control": false,
      "with_navigation_control": true,
      "with_overlays": [],
      "with_overlays_control": false,
      "with_preferences_control": true,
      "with_profile_analysis": true,
      "with_profile_characteristics": true,
      "with_profile_elevation": true,
      "with_profile_pace_control": true,
      "with_streetview_control": false,
      "with_terrains": []
    },
    "safety_rules": {
      "boundaries": [
        {
          "name": "Massif du Mont-Blanc",
          "bbox": [
            6.6,
            45.75,
            7.1,
            46
          ]
        }
      ],
      "domains": [
        "guides.example.com"
      ],
      "require_session_token": true,
      "with_collection_itineraries": true,
      "with_collection_zones": true,
      "with_overlays": [],
      "with_overlays_control": false,
      "with_profile_analysis": true,
      "with_profile_elevation": true,
      "zoom_max": 18,
      "zoom_min": 8
    },
    "theme": {
      "colors": {
        "ui": [
          "#ecefff",
          "#d5dafb",
          "#a9b1f1",
          "#7a87e9",
          "#5362e1",
          "#3a4bdd",
          "#2c40dc",
          "#1f32c4",
          "#182cb0",
          "#0a259c"
        ]
      }
    }
  }
}
```

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

- `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.
- `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.
- `PreconditionFailed` (`412`): `If-Match` named a version the resource has moved on from: somebody changed it after the caller read it. Nothing was changed. The one entry is coded `PRECONDITION_FAILED`, and `ETag` carries the current version, so read the resource again, decide whether the change still applies, and send it with the new tag. Retrying with the same tag is refused the same way. A resource the caller cannot see is answered `404` before the condition is asked, and a write refused for any other reason is refused for that reason first.
- `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.
