---
title: "Creates or Updates HostnameGenerator entity"
method: PUT
path: "/v1/mesh/control-planes/{cpId}/api/hostnamegenerators/{name}"
tags: ["HostnameGenerator"]
---

# Creates or Updates HostnameGenerator entity

`PUT /v1/mesh/control-planes/{cpId}/api/hostnamegenerators/{name}`

## Path parameters

- `name` string, required

## Request body

- HostnameGeneratorItem — HostnameGenerator automatically generates DNS hostnames for services in the mesh based on customizable templates. It provides a consistent naming scheme for service discovery by creating predictable hostnames from service labels and metadata, supporting both MeshService, MeshExternalService, and MeshMultiZoneService resources.
  - `type` 'HostnameGenerator', required — the type of the resource
  - `kri` string — A unique identifier for this resource instance used by internal tooling and integrations. Typically derived from resource attributes and may be used for cross-references or indexing
  - `name` string, required — Name of the Kuma resource
  - `labels` object — The labels to help identity resources
  - `spec` object, required — Spec is the specification of the Kuma HostnameGenerator resource.
    - `extension` object — Extension struct for a plugin configuration
      - `config` unknown
      - `type` string, required — Type of the extension.
    - `selector` object
      - `meshExternalService` object
        - `matchLabels` object
      - `meshMultiZoneService` object
        - `matchLabels` object
      - `meshService` object
        - `matchLabels` object
    - `template` string, required
  - `creationTime` string, date-time — Time at which the resource was created
  - `modificationTime` string, date-time — Time at which the resource was updated

## Response `200`

Successful response

- object
  - `warnings` string[] — warnings is a list of warning messages to return to the requesting Kuma API clients. Warning messages describe a problem the client making the API request should correct or be aware of.

## Other responses

- `201` — Successful response

## Changes

- **2025-10-02** `ecce2daf9de6` — 1 breaking, 1 info
  - the request property `spec/template` became required
  - the request property `spec/extension/config` became nullable
- **2025-08-12** `b2800570b3e2` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/kong/apis/konnect-api-beta/changes/v1/mesh/control-planes/:cpId/api/hostnamegenerators/:name/put.md)

---

[API](https://skmtc.dev/kong/apis/konnect-api-beta.md) · [All operations](https://skmtc.dev/kong/apis/konnect-api-beta/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/kong/konnect-api-beta/revisions/cef0f947e9c9/schema)
