# Platform API

> Every endpoint for realms, delegated administration, keys, host names, stored data and cross-origin calls, by area.

Every endpoint the platform serves on your realm's host, `https://foobar.cvyuh.com`, from the code's routes. Admin
calls take a realm administrator's session, as `Cookie: x-cvyuh-token=$CVYUH_SESSION`, and every object is read and
written the same way, with the same paging, revisions and errors: see [Call the API](/develop/api/). Calls on a realm
beneath yours go to that realm's own host name, with your session. No endpoint here has a rate limit today, and every
limit a realm has is in [Limits](/reference/limits/).

## Realms

The realms beneath yours. Each call is made by an administrator of the realm's parent; the list and a read need only
`READ`.

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `GET` | `https://foobar.cvyuh.com/api/v0/am/global/realms/v1` | Your realm and every realm beneath it, deleted ones included (with `deleteTime` and `purged`), paged, filtered and sorted | [Realms and sub-realms](/platform/realms/sub-realms/) |
| `POST` | `https://foobar.cvyuh.com/api/v0/am/global/realms/v1` | Create a realm: `name`, `parentPath`, `hostnames`, and its first administrator's `password` and `mailId`. `202`, with `Location` and `ETag` | [Realms and sub-realms](/platform/realms/sub-realms/#set-it-up) |
| `GET` | `https://foobar.cvyuh.com/api/v0/am/global/realms/v1/{realmId}` | One realm, with its `status`, and its setup's `progress`, `code` and `reason` | [Realms and sub-realms](/platform/realms/sub-realms/#set-it-up) |
| `PATCH` | `https://foobar.cvyuh.com/api/v0/am/global/realms/v1/{realmId}` | Suspend or reactivate it (`status`, with `?subrealms=true` to carry the realms beneath), or replace its `hostnames`, one at a time | [Realms and sub-realms](/platform/realms/sub-realms/#set-it-up), [Host names](/platform/realms/hostnames/#set-it-up) |
| `DELETE` | `https://foobar.cvyuh.com/api/v0/am/global/realms/v1/{realmId}` | Delete it for good, with `If-Match` (`?subrealms=true` to take the realms beneath). `200` | [Realms and sub-realms](/platform/realms/sub-realms/#deleting-a-realm) |
| `POST` | `https://foobar.cvyuh.com/api/v0/am/global/realms/v1/{realmId}/resume` | Carry on a setup that stopped, from the first step it didn't finish. `202` | [Realms and sub-realms](/platform/realms/sub-realms/#set-it-up) |
| `POST` | `https://foobar.cvyuh.com/api/v0/am/global/realms/v1/{realmId}/reconcile` | Run an active realm's setup again, making only what's missing. Its administrator, host names and status stay as they are | [Realms and sub-realms](/platform/realms/sub-realms/) |

## Delegated administration

Each call needs `DELEGATE` on the realm's delegation configuration.

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `GET` | `https://foobar.cvyuh.com/api/v0/am/privilege/v1` | Every privilege in the realm, and the groups that hold it | [Delegated administration](/platform/realms/delegated-administration/#set-it-up) |
| `POST` | `https://foobar.cvyuh.com/api/v0/am/privilege/v1` | Grant a privilege to a group: `{ "group", "privilege" }`. `201` | [Delegated administration](/platform/realms/delegated-administration/#set-it-up) |
| `DELETE` | `https://foobar.cvyuh.com/api/v0/am/privilege/v1/{group}?privilege={privilege}` | Take a privilege back from a group | [Delegated administration](/platform/realms/delegated-administration/#set-it-up) |
| Any | `https://foobar.cvyuh.com/api/v0/am/objects/v1/delegationPermission` | Permission templates of your own, read and written as objects | [Roles of your own](/platform/realms/delegated-administration/#roles-of-your-own) |
| Any | `https://foobar.cvyuh.com/api/v0/am/objects/v1/delegationPrivilege` | Privileges of your own, read and written as objects | [Roles of your own](/platform/realms/delegated-administration/#roles-of-your-own) |

## Keys

Each call needs `MODIFY` on the realm's `keySettings`. Every key change is recorded on the audit trail, never the key.

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `GET` | `https://foobar.cvyuh.com/api/v0/am/keys/v1` | Every version of the signing, internal signing and storage keys: `key`, `version`, `alg`, `state`, `validFrom` | [Signing keys](/platform/keys/signing-keys/#set-it-up) |
| `PUT` | `https://foobar.cvyuh.com/api/v0/am/keys/v1/signing` | Rotate one algorithm's signing key: `{ "algorithm", "validFrom" }`. `204` | [Rotate signing keys](/platform/guides/rotate-signing-keys/) |
| `PUT` | `https://foobar.cvyuh.com/api/v0/am/keys/v1/signing/imported` | Import a signing key and its certificate chain. `204` | [Bring your own key](/platform/keys/bring-your-own-key/#set-it-up) |
| `DELETE` | `https://foobar.cvyuh.com/api/v0/am/keys/v1/signing/{version}` | Revoke a signing key version. `204` | [Revoke a signing key](/platform/guides/revoke-a-signing-key/) |
| `PUT` | `https://foobar.cvyuh.com/api/v0/am/keys/v1/cluster-local` | Rotate the internal signing key, which signs only tokens that never leave Cvyūh. You never need to. `204` | [The internal signing key](/platform/keys/signing-keys/#the-internal-signing-key) |
| `DELETE` | `https://foobar.cvyuh.com/api/v0/am/keys/v1/cluster-local/{version}` | Revoke an internal signing key version. `204` | [The internal signing key](/platform/keys/signing-keys/#the-internal-signing-key) |
| `PUT`, `GET`, `DELETE` | `https://foobar.cvyuh.com/api/v0/am/keys/v1/{key}` | Another of the realm's keys by name, such as `secrets/encryption`: rotate it, read it at `?version=`, or shred it with `?shred=true` | [Crypto-shredding](/secrets-store/keys-and-protection/crypto-shredding/) |
| `GET`, `PATCH` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/keySettings/keySettings` | The publish lead, clock skew, key-set cache time and the algorithms on offer | [Signing keys](/platform/keys/signing-keys/#limits-and-defaults) |
| `GET` | `https://foobar.cvyuh.com/oauth2/jwks` | The published key set: the public signing keys and the request-object encryption key. Public | [Check what clients discover](/platform/guides/what-clients-discover/) |
| `GET` | `https://foobar.cvyuh.com/.well-known/oauth-authorization-server/oauth2` | The realm's authorization server metadata. Public | [Check what clients discover](/platform/guides/what-clients-discover/) |
| `GET` | `https://foobar.cvyuh.com/oauth2/.well-known/openid-configuration` | The realm's OpenID Connect discovery document. Public | [Check what clients discover](/platform/guides/what-clients-discover/) |

## Host names and base URL

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `PATCH` | `https://foobar.cvyuh.com/api/v0/am/global/realms/v1/{realmId}` | Replace a realm's host names: `{ "hostnames": [...] }`, as an administrator of its parent | [Host names](/platform/realms/hostnames/#set-it-up) |
| `POST` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/baseUrl?id=baseUrl` | Set the realm's base URL | [Realm base URL](/platform/realms/realm-base-url/#set-it-up) |
| `PATCH` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/baseUrl/baseUrl` | Change it | [Realm base URL](/platform/realms/realm-base-url/#set-it-up) |

## Data

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `GET` | `https://foobar.cvyuh.com/api/v0/am/types/v1/{type}` | An object type's schema, with the fields it seals (`x-encrypt`) or hashes (`x-hash`) | [Encryption of stored data](/platform/data/encryption/#set-it-up) |
| `PUT` | `https://foobar.cvyuh.com/api/v0/am/types/v1/{type}` | Change it, to seal or hash a field of your own. Needs `MODIFY` on that type | [Encryption of stored data](/platform/data/encryption/#set-it-up) |

## Cross-origin calls

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `GET`, `PUT` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/corsSettings/corsSettings` | The origins whose pages may call the realm, each with or without `credentials` | [Allowed origins](/platform/cross-origin/allowed-origins/#set-it-up) |
| `OPTIONS` | Any endpoint above | The preflight a browser sends before a cross-origin write | [Allowed origins](/platform/cross-origin/allowed-origins/#how-it-works) |
