# Egress

6 endpoints at `https://api.kosa8.com`, sent with `Authorization: Bearer $KOSA8_API_KEY`. Generated from the API's own [OpenAPI description](https://api.kosa8.com/openapi.json), which a test holds to the router.

## Named sets of package-registry hosts for egress allow lists[#]

GET`/v1/egress/presets`scope sandboxes:read

Responses

200401403

```
curl -s -X GET https://api.kosa8.com/v1/egress/presets \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## The egress policy the sandbox runs with[#]

GET`/v1/sandboxes/{id}/egress`scope sandboxes:read

Parameters

`id`requiredpath · string

Sandbox id (sbx_…)

Responses

200401403404

```
curl -s -X GET https://api.kosa8.com/v1/sandboxes/$SBX/egress \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Change what the sandbox may reach, at once (a sleeping one when it wakes)[#]

PUT`/v1/sandboxes/{id}/egress`scope sandboxes:write

Inside the organization's policy when it enforces one (403 egress_not_allowed otherwise). Connections the new policy refuses stop at their next packet.

Parameters

`id`requiredpath · string

Sandbox id (sbx_…)

JSON body

`internet`boolean

false: nothing leaves but what allow and presets name. Default true when nothing is listed

`allow`array of string

Hostnames (exact), *.domain wildcards (any depth below, not the domain), IPv4 addresses or CIDRs

`deny`array of string

Refused even where allow covers them. A name is refused at DNS; a CIDR for every packet

`presets`array of "common" | "npm" | "pypi" | "github" | "go" | "crates" | "rubygems" | "maven" …

—

Responses

200400401403404409501502

```
curl -s -X PUT https://api.kosa8.com/v1/sandboxes/$SBX/egress \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## Back to the organization's default[#]

DELETE`/v1/sandboxes/{id}/egress`scope sandboxes:write

Parameters

`id`requiredpath · string

Sandbox id (sbx_…)

Responses

200401403404501502

```
curl -s -X DELETE https://api.kosa8.com/v1/sandboxes/$SBX/egress \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## The organization's egress default and whether it is enforced[#]

GET`/v1/org/egress`scope sandboxes:read

Responses

200401403

```
curl -s -X GET https://api.kosa8.com/v1/org/egress \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Set the organization's egress default (enforce: true makes it a ceiling); pushed to running and sleeping sandboxes[#]

PUT`/v1/org/egress`scope admin

JSON body

`default`requiredobject | null

—

`enforce`boolean

—

Responses

200400401403409

```
curl -s -X PUT https://api.kosa8.com/v1/org/egress \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

---
Source: https://docs.kosa8.com/api/egress/
