Get started
Map Studio API
Guides

Manage members, invitations and keys

Manage members, invitations and keys

People join your organization by invitation, and each member holds one role. Your backend administers members and publishable keys with a key of its own, the management key.

Before you start

Create a key that carries the management scope under Organization → API keys in the Mountaya app. It carries no other scope, so it stays on your server. Your organization's id is in the app's address, after /organizations/.

export MOUNTAYA_MANAGEMENT_KEY="pk_your_publishable_key"
export MOUNTAYA_ORGANIZATION_ID="a5eec5f3-3463-4b20-9469-de3eeb870a7a"

Changes act as an owner or admin, so mint the token for one:

export MOUNTAYA_ADMIN_TOKEN=$(curl -s -X POST https://api.mountaya.com/v1/sessions \
  -H "X-API-Key: $MOUNTAYA_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"publishable_key\": \"$MOUNTAYA_MANAGEMENT_KEY\", \"user_id\": \"7a4e1c98-3b52-4f60-9d81-c05e2f7a83b1\"}" \
  | jq -r .data.token)

The samples below read the token as MOUNTAYA_ADMIN_TOKEN. It lasts five minutes, so mint another before it expires.

Invite someone

Invite an email address with the role the person holds once they accept:

INVITATION=$(curl -s -X POST https://api.mountaya.com/v1/organizations/$MOUNTAYA_ORGANIZATION_ID/invitations \
  -H "X-API-Key: $MOUNTAYA_MANAGEMENT_KEY" \
  -H "X-Session-Token: $MOUNTAYA_ADMIN_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"email": "camille@example.com", "role": "contributor"}')

INVITATION_ID=$(echo "$INVITATION" | jq -r .data.id)
echo "$INVITATION" | jq .data
Response
{
  "id": "3d6f0a2b-4c1e-4f87-9b25-7e0c1d9a6f43",
  "email": "camille@example.com",
  "role": "contributor",
  "invited_by": { "id": "7a4e1c98-3b52-4f60-9d81-c05e2f7a83b1" },
  "created_at": "2026-11-19T09:12:44Z",
  "expires_at": "2026-12-19T09:12:44Z"
}

Mountaya sends nothing to the address, so tell the person yourself. They accept in the Mountaya app, once their account has verified that address. Each member and each waiting invitation holds one of the seats your agreement allows.

Find each member's user id

List the members, then match each person signed in to your product by email and store their user_id. Their session tokens are minted with it.

curl -s https://api.mountaya.com/v1/organizations/$MOUNTAYA_ORGANIZATION_ID/members \
  -H "X-API-Key: $MOUNTAYA_MANAGEMENT_KEY" \
  -H "X-Session-Token: $MOUNTAYA_ADMIN_TOKEN" \
  | jq '[.data[] | {user_id, email, role}]'
Response
[
  {
    "user_id": "7a4e1c98-3b52-4f60-9d81-c05e2f7a83b1",
    "email": "ada@example.com",
    "role": "owner"
  },
  {
    "user_id": "7f3c1d92-4a08-4b6e-9c15-2d84e0b7a361",
    "email": "camille@example.com",
    "role": "contributor"
  }
]

Change a role

Send the role the member holds from their next request on:

curl -s -X PATCH https://api.mountaya.com/v1/organizations/$MOUNTAYA_ORGANIZATION_ID/members/7f3c1d92-4a08-4b6e-9c15-2d84e0b7a361 \
  -H "X-API-Key: $MOUNTAYA_MANAGEMENT_KEY" \
  -H "X-Session-Token: $MOUNTAYA_ADMIN_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"role": "viewer"}' \
  | jq '.data | {user_id, email, role}'
Response
{
  "user_id": "7f3c1d92-4a08-4b6e-9c15-2d84e0b7a361",
  "email": "camille@example.com",
  "role": "viewer"
}

Through the API, a member moves between contributor and viewer. Granting or changing admin is the owner's, in the Mountaya app.

Remove a member or withdraw an invitation

Removing a member frees their seat, and what they created stays with your organization. Withdrawing an invitation frees its seat too:

curl -s -X DELETE https://api.mountaya.com/v1/organizations/$MOUNTAYA_ORGANIZATION_ID/members/7f3c1d92-4a08-4b6e-9c15-2d84e0b7a361 \
  -H "X-API-Key: $MOUNTAYA_MANAGEMENT_KEY" \
  -H "X-Session-Token: $MOUNTAYA_ADMIN_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"

curl -s -X DELETE https://api.mountaya.com/v1/organizations/$MOUNTAYA_ORGANIZATION_ID/invitations/$INVITATION_ID \
  -H "X-API-Key: $MOUNTAYA_MANAGEMENT_KEY" \
  -H "X-Session-Token: $MOUNTAYA_ADMIN_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"
Response
{
  "data": null
}

Create and revoke publishable keys

A publishable key reaches only the scopes it carries. Create one per app, with what that app needs:

KEY=$(curl -s -X POST https://api.mountaya.com/v1/organizations/$MOUNTAYA_ORGANIZATION_ID/publishable-keys \
  -H "X-API-Key: $MOUNTAYA_MANAGEMENT_KEY" \
  -H "X-Session-Token: $MOUNTAYA_ADMIN_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"name": "Website embed", "scopes": ["publishing", "tiles"]}')

KEY_ID=$(echo "$KEY" | jq -r .data.id)
echo "$KEY" | jq '.data | {id, name, key, scopes}'
Response (abridged)
{
  "id": "3b1f9c02-6d4e-4a87-b5c1-70e2af3d8916",
  "name": "Website embed",
  "key": "pk_your_publishable_key",
  "scopes": ["publishing", "tiles"]
}

Revoke a key you no longer use. To rotate one, create its replacement, deploy it, then revoke the old key. Every request with a revoked key fails at once:

curl -s -X DELETE https://api.mountaya.com/v1/organizations/$MOUNTAYA_ORGANIZATION_ID/publishable-keys/$KEY_ID \
  -H "X-API-Key: $MOUNTAYA_MANAGEMENT_KEY" \
  -H "X-Session-Token: $MOUNTAYA_ADMIN_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  | jq '.data | {id, name, revoked_at}'
Response (abridged)
{
  "id": "3b1f9c02-6d4e-4a87-b5c1-70e2af3d8916",
  "name": "Website embed",
  "revoked_at": "2026-11-19T10:02:31Z"
}

Secret keys are created and revoked in the Mountaya app only.

Next steps

Last updated