# Egress

A site's code can send a request only to the hostnames on its egress list.
A new site has an empty list, so its code can send no request at all.

This is about `fetch()` from the site's own code. Pages, forms, payments
and mail do not need the list.

## Read the list

`GET /v1/sites/{id}/egress`

```json
{ "hosts": ["api.example.com"] }
```

## Change the list

The list is `egress` in the site's `clave.site.json`, and a publish sets
it. Read [Site settings](/concepts/settings).

```json
{ "egress": ["api.example.com", "hooks.example.org"] }
```

- Give hostnames only: no `https://`, no path, no port, no `*`.
- A name matches exactly. `example.com` does not let code reach
  `api.example.com`.
- A site can name at most 20 hostnames.
- An empty list removes every host.

A draft has its own list, from the file on its slot.

A request to a host that is not on the list gets a `403` in the site's
code, with a message that names the host.

---

## Where this page sits

This is one page of the Clave documentation.
Read it as a web page at https://docs.heyclave.com/api/egress.
Every page has a `.md` address, and https://docs.heyclave.com/llms.txt lists them all.

- Previous: [Logs](https://docs.heyclave.com/api/logs.md)
- Next: [Store](https://docs.heyclave.com/api/store.md)
- Index: [Overview](https://docs.heyclave.com/index.md)
