---
title: "`POST /admin/styles/{id}/owner`: give one style an owner."
method: POST
path: "/admin/styles/{id}/owner"
tags: ["admin"]
---

# \`POST /admin/styles/{id}/owner\`: give one style an owner.

`POST /admin/styles/{id}/owner`

## Request

- Base URL: `https://api.mapmap.ai`
- URL: `https://api.mapmap.ai/admin/styles/{id}/owner`
- Auth: HTTP bearer

The per-style half of the legacy migration (the bulk half is
`SN_STYLES_LEGACY_OWNER_KEY`, see [`adopt_legacy_styles`]). Also the
supported way to hand a style over when a customer's key is rotated or
an account is merged, so ownership is never a one-way door.

The key id is looked up so a typo cannot strand a style behind an owner
that does not exist; the key's identity is recorded alongside it, so
sibling keys of the same account inherit the style exactly as they would
have had they created it.

## Path parameters

- `id` string, required

## Request body

- AdoptStyleRequest: Body for `POST /admin/styles/{id}/owner`.
  - `key_id` string, required: Id of the API key that should own the style from now on.

## Response `200`

The style's updated metadata

- StyleMeta: Per-style metadata (`<dir>/<id>/meta.json`).
  - `created_at` string, required: RFC 3339 creation timestamp.
  - `id` string, required: Style id (kebab-case slug + 6 hex chars).
  - `latest_version` integer, required: Highest published version; `GET /styles/{id}.json` serves it.
  - `name` string, required: Human-readable style name.
  - `owner` StyleOwner: Who owns a hosted style: the API key that created it, and the identity that key belongs to when it is a self-served key. The identity is what ownership is really checked against wherever it exists, a self-served account may hold up to five sibling keys and they share one quota, so they must share one set of styles too, or rotating a key would silently strand every style it had published. Operator-issued keys have no identity and fall back to the key id.
    - `identity_id` string, nullable: Owning identity id, for self-served keys. `None` for operator-issued keys, which have no identity.
    - `key_id` string, required: Id of the API key that created the style.
  - `updated_at` string, required: RFC 3339 timestamp of the latest publish.

## Other responses

- `400`: Unknown key id
- `401`: Missing or invalid admin token
- `404`: Hosted styles not configured or unknown style

---

[API](https://skmtc.dev/mapmap/apis/sn-gateway.md) · [All operations](https://skmtc.dev/mapmap/apis/sn-gateway/llms.txt) · [OpenAPI document](https://skmtc.dev/mapmap/apis/sn-gateway/revisions/2293be8b4c38?raw)
