# Get rental network

> GET /v1/rentals/{rental_id}/network. What the rental can reach and whether its host's agent has applied it.

Source: https://legion.ambient.xyz/docs/api/rentals/get-rental-network

`GET https://api.legion.ambient.xyz/v1/rentals/{rental_id}/network`

Authenticate with an API key: `Authorization: Bearer $LEGION_API_KEY`.

What the rental can reach and whether its host's agent has applied it. `revision` increases
whenever anything that changes what the rental may reach changes (the platform's allow-list,
the organization's policy, the host's blocked ranges, the platform's limits); `enforcement`
is `applied` once the agent reports that revision, `pending` until then, and `unsupported`
when the host's agent cannot apply network policies. `egress.entries` lists every
destination the allow-list holds with the source that granted it. In `audit` mode everything
public stays reachable and the allow-list records what would be blocked; private networks
and email port 25 are always blocked. `egress.enforce_cutover_at` is the date a rental in
`audit` starts enforcing. The allow-list is abuse control: it does not stop data
leaving through the sites on it. Needs `rentals.manage`.

## Path parameters

- `rental_id`, string (uuid), required

## Responses

### 200

The rental's network policy.

- `revision`, integer (int64), required: Increases whenever anything that changes what the rental may reach changes.
- `applied_revision`, integer (int64): The revision the host's agent last reported installed. Absent until it reports one.
- `enforcement`, NetworkEnforcement, required: `pending`: the host's agent supports network policies but has not reported this rental yet, or has not yet installed its current policy revision. `applied`: the agent reported the rental's rules installed and verified, at the current revision when the agent applies revisions (`egress_audit_v1`). `failed`: the agent could not install them; its previous isolation rules stay in force. Also a rental held to the allow-list (`enforce`) on a host whose agent no longer advertises `egress_enforce_v1`, whatever the agent reported: it is not enforced (`error` says so). `unsupported`: the host's agent predates what was asked: for a renter's `getRentalNetwork`, an agent without `egress_audit_v1`, which cannot apply the allow-list and keeps only the older isolation rules; for Legion read of the baseline, an agent without `network_policy_v1`.
- `error`, string: Why the agent could not install the policy, when `enforcement` is `failed`.
- `isolated`, boolean, required: Legion cut this rental's network. SSH and the web terminal still work.
- `inbound`, RentalInbound, required: Inbound reachability. SSH and the web terminal always reach a rental; any other port only through a service (`listServices` with `rental_id` lists the rental's services, `createService` with mode `rental` adds one).
  - `ssh`, boolean, required: SSH and the web terminal reach the rental. Always true.
  - `available`, boolean, required: Whether a service on one of the rental's ports may be created now (the edge is live and the platform's and the organization's switches are on).
  - `unavailable_reason`, string: Present when `available` is false. `edge_not_live`: the edge is not serving yet. `platform_disabled`: exposure is paused across Legion. `org_disabled`: it is turned off for the organization.
  - `suspended`, string: Present when something withholds the rental's services from the internet right now: the platform's switch, the organization's, or Legion's isolation of the rental.
- `egress`, EgressAllowlist, required
  - `mode`, EgressMode, required: `audit`: everything public is reachable; what the allow-list would block is recorded. `enforce`: only the allow-list is reachable. `open`: no allow-list (set by Legion for an organization, with a recorded reason). Private networks and email port 25 are blocked in every mode.
  - `entries`, array of EgressEntry, required: Sorted by kind, then pattern, then source.
    - `kind`, EgressKind, required: `domain`: a host name (`example.com`) or `*.example.com` for every subdomain, never a public suffix. Lowercase, with internationalized names in their `xn--` form. `cidr`: an IPv4 range in canonical form (`203.0.113.0/24`), never inside private or reserved space.
    - `pattern`, string, required
    - `ports`, EgressPorts, required: TCP ports, at most 8.
    - `source`, string, required: Who granted the destination.
    - `category`, EgressCategory: What the destination is for.
    - `expires_at`, string (date-time): When an approval ends. Absent for the platform's defaults and for approvals without an expiry.
  - `pending_requests`, integer: How many egress requests are waiting for review that would add to this list (the organization's, and for a rental also the rental's).
  - `enforce_cutover_at`, string (date-time): When rentals that run in `audit` switch to `enforce` (decision D2). Present only while the platform's enforcement of new rentals is on and the date is set; a rental whose `mode` is `audit` shows it as the dated notice.
  - `org_egress_mode`, OrgEgressMode: The organization's own egress mode: `enforce` when its new rentals are held to the allow-list, `inherit` when they start in the platform's default. On `getEgressAllowlist` and `updateOrgEgressMode` only, never on a rental's network.
  - `org_egress_mode_set_by`, OrgEgressModeSetBy: Who set `org_egress_mode`: `owner` (an owner, with `updateOrgEgressMode`) or `admin` (Legion staff; an owner cannot change it). Absent while the mode is `inherit`.

Example:

```json
{
  "revision": 0,
  "applied_revision": 0,
  "enforcement": "pending",
  "error": "string",
  "isolated": false,
  "inbound": {
    "ssh": false,
    "available": false,
    "unavailable_reason": "edge_not_live",
    "suspended": "platform_disabled"
  },
  "egress": {
    "mode": "audit",
    "entries": [
      {
        "kind": "domain",
        "pattern": "string",
        "ports": [
          1
        ],
        "source": "platform",
        "category": "code",
        "expires_at": "2026-10-15T12:00:00Z"
      }
    ],
    "pending_requests": 0,
    "enforce_cutover_at": "2026-10-15T12:00:00Z",
    "org_egress_mode": "inherit",
    "org_egress_mode_set_by": "owner"
  }
}
```

### 400

The request is malformed or fails validation. An image reference that
is not a container image reference answers `invalid_image_reference`.

### 401

Missing, unknown, expired or revoked credentials.

### 403

The caller lacks the permission this operation requires (`forbidden`),
or signed in without having joined an organization yet
(`no_organization`; `getOnboarding` and the invitation and
organization operations under it work), or could not sign in
(`email_unverified`, `account_conflict`, and `domain_not_allowed`). `not_invited` is no longer returned to
session tokens.

`access_not_approved`: a signed-in person who is not approved
for the beta yet. Every operation that takes a credential answers it to
them, except `getMe` and `joinMyWaitlist`; the problem carries
`access` (`waitlisted` or `not_requested`, and the email). Approved
means a member of an organization, holding a pending invitation, or Legion; an API key always belongs to a member.

`oauth_token_mcp_only`: the caller sent an OAuth access token (`lgo_`), which is accepted
only by `mcpMessage` and the tool calls it dispatches. Every other operation answers it, whatever
the token's scope. Use an API key or the Legion web app.

`org_suspended`: the caller's organization is suspended. Every operation that takes a
credential answers it, by session or API key, except `getMe` (which shows `org.suspended_at` and
`org.suspension_reason`) and the support operations under `/v1/support/`.

`terms_not_accepted`: an approved caller who has not accepted
the current version of the Terms of Use and the Acceptable Use Policy. Every operation that takes a credential answers it, except `getMe`,
`acceptLegalDocuments`, `joinMyWaitlist` and the wind-down operations
(`listRentals`, `stopRental`, `deleteRental`, `listHosts`,
`updateListing` with `listed` false, `removeHost`); the problem
carries `legal`. An API key acts for the person who created it, so it
is refused until that person accepts. Terminal
operations also return
`session_required` (called with an API key) and `step_up_required`
(neither a sign-in nor a step-up challenge within the step-up window).

### 404

The resource does not exist or belongs to another organization.

### 500

An unexpected server error. Safe to retry.

## Errors

- 403 [`no_organization`](https://legion.ambient.xyz/docs/errors#no_organization)

## Example request

```sh
curl -s "https://api.legion.ambient.xyz/v1/rentals/$RENTAL_ID/network" \
  -H "Authorization: Bearer $LEGION_API_KEY"
```
