# Gateway API

> Every endpoint behind the gateway and enforcement points, on the realm's host and on the gateway itself, by area.

Every endpoint the gateway and your own enforcement points use. The realm serves the first
four sections on its own host, `https://foobar.cvyuh.com`; the gateway serves the last on its own address.

Each part takes its own credential:

- **Admin calls** (`/api/v0/am/…`) take a realm administrator's session, as `Cookie: x-cvyuh-token=$CVYUH_SESSION`:
  see [Call the API](/develop/api/).
- **Enforcement calls** (`/policies/v1`, `/access/v1`) take a bearer access token whose audience is the group they
  sit in, with the scope each row names. `/access/v1` also takes an administrator's session.
- **OAuth calls** (`/oauth2/…`) take the calling client's own credentials, as their standards say.

## Policies and revocations

For an enforcement point that [decides locally](/gateway/decisions/decide-locally/). Audience
`https://foobar.cvyuh.com/policies/v1`. Both answer an `ETag`, and `304` to an `If-None-Match` that still holds.

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `GET` | `https://foobar.cvyuh.com/policies/v1/export?policySet={set}` | The set's active policies, comparators and `acr` values; `policySet` repeats, and with none every set comes back. Header `X-Policies-Excluded` counts what was left out. Scope `policies:read` | [Decide locally](/gateway/decisions/decide-locally/) |
| `GET` | `https://foobar.cvyuh.com/policies/v1/revocations` | Every live revocation, in seven lists. Scope `revocations:read` | [Revocation feed](/gateway/revocation/revocation-feed/) |

## Decisions

For an enforcement point that [asks the realm](/gateway/decisions/ask-the-realm/), in the AuthZEN shape. Audience
`https://foobar.cvyuh.com/access/v1`. Each echoes an `x-request-id` header.

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `POST` | `https://foobar.cvyuh.com/access/v1/evaluation` | One decision. Scope `access:evaluate` | [Ask the realm](/gateway/decisions/ask-the-realm/) |
| `POST` | `https://foobar.cvyuh.com/access/v1/evaluations` | Several decisions, with `defaults` and `options.evaluations_semantic`. Scope `access:evaluate` | [Ask the realm](/gateway/decisions/ask-the-realm/) |
| `POST` | `https://foobar.cvyuh.com/access/v1/search/subject` | The users or agents a decision would allow, a page at a time. Scope `access:search` | [Search](/gateway/decisions/ask-the-realm/#search) |
| `POST` | `https://foobar.cvyuh.com/access/v1/search/action` | The actions a decision would allow. Scope `access:search` | [Search](/gateway/decisions/ask-the-realm/#search) |
| `GET` | `https://foobar.cvyuh.com/.well-known/authzen-configuration` | Where each decision and search endpoint is. Public | [Ask the realm](/gateway/decisions/ask-the-realm/) |

There is no resource search: `https://foobar.cvyuh.com/access/v1/search/resource` answers `404`.

## Tokens

The OAuth endpoints the gateway, your APIs and your agents call for the tasks on these pages.

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `POST` | `https://foobar.cvyuh.com/oauth2/token` | The gateway's own token (`client_credentials`), a [token swap](/gateway/protect-apis/token-swap/) (token exchange), and a held request collected (`urn:ietf:params:oauth:grant-type:deferred`) | [Token swap](/gateway/protect-apis/token-swap/), [Agent guardrails](/gateway/guardrails/agent-guardrails/) |
| `GET` | `https://foobar.cvyuh.com/oauth2/jwks` | The realm's public signing keys, to verify tokens with. Public | [Check a token at your API](/gateway/guides/check-a-token-at-your-api/) |
| `POST` | `https://foobar.cvyuh.com/oauth2/introspect` | Whether a token is active, for an API that serves its audience | [Check a token at your API](/gateway/guides/check-a-token-at-your-api/) |
| `POST` | `https://foobar.cvyuh.com/oauth2/revoke` | Revoke a token, its family, or a held request's code, by the client it was issued to | [Revoke a token](/gateway/guides/revoke-a-token/) |

## Settings in the realm

The admin objects these pages change. Every object is read and written the same way: see
[Call the API](/develop/api/).

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `PATCH` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Client/floor` | Give the gateway's client its key and resources, and activate it | [Run the gateway](/gateway/protect-apis/run-the-gateway/#set-it-up) |
| `POST` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Client?id={client}` | Register an enforcement point, an API or a calling service | [Decide locally](/gateway/decisions/decide-locally/#set-it-up) |
| `POST` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/policy?id={policy}` | Write a policy | [Get started with Gateway](/gateway/get-started/) |
| `POST` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/policy/{policy}/relationships/{policySet or resourceType}` | Link a policy to its set or its resource type, with `If-Match` | [Get started with Gateway](/gateway/get-started/) |
| `POST` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/resourceType?id={type}` | Create a resource type, such as the MCP types | [MCP tool calls](/gateway/mcp-servers/mcp-tool-calls/#set-it-up) |
| `POST` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/policySet?id={set}` | Create a policy set | [Protect an MCP server](/gateway/guides/protect-an-mcp-server/) |
| `PATCH` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/agentSettings/agentSettings` | Set the guardrails per risk class | [Agent guardrails](/gateway/guardrails/agent-guardrails/#set-it-up) |
| `PATCH` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/agent/{agent}` | Quarantine, kill or restore an agent | [What can be revoked](/gateway/revocation/what-can-be-revoked/#set-it-up) |
| `PATCH` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/user/{user}` | Set a user inactive, and every token about them with them | [What can be revoked](/gateway/revocation/what-can-be-revoked/#set-it-up) |
| `PATCH` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Settings/oauth2Settings` | Offer token exchange, the deferred grant, and status lists per API | [Token swap](/gateway/protect-apis/token-swap/#set-it-up) |

Policies themselves, every field and how a decision is reached, are on
[Policies](/workforce-identity/authorization/policies/).

## On the gateway

The gateway serves these at its own address (`LISTEN`, and `ADMIN_LISTEN` for the last table), not on the realm's
host. Here the API's audience is `https://api.example.com`, the address your TLS front end serves: the gateway itself
listens on plain HTTP/1.1 behind it. Its image isn't published yet: ask your Cvyūh contact for it.

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| Any | `https://api.example.com/{path}` | The inline proxy: decided, then forwarded to `BACKEND`, or refused | [Run the gateway](/gateway/protect-apis/run-the-gateway/) |
| Any | `https://api.example.com/ext_authz/{path}` | The check for a proxy of your own, with the request's host in `x-forwarded-host`: `200` with `x-agent-id`, or the refusal | [Put the gateway behind your proxy](/gateway/guides/put-the-gateway-behind-your-proxy/) |
| `POST` | `https://api.example.com/{MCP path}` | An MCP call, decided as the tool, resource or prompt it names, on a path in `MCP_PATHS` | [MCP tool calls](/gateway/mcp-servers/mcp-tool-calls/) |
| `GET` | `https://api.example.com/.well-known/oauth-protected-resource` | The API's resource metadata, followed by the audience's path when it has one. Public | [Resource metadata](/gateway/protect-apis/requests-and-refusals/#resource-metadata) |

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `GET` | `/health/live`, `/health/ready`, `/health/startup`, `/health/backends` | Health probes | [Health and logging](/gateway/configuration/#health-and-logging) |
| `GET`, `PUT` | `/admin/log` | Read or change the log level while it runs | [Health and logging](/gateway/configuration/#health-and-logging) |
| `PUT` | `/admin/log/filter` | Replace the whole log filter, when Cvyūh support asks you to | [Health and logging](/gateway/configuration/#health-and-logging) |
