> This page is for Self-Hosted, version v3.0 (default).
> For other versions, use one of these documentation indexes:
> - v3.0 (default): https://docs.nvidia.com/run-ai/self-hosted/v3.0/llms.txt
> - v2.26: https://docs.nvidia.com/run-ai/self-hosted/v2.26/llms.txt
> - v2.25: https://docs.nvidia.com/run-ai/self-hosted/v2.25/llms.txt
> - v2.24: https://docs.nvidia.com/run-ai/self-hosted/v2.24/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/run-ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/run-ai/_mcp/server.

# Create network topologies

POST http://localhost:8080/api/v1/network-topologies
Content-Type: application/json

Creates a network topology object based on the provided specification.

Reference: https://docs.nvidia.com/run-ai/self-hosted/reference/rest-api/endpoints/organizations/network-topologies/create-network-topology

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication

## Request

### Body (application/json)

This endpoint expects a NetworkTopologyCreateRequest.

- `clusterId` (string, required) — The id of the cluster.
- `levels` (list of string, required) — Ordered array of network topology levels
- `name` (string, required) — Name of the network topology

## Response

### 201

Created

- `clusterId` (string, required) — The id of the cluster.
- `createdAt` (datetime, required) — The timestamp for when the network topology was created
- `id` (string, required) — The unique identifier for the network topology
- `levels` (list of string, required) — Ordered array of network topology levels
- `name` (string, required) — Name of the network topology
- `tenantId` (integer, required) — The id of the tenant.
- `createdBy` (string, optional) — Identifier of the user who created the network topology
- `groveTopology` (NetworkTopologyGrove, optional) — The linked Grove topology definition. Null if no Grove topology has been linked to this network topology
- `nodePools` (list of string, optional, nullable) — List of node-pools associated with this network topology
- `phase` (string, optional) — Phase of the network topology in the cluster. Enum: Creating, Ready
- `source` (string, optional) — Identifier of the source of the topology. Useful for tracking where the topology data originated (e.g. control-plane, cluster).

## Errors

### 400 Bad Request Error

Bad request.

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 401 Unauthorized Error

Unauthorized

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 403 Forbidden Error

Forbidden

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 404 Not Found Error

The specified resource was not found

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 500 Internal Server Error

unexpected error

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 503 Service Unavailable Error

unexpected error

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

## Types

### NetworkTopologyGrove

The linked Grove topology definition. Null if no Grove topology has been linked to this network topology

- `name` (string, required) — Name of the linked Grove ClusterTopology
- `domains` (list of string, optional) — Topology levels defined in the linked Grove ClusterTopology
- `conditions` (list of NetworkTopologyGroveCondition, optional) — A list of conditions that describe the current state of the Grove ClusterTopology

### NetworkTopologyGroveCondition

- `type` (string, optional) — Type of the condition
- `status` (string, optional) — Status of the condition
- `reason` (string, optional) — Indicates the reason for the condition's last transition
- `message` (string, optional) — A human-readable message describing the condition
- `observedGeneration` (long, optional) — Generation of the topology observed when this condition was last updated

## Examples

**Request**

```json
{
  "clusterId": "71f69d83-ba66-4822-adf5-55ce55efd210",
  "levels": [
    "cloud.provider.com/topology-block",
    "cloud.provider.com/topology-rack",
    "kubernetes.io/hostname"
  ],
  "name": "default-topology"
}
```

**Response**

```json
{
  "clusterId": "71f69d83-ba66-4822-adf5-55ce55efd210",
  "createdAt": "2024-01-15T09:30:00Z",
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "levels": [
    "cloud.provider.com/topology-block",
    "cloud.provider.com/topology-rack",
    "kubernetes.io/hostname"
  ],
  "name": "default-topology",
  "tenantId": 1001,
  "createdBy": "user@lab.com",
  "groveTopology": {
    "name": "string",
    "domains": [
      "string"
    ],
    "conditions": [
      {
        "type": "string",
        "status": "string",
        "reason": "string",
        "message": "string",
        "observedGeneration": 1
      }
    ]
  },
  "nodePools": [
    "a100"
  ],
  "phase": "Ready",
  "source": "control-plane"
}
```

**SDK Code**

```python
import requests

url = "http://localhost:8080/api/v1/network-topologies"

payload = {
    "clusterId": "71f69d83-ba66-4822-adf5-55ce55efd210",
    "levels": ["cloud.provider.com/topology-block", "cloud.provider.com/topology-rack", "kubernetes.io/hostname"],
    "name": "default-topology"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'http://localhost:8080/api/v1/network-topologies';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"clusterId":"71f69d83-ba66-4822-adf5-55ce55efd210","levels":["cloud.provider.com/topology-block","cloud.provider.com/topology-rack","kubernetes.io/hostname"],"name":"default-topology"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:8080/api/v1/network-topologies"

	payload := strings.NewReader("{\n  \"clusterId\": \"71f69d83-ba66-4822-adf5-55ce55efd210\",\n  \"levels\": [\n    \"cloud.provider.com/topology-block\",\n    \"cloud.provider.com/topology-rack\",\n    \"kubernetes.io/hostname\"\n  ],\n  \"name\": \"default-topology\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("http://localhost:8080/api/v1/network-topologies")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"clusterId\": \"71f69d83-ba66-4822-adf5-55ce55efd210\",\n  \"levels\": [\n    \"cloud.provider.com/topology-block\",\n    \"cloud.provider.com/topology-rack\",\n    \"kubernetes.io/hostname\"\n  ],\n  \"name\": \"default-topology\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("http://localhost:8080/api/v1/network-topologies")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"clusterId\": \"71f69d83-ba66-4822-adf5-55ce55efd210\",\n  \"levels\": [\n    \"cloud.provider.com/topology-block\",\n    \"cloud.provider.com/topology-rack\",\n    \"kubernetes.io/hostname\"\n  ],\n  \"name\": \"default-topology\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:8080/api/v1/network-topologies', [
  'body' => '{
  "clusterId": "71f69d83-ba66-4822-adf5-55ce55efd210",
  "levels": [
    "cloud.provider.com/topology-block",
    "cloud.provider.com/topology-rack",
    "kubernetes.io/hostname"
  ],
  "name": "default-topology"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("http://localhost:8080/api/v1/network-topologies");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"clusterId\": \"71f69d83-ba66-4822-adf5-55ce55efd210\",\n  \"levels\": [\n    \"cloud.provider.com/topology-block\",\n    \"cloud.provider.com/topology-rack\",\n    \"kubernetes.io/hostname\"\n  ],\n  \"name\": \"default-topology\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "clusterId": "71f69d83-ba66-4822-adf5-55ce55efd210",
  "levels": ["cloud.provider.com/topology-block", "cloud.provider.com/topology-rack", "kubernetes.io/hostname"],
  "name": "default-topology"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8080/api/v1/network-topologies")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```