# Get host network

> GET /v1/hosts/{host_id}/network. Whether the host's agent applies network policies and how far it has got, for the provider's own host: the agent's version and capabilities…

Source: https://legion.ambient.xyz/docs/api/hosts/get-host-network

`GET https://api.legion.ambient.xyz/v1/hosts/{host_id}/network`

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

Whether the host's agent applies network policies and how far it has got, for the provider's own
host: the agent's version and `capabilities`, `policy_supported` (the agent advertises
`egress_audit_v1`, so it can apply the allow-list), `running_rentals` (the host's running rentals
by network state: `applied`, `pending`, `failed`, or `unsupported` when the agent cannot apply
policies), `blocked_cidrs` (as on the host; `updateHostNetwork` changes them), the connection-tracking
table as the latest report left it (`conntrack`, absent until an agent reports it) and `abuse_flags`:
the abuse signals raised on rentals on this host in the last 24 hours (`since` to `until`), one row
per flag with how many rentals and windows raised it, when it was last raised, and up to 10 of the
rentals, most recently flagged first. The flags are the agent's own word (the provider controls the
host), they raise an alert for a human and nothing is penalized automatically.

Privacy. A rental is named only by its `rental_id`, which the provider already reads in its
earnings (`listLedgerEntries`, `getRentalEarnings`). The renter's organization, the renter, the
destinations and names the rental tried to reach and its counters are never on this response, and
no rental's edge hostname is. At most 60 requests a minute per organization
(`429` `rate_limited` with `Retry-After`). Needs `hosts.manage`; another organization's host is
`404`.

## Path parameters

- `host_id`, string (uuid), required

## Responses

### 200

The host's network state.

- `host_id`, string (uuid), required
- `agent_version`, string: The agent's version as of its last sync.
- `capabilities`, AgentCapabilities, required: Capabilities the host's agent reported on its last sync, for example `network_policy_v1`, `egress_audit_v1`, `egress_enforce_v1` (it enforces the allow-list), `ingress_v1` (it serves the ports a rental exposes through the Legion edge), `bench_v1` (it runs the network, latency and disk benchmarks), `bench_v2` (it also runs the GPU benchmark) or `disk_quota_v1` (it sends its disk status) or `serve_status_v1` (it reports the readiness of model services) or `preemption_notice_v1` (it gives a preempted rental the notice in `preempt_at`, 300 seconds) or `workspace_size_v1` (it measures workspaces, for an export's size and for disk use where limits are not enforced) or `delete_report_v1` (it reports failed deletes and reaps). Empty for an agent that reports none.
- `policy_supported`, boolean, required: Whether the agent advertises `egress_audit_v1`, so it can apply network policies.
- `running_rentals`, HostRentalNetworkStates, required: The host's running rentals by network state. `applied`: the agent installed the rental's current policy; `pending`: not yet reported, or reported at an older revision; `failed`: the agent reported it could not install it; `unsupported`: the agent cannot apply network policies.
  - `applied`, integer, required
  - `pending`, integer, required
  - `failed`, integer, required
  - `unsupported`, integer, required
- `blocked_cidrs`, array of string, required: IPv4 ranges no rental on this host can reach (`updateHostNetwork`). Sorted.
- `require_allowlist`, boolean, required: . Rentals created on this host start in `enforce` and can reach only the allow-list (`updateHostNetwork`). Rentals already running keep their mode.
- `conntrack`, HostConntrack: The host's connection-tracking table as the latest report left it. `HostNetwork.conntrack` is absent until an agent reports it.
  - `used`, integer (int64), required: Entries in the table.
  - `max`, integer (int64), required: The table's size.
  - `reported_at`, string (date-time), required
- `since`, string (date-time), required: Start of the period the abuse flags cover (24 hours before `until`).
- `until`, string (date-time), required: When the answer was read.
- `abuse_flags`, array of HostAbuseFlag, required: One row per abuse flag raised on rentals on this host in the period, most recently raised first.
  - `flag`, string, required: `flood`, `scan`, `mining_pool`, `mining_port`, `dns_tunnel`, `dns_flood`, or `other`.
  - `rentals`, integer, required: How many distinct rentals raised the flag in the period.
  - `windows`, integer, required: How many reported windows carried the flag.
  - `last_seen_at`, string (date-time), required: End of the newest window that carried it.
  - `rental_ids`, array of string (uuid), required: Up to 10 of the rentals, most recently flagged first.

Example:

```json
{
  "host_id": "0192f1a2-7c3d-7e4f-8a9b-0c1d2e3f4a5b",
  "agent_version": "string",
  "capabilities": [
    "string"
  ],
  "policy_supported": false,
  "running_rentals": {
    "applied": 0,
    "pending": 0,
    "failed": 0,
    "unsupported": 0
  },
  "blocked_cidrs": [
    "string"
  ],
  "require_allowlist": false,
  "conntrack": {
    "used": 0,
    "max": 1,
    "reported_at": "2026-10-15T12:00:00Z"
  },
  "since": "2026-10-15T12:00:00Z",
  "until": "2026-10-15T12:00:00Z",
  "abuse_flags": [
    {
      "flag": "string",
      "rentals": 1,
      "windows": 1,
      "last_seen_at": "2026-10-15T12:00:00Z",
      "rental_ids": [
        "0192f1a2-7c3d-7e4f-8a9b-0c1d2e3f4a5b"
      ]
    }
  ]
}
```

### 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.

### 429

Rate limited (`code` is `rate_limited`), or the organization asked the
pull-through mirror to copy in too many different tags or digests of one
repository today (`mirror_quota_exceeded`). Retry after the `Retry-After`
seconds.

### 500

An unexpected server error. Safe to retry.

## Errors

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

## Example request

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