---
title: "getNetworkPolicy"
---

> Documentation Index
> Fetch the complete documentation index at: https://agenthold.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# getNetworkPolicy

Path: agenthold API › egress

`GET /agents/{agentId}/network-policy`

URL: `/api/v1/agents/{agentId}/network-policy`

## Authentication

Requires one of the following:

- `session`, apiKey, in cookie
- `token`, http bearer, header `Authorization`

## Path parameters

- `agentId` (`getNetworkPolicy.path.agentId`; string, required)

## Code samples

### cURL

```bash
curl --request GET \
  --url '<base-url>/api/v1/agents/<agentId>/network-policy' \
  --cookie 'agenthold_session=<agenthold_session>'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/agents/<agentId>/network-policy';
const options = {
  method: 'GET',
  headers: {cookie: 'agenthold_session=<agenthold_session>'}
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/api/v1/agents/<agentId>/network-policy"

headers = {"cookie": "agenthold_session=<agenthold_session>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

The agent's network policy.

#### Example

```json
{
  "mode": "open",
  "allow": [
    "string"
  ]
}
```

- `mode` (`getNetworkPolicy.response.200.mode`; string, required)
  - one of `"open"`, `"allowlist"`
- `allow` (`getNetworkPolicy.response.200.allow`; array of string, required) — Entries like "github.com", "*.npmjs.org", "github.com:22", "host:*", "1.2.3.0/24:443". Without a port: 80 and 443.

### 404

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`getNetworkPolicy.response.404.error`; string, required)


Source: https://agenthold.dev/api/get-network-policy/index.md
