Create services
Puts a name on the org's overlay: a fabric service forwarding to host:port on whichever of the org's devices carries the "<name>-host" role, dialable at…
POST /v1/network/services
| Address | https://api.hanzo.ai/v1/network/services |
| Method | POST |
| Operation | post_network_services |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Puts a name on the org's overlay: a fabric service forwarding to host:port on whichever of the org's devices carries the "<name>-host" role, dialable at "<name>.<org>.zt" by any of the org's identities — and by the cloud's own, which is what lets a BYO cluster's apiserver be attached to the fleet with a ".zt" kubeconfig.
Answers 201 with the service and its DNS name. The objects behind it are created in dependency order and unwound on failure, so a half-published service never lingers on the fabric.
A write, so it does not degrade: an unconfigured deployment answers 503.
Request
3 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
host | body | string | — | Host is where the HOSTING identity forwards a connection — an address the host device itself can reach, "127.0.0.1" for a server on the device. |
name | body | string | — | Name is the service's name within the org — a DNS label. |
port | body | integer (int64) | — | Port is the port beside Host, and the one the DNS name intercepts. |
Response
| Status | Body | Meaning |
|---|---|---|
201 | network.publishedView | created |
default | problem-details | refused |
201 body — 3 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
dns | body | string | — | DNS is the name the fabric answers for this service — what a kubeconfig server, or any client on the org's overlay, dials. |
id | body | string | — | ID is the fabric service's id. |
name | body | string | — | Name is the service's name within the org. |
Failure carries the platform error shape — see Errors.
Examples
hanzo network services createimport { Configuration, NetworkApi } from 'hanzoai';
const api = new NetworkApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postNetworkServices({ host: "<host>", name: "<name>" });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).post_network_services(host="<host>", name="<name>")cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.NetworkAPI.PostNetworkServices(context.Background()).Execute()
if err != nil {
return err
}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::post_network_services(&cfg, Default::default()).await?;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).postNetworkServices();The method above is the one at the current release of the document. [email protected] (npm) was generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl -X POST https://api.hanzo.ai/v1/network/services \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"host": "<host>",
"name": "<name>"
}'MCP reaches network through the zt tool, which names its 4 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_mesh_services"
}
}
}'How is this guide?