# Get rental network activity

> GET /v1/rentals/{rental_id}/network/activity. The rental's own outbound traffic as its host's agent reported it over the last 24 hours of stored windows (at most 5000 windows are summed: truncated…

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

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

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

The rental's own outbound traffic as its host's agent reported it over the last 24 hours of
stored windows (at most 5000 windows are summed: `truncated` says when more existed, and then
the newest are the ones summed): `counters` are the sums of the rental's counters (`would_deny`,
`egress_drops`, `dns_blocked` and the rest; absent counters are `0`), `denied_names` the 20
names the allow-list denied or would have denied most often (the reason is `would_deny` in
`audit` mode, `blocked` when refused, or the proxy's `sni_not_allowed`, `host_not_allowed`,
`sni_ip_mismatch`, `no_sni`) and `denied_destinations` the 20 destinations dropped most often. Each window lists at most 20 of each, so a count is a lower bound.

Privacy. Destinations the host's own blocked ranges refused (`denied_cidr`) are collapsed into
one row whose `reason` is `blocked_by_host` and which has no address, port or protocol: the
provider's networks are not shown to the renter. Nothing about the host or its provider is
on this response. Abuse flags and the reasons that only describe abuse detection (`mining_pool`,
`dns_tunnel`) are never shown to a renter, and a reason Legion does not know is left out. Only the rental's own traffic is counted, never another rental's.

`last_window_end` is the end of the newest window Legion holds for the rental (any age),
so a quiet rental can be told from one whose host stopped reporting; absent when the host has
never reported one. Nothing is stored for a rental whose agent has no `egress_audit_v1`, and
every list is then empty. At most 60 requests a minute per organization (`429` `rate_limited`
with `Retry-After`). Needs `rentals.manage`; another organization's rental is `404`.

## Path parameters

- `rental_id`, string (uuid), required

## Responses

### 200

The rental's network activity.

- `rental_id`, string (uuid), required
- `since`, string (date-time), required: Start of the period summed (24 hours before `until`).
- `until`, string (date-time), required: When the answer was read.
- `last_window_end`, string (date-time): End of the newest window Legion holds for the rental, of any age. Absent until the host reports one.
- `windows`, integer, required: How many stored windows ended in the period and are summed here.
- `truncated`, boolean, required: True when more than 5000 windows ended in the period; the newest 5000 are summed.
- `counters`, RentalNetworkCounters, required: Packets or connections dropped in the window, by reason. An absent counter is zero. Later agents may send counters this version does not know; they are ignored.
  - `new_conn_drops`, integer (int64): New connections over the per-rental rate limit.
  - `ct_quota_drops`, integer (int64): New connections over the per-rental tracked-connection quota.
  - `udp_drops`, integer (int64): UDP packets over the per-rental packet-rate limit.
  - `smtp_drops`, integer (int64): Outbound connections to TCP port 25.
  - `spoof_drops`, integer (int64): Packets from the rental with a source address outside its network.
  - `private_drops`, integer (int64): Packets to private, link-local, loopback, multicast or reserved addresses.
  - `host_drops`, integer (int64): Packets from the rental to the host itself.
  - `inbound_drops`, integer (int64): New connections into the rental that did not come through Legion.
  - `ipv6_drops`, integer (int64): IPv6 packets to or from the rental.
  - `invalid_drops`, integer (int64): Packets connection tracking cannot place (INVALID state).
  - `dns_drops`, integer (int64): DNS queries to the host's resolvers over the per-rental query-rate limit.
  - `would_deny`, integer (int64): New connections the allow-list would have blocked, allowed anyway in `audit` mode (`egress_audit_v1`).
  - `new_connections`, integer (int64): New outbound connections to public addresses, the denominator of the would-deny rate.
  - `egress_drops`, integer (int64): New connections to destinations the allow-list does not hold, dropped in `enforce` mode.
  - `quic_drops`, integer (int64): QUIC (UDP 443) packets dropped so clients fall back to TCP.
  - `dot_drops`, integer (int64): DNS-over-TLS or QUIC (port 853) packets dropped, in every mode.
  - `denied_cidr_drops`, integer (int64): Packets to the host's blocked ranges (`denied_cidrs`).
  - `dns_bypass_drops`, integer (int64): DNS packets that tried to leave without passing the agent's resolver.
  - `isolated_drops`, integer (int64): Packets dropped because Legion isolated the rental.
  - `dns_queries`, integer (int64): DNS queries the rental made to the agent's resolver.
  - `dns_blocked`, integer (int64): Queries the resolver refused.
  - `dns_servfail`, integer (int64): Queries the resolver answered SERVFAIL (upstream failure, or a pin it could not install).
  - `proxy_denied`, integer (int64): Proxied connections the SNI/Host check denied (`egress_enforce_v1`).
  - `proxy_cap_drops`, integer (int64): Proxied connections refused over the proxy's caps.
  - `proxy_dial_errors`, integer (int64): Proxied connections whose destination could not be dialled.
- `denied_names`, array of NetworkDeniedName, required: The names denied or that would have been denied most often, by count, then name.
  - `name`, string, required: A DNS name or a leading-wildcard zone, as the agent's resolver saw it: lowercase, no trailing dot, internationalized names in their `xn--` form, labels of `a-z`, `0-9`, `-` and `_`. A name renters' code chose is untrusted, so Legion keeps only names in that form (it applies IDNA and lowercases first) and drops the others from the window, counting them, instead of refusing the sync.
  - `reason`, string, required
  - `count`, integer (int64), required
- `denied_destinations`, array of RentalActivityDestination, required: The destinations dropped most often, by count, with at most one row `blocked_by_host`.
  - `address`, string (ipv4)
  - `port`, integer
  - `protocol`, string
  - `reason`, string, required: `private`, `smtp`, `would_deny`, `not_allowed`, `sni_not_allowed`, `host_not_allowed`, `sni_ip_mismatch`, `no_sni`, or `blocked_by_host`.
  - `count`, integer (int64), required

Example:

```json
{
  "rental_id": "0192f1a2-7c3d-7e4f-8a9b-0c1d2e3f4a5b",
  "since": "2026-10-15T12:00:00Z",
  "until": "2026-10-15T12:00:00Z",
  "last_window_end": "2026-10-15T12:00:00Z",
  "windows": 0,
  "truncated": false,
  "counters": {
    "new_conn_drops": 0,
    "ct_quota_drops": 0,
    "udp_drops": 0,
    "smtp_drops": 0,
    "spoof_drops": 0,
    "private_drops": 0,
    "host_drops": 0,
    "inbound_drops": 0,
    "ipv6_drops": 0,
    "invalid_drops": 0,
    "dns_drops": 0,
    "would_deny": 0,
    "new_connections": 0,
    "egress_drops": 0,
    "quic_drops": 0,
    "dot_drops": 0,
    "denied_cidr_drops": 0,
    "dns_bypass_drops": 0,
    "isolated_drops": 0,
    "dns_queries": 0,
    "dns_blocked": 0,
    "dns_servfail": 0,
    "proxy_denied": 0,
    "proxy_cap_drops": 0,
    "proxy_dial_errors": 0
  },
  "denied_names": [
    {
      "name": "string",
      "reason": "string",
      "count": 1
    }
  ],
  "denied_destinations": [
    {
      "address": "203.0.113.7",
      "port": 0,
      "protocol": "string",
      "reason": "string",
      "count": 1
    }
  ]
}
```

### 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/rentals/$RENTAL_ID/network/activity" \
  -H "Authorization: Bearer $LEGION_API_KEY"
```
