---
title: "Attach cluster"
url: https://hexelstudio.com/docs/api/titan/management/attach-cluster
---

# Attach cluster

**PUT** `/titan/management/deployments/{id}/attached-clusters/{cluster_id}`

## Path parameters

- `id: string`

- `cluster_id: string`

  The attached cluster's id, chosen at registration (a DNS label).

## Headers

- `Authorization: string`

  `Bearer <token>`. A Hexel Studio access token for a member or a service user of your organization (or send a service user's API key as X-API-Key).

## Body parameters

- `allowed_namespaces: optional array of string`

  Exact namespaces (not default or kube-*). At least one of allowed_namespaces and namespace_pattern.

- `issuer: string`

  The cluster's service-account issuer exactly as tokens carry it in iss (https).

- `jwks: optional object`

  The cluster's JWKS (kubectl get --raw /openid/v1/jwks): 1-8 RS256 (RSA 2048-4096) or Ed25519 keys. Absent: fetched once from the issuer's discovery document (https, port 443, jwks_uri on the issuer's host).

  - `keys: array of object`

- `keys_valid_days: optional integer`

  How long the pinned keys are trusted from now; register again to re-pin.

  Default: `365`

- `max_token_lifetime_seconds: optional integer`

  Default: `3600`

- `namespace_pattern: optional string`

  <prefix>* trusting every namespace starting with the prefix (3-52 characters ending in '-', not kube-).

## Returns

`200` Organization-scoped result. (`AttachedCluster`)

- `allowed_namespaces: array of string`

- `audience: string`

- `cluster_id: string`

- `issuer: string`

- `keys: array of object`

  - `alg: string`

  - `kid: string`

  - `kty: string`

  - `pinned_until: string`

  - `thumbprint: string`

- `max_token_lifetime_seconds: integer`

- `namespace_pattern: optional string`

- `verifier_id: string`

## Errors

- `400` Invalid request or path; ATTACHED_CLUSTER_INVALID when the issuer, namespaces, lifetime, validity or keys do not validate (RS256 2048-4096 bit and Ed25519 keys only); ATTACHED_CLUSTER_DISCOVERY_FAILED when no jwks was given and the issuer's discovery document or JWKS could not be fetched, or does not match (give the jwks instead).
- `401` Missing or invalid authenticated context.
- `403` Organization mismatch or denied IAM action.
- `404` Unknown or foreign deployment, or (with a cluster id) a cluster that is not attached.
- `405` HTTP method is not supported on this route.
- `409` The deployment is not a provisioned Titan Cloud or Titan Dedicated deployment (DEPLOYMENT_NOT_PROVISIONED) or is retired (DEPLOYMENT_RETIRED); ATTACHED_CLUSTER_CONFLICT when the issuer, cluster id or a key is the platform cluster's or another attached cluster's; ATTACHED_CLUSTER_LIMIT_REACHED; ATTACHED_CLUSTERS_NOT_ENABLED when Hexel has not enabled attached clusters on the deployment's region profile.
- `413` Request body exceeds its size limit.
- `415` Unsupported request media type.
- `502` The deployment's Configuration Authority refused or answered unexpectedly (closed code).
- `503` Local storage or the deployment's Configuration Authority unavailable.

## Example

```bash
curl --request PUT \
  --url 'https://api.hexelstudio.com/v1/titan/management/deployments/{id}/attached-clusters/{cluster_id}' \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  "allowed_namespaces": [
    "string"
  ],
  "issuer": "string",
  "jwks": {
    "keys": [
      {}
    ]
  },
  "keys_valid_days": 365,
  "max_token_lifetime_seconds": 3600,
  "namespace_pattern": "string"
}'
```

### Response (200)

```json
{
  "allowed_namespaces": [
    "string"
  ],
  "audience": "string",
  "cluster_id": "string",
  "issuer": "string",
  "keys": [
    {
      "alg": "string",
      "kid": "string",
      "kty": "string",
      "pinned_until": "2026-01-01T00:00:00Z",
      "thumbprint": "string"
    }
  ],
  "max_token_lifetime_seconds": 0,
  "namespace_pattern": "string",
  "verifier_id": "string"
}
```

### Response (400)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (401)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (403)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (404)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (405)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (409)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (413)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (415)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (502)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (503)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```
