# Protect APIs

> Run the gateway in front of an API, so every request is checked for its token, revocations and policies before your API sees it.

You run the gateway beside your API, and callers call the gateway instead. It verifies each caller's token against the
realm's keys, refuses anything the realm has revoked, decides the request against your policies, and forwards only an
allow, with the verified caller named in a header your API can trust. A refused caller is told what would help: where
to get a token, which scopes would pass, or that a stronger sign-in is needed.

Tokens can be held tighter still. A token bound to a key or a certificate is taken only from the client that holds it,
and with token swap your API receives a fresh token meant for it alone, never the caller's.

<Aside type="caution" title="The gateway's image isn't published yet">
  Ask your Cvyūh contact for the gateway's container image. Everything in this area works once you run it.
</Aside>

<CardGrid>
  <LinkCard title="Run the gateway" description="What every request goes through, inline or behind your proxy." href="/gateway/protect-apis/run-the-gateway/" />
  <LinkCard title="Run it in production" description="Replicas, health probes, stopping, and what holds while the realm is out of reach." href="/gateway/protect-apis/run-in-production/" />
  <LinkCard title="Requests and refusals" description="What callers see when refused, and what your API receives when not." href="/gateway/protect-apis/requests-and-refusals/" />
  <LinkCard title="Bound tokens at the gateway" description="A copied token is useless without the key or certificate it's bound to." href="/gateway/protect-apis/bound-tokens/" />
  <LinkCard title="Token swap" description="Each API gets a token meant for it alone." href="/gateway/protect-apis/token-swap/" />
</CardGrid>

## Capabilities

### Put the gateway in the path

| Capability | What it gives you |
|---|---|
| [Run the gateway](/gateway/protect-apis/run-the-gateway/) | A proxy in front of your API that checks, decides and only then forwards (with limits: HTTP/1.1 behind your TLS front end, one API per gateway, fixed timeouts) |
| [Behind your own proxy](/gateway/protect-apis/run-the-gateway/#inline-or-behind-your-proxy) | An external-authorization check your existing proxy calls, with the same verdict |
| [Token checks offline](/gateway/protect-apis/run-the-gateway/#what-each-request-goes-through) | Every token verified against the realm's keys, with no call per request |
| [Revocations honored](/gateway/protect-apis/run-the-gateway/#what-each-request-goes-through) | Revoked tokens, stopped agents and taken-back delegations refused within one poll |
| [Groups asked of the realm](/gateway/protect-apis/run-the-gateway/#good-to-know) | A policy about the caller's groups is decided by the realm, never guessed |
| [Gateway configuration](/gateway/configuration/) | Every setting, from the environment, with its default |
| [Run it in production](/gateway/protect-apis/run-in-production/) | A container you run beside your API, as many replicas as you need (with limits: the image isn't published yet, and there's no packaged deployment) |

### Tell callers what would help

| Capability | What it gives you |
|---|---|
| [Requests and refusals](/gateway/protect-apis/requests-and-refusals/) | A refusal says where to sign in and which scopes would pass |
| [Resource metadata](/gateway/protect-apis/requests-and-refusals/#resource-metadata) | Clients find which realm protects the API, and where to sign in |
| [Step-up](/gateway/protect-apis/requests-and-refusals/#what-callers-see) | A request that needs a stronger sign-in is told so, and the app asks the user |
| [Verified caller header](/gateway/protect-apis/requests-and-refusals/#what-your-api-sees) | Your API reads the verified caller from `x-agent-id`, which a client can't forge |
| [Safe paths](/gateway/protect-apis/requests-and-refusals/#good-to-know) | A path your API might read differently is refused before anything else |

### Keep tokens where they belong

| Capability | What it gives you |
|---|---|
| [Bound tokens at the gateway](/gateway/protect-apis/bound-tokens/) | A token bound to a key is taken only with a fresh proof from that key |
| [Certificate-bound tokens](/gateway/protect-apis/bound-tokens/#certificate-bound-tokens) | A token bound to a client certificate is taken only over that certificate |
| [Token swap](/gateway/protect-apis/token-swap/) | Each allowed call goes on under a token meant for its API, never the caller's (with limits: one API per gateway) |

The gateway is a container you run yourself; there's no hosted gateway, and its image isn't published yet.

## Coming next

See [What's next for protecting APIs](/gateway/protect-apis/whats-next/):

- [A published image](/gateway/protect-apis/whats-next/#a-published-image), to pull and run without asking.
- [Tokens from other issuers](/gateway/protect-apis/whats-next/#tokens-from-other-issuers), verified directly.
- [Agent-to-agent calls](/gateway/protect-apis/whats-next/#agent-to-agent-calls), checked and decided like any other.
- [Gateway decisions on the audit trail](/gateway/protect-apis/whats-next/#gateway-decisions-on-the-audit-trail).

## Guides

- [Get started with Gateway](/gateway/get-started/)
- [Open an API to agents](/gateway/guides/open-an-api-to-agents/)
- [Put the gateway behind your proxy](/gateway/guides/put-the-gateway-behind-your-proxy/)
- [Check a token at your API](/gateway/guides/check-a-token-at-your-api/)
- [Bind tokens to a key](/workforce-identity/guides/services/bind-tokens-to-a-key/)
