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

# Update Tenants

> Rename a tenant and change its labels without losing the labels you want to keep.

As customers change, keep their tenants in step: rename a tenant when a customer rebrands, or update a label when they move to a new plan.
`UpdateTenant` changes a tenant's name and labels.

Updating tenants requires a [partner client](/docs/platform/tenants/clients#partner-client). The examples start from `partnerClient` and the tenant to update, found with [List and find tenants](/docs/platform/tenants/list#find-a-tenant).

## How UpdateTenant treats each field

`UpdateTenant` has no way to change one field on its own. Each field you leave out is handled differently:

| Field | Sent | Left out or empty |
| - | - | - |
| `visibleName` | Replaces the name | The name is kept |
| `labels` | Replaces **all** labels | **All labels are removed** |
| `policies` | Replaces all policies | Policies are kept |

Labels are the one to watch: renaming a tenant without sending its labels deletes them.
To keep them, send the current labels back with every update.

## Update a tenant's name and labels

<Steps titleSize="h3">
  <Step title="Start from the current labels">
    Copy the tenant's current labels, then add or change the ones you need.
    This example moves the customer to a new plan and adds a region.

    <CodeGroup>
      ```typescript TypeScript theme={null}
      const labels = new Map(tenant.labels.map((label) => [label.name, label.value]));
      labels.set("plan", "enterprise");
      labels.set("region", "eu");
      ```

      ```go Go theme={null}
      labels := map[string]string{}
      for _, label := range tenant.Labels {
      	labels[label.Name] = label.Value
      }
      labels["plan"] = "enterprise"
      labels["region"] = "eu"
      ```
    </CodeGroup>
  </Step>

  <Step title="Send the update">
    <CodeGroup>
      ```typescript TypeScript theme={null}
      const { tenant: updated } = await partnerClient.tenants.updateTenant({
        tenantId: tenant.id,
        visibleName: "Customer 1 (production)",
        labels: [...labels].map(([name, value]) => ({ name, value })),
      });
      ```

      ```go Go theme={null}
      var newLabels []*stdlib.Label
      for name, value := range labels {
      	newLabels = append(newLabels, &stdlib.Label{Name: name, Value: value})
      }

      resp, err := partnerClient.Tenants.UpdateTenant(ctx, &iamv1beta.UpdateTenantRequest{
      	TenantId:    tenant.Id,
      	VisibleName: "Customer 1 (production)",
      	Labels:      newLabels,
      })
      if err != nil {
      	log.Fatal(err)
      }
      ```
    </CodeGroup>

    The response contains the updated tenant:

    ```json Output theme={null}
    {
      "id": "tenant_lqrj7qre0ts32",
      "createdAt": "2026-09-29T13:58:19.121800Z",
      "visibleName": "Customer 1 (production)",
      "externalAccountId": "customer-1",
      "labels": [
        { "name": "plan", "value": "enterprise" },
        { "name": "region", "value": "eu" }
      ]
    }
    ```

    To change only the labels, leave out `visibleName`. The name stays as it is.
  </Step>
</Steps>

## Label rules

Label names start with a lowercase letter and can contain lowercase letters, digits, hyphens, and periods, up to 63 bytes. Values can be up to 255 bytes.

## Next steps

<Columns cols={2}>
  <Card title="Tenant policies" icon="gauge" href="/docs/platform/tenants/policies">
    Limit what a tenant can use.
  </Card>

  <Card title="Delete tenants" icon="trash-2" href="/docs/platform/tenants/delete">
    Remove a tenant when a customer leaves.
  </Card>
</Columns>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.