# Get network

URL: https://docs.hanzo.ai/docs/openapi/network/get-network-by-id

> Returns one overlay network by id, scoped to the caller's org.

`GET /v1/network/{id}`

> [Network →](https://docs.hanzo.ai/docs/openapi/network) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/network/{id}` |
| **Method**    | `GET`                                  |
| **Operation** | `get_network_by_id`                    |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Returns one overlay network by id, scoped to the caller's org.

The org has exactly one overlay network and its id is derived from the org, so
any other id — another tenant's, or one that does not exist — is 404 rather than
a peek across the tenant boundary. An org whose network exists but has no
edge-routers is 404 too, for the same reason the list is empty: there is no
overlay until something is on it.

## Request

1 field.

| Field | In   | Type   | Required | Description                         |
| ----- | ---- | ------ | -------- | ----------------------------------- |
| `id`  | path | string | yes      | ID is the network id from the path. |

## Response

| Status    | Body                | Meaning |
| --------- | ------------------- | ------- |
| `200`     | network.networkView | ok      |
| `default` | problem-details     | refused |

`200` body — 4 fields.

| Field    | In   | Type            | Always | Description                                                                                                                                |
| -------- | ---- | --------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`     | body | string          | —      | ID is the org-derived id of the overlay network — the key GET /v1/network/{id} addresses.                                                  |
| `name`   | body | string          | —      | Name is the org the overlay belongs to.                                                                                                    |
| `nodes`  | body | integer (int64) | —      | Nodes is how many edge-routers the org has on the fabric.                                                                                  |
| `status` | body | string          | —      | Status is "connected" once at least one of the org's edge-routers is online, else "provisioning" (routers exist but none has dialed home). |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo network get <id>
```

**SDK**

**.ts**

```ts
import { Configuration, NetworkApi } from 'hanzoai';

const api = new NetworkApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getNetworkById({ id: 'id' });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import NetworkApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = NetworkApi(client).get_network_by_id(id='id')
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.NetworkAPI.GetNetworkById(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, network_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = network_api::get_network_by_id(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.NetworkApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new NetworkApi(client).getNetworkById();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/network/<id> \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `network`, op `get_network_by_id` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "network",
         "arguments": {
           "op": "get_network_by_id",
           "input": {
             "id": "<id>"
           }
         }
       }
     }'
```

---

[Network API](https://docs.hanzo.ai/docs/openapi/network) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
