# Create (v2)

Create a new Virtual Cluster with an agent key in the v2 key format.

This endpoint works like [Create](/warpstream/reference/api-reference/virtual-clusters/create): it takes the same request and returns the same response. The difference is that the agent key created with the cluster is in the [v2 key format](/warpstream/reference/api-reference/api-keys#key-formats).

The agent key's secret, `agent_key.key` in the response, is only returned by this request. WarpStream does not store the secret and it can't be retrieved later, so save it right away. If the secret is lost, create a new agent key with [Create API Key (v2)](/warpstream/reference/api-reference/api-keys/create-v2) and delete the old one.

Pass `"skip_agent_key_creation": true` to create the cluster without an agent key. `agent_key` is then `null` in the response.

## Request

```bash wrap
curl https://api.warpstream.com/api/v1/create_virtual_cluster_v2 \
-H 'warpstream-api-key: XXXXXXXXXX' \
-H 'Content-Type: application/json' \
-d '{"virtual_cluster_name": "XXXXXXXXXX", "virtual_cluster_type": "byoc", "virtual_cluster_region": "us-east-1", "virtual_cluster_cloud_provider": "aws", "virtual_cluster_tier": "dev"}'
```

## Response

```json wrap
{
    "virtual_cluster_id": "vci_1d4930d7_8e6d_4ad9_b27a_654ed4aaa3ee",
    "virtual_cluster_name": "XXXXXXXXXX",
    "agent_pool_id": "api_417d3bf3_026d_4261_bb16_fe59a4262757",
    "agent_pool_name": "apn_XXXXXXXXXX",
    "agent_key": {
        "id": "aki_007f0341_3ab3_457a_a513_2b2c9415582f",
        "name": "akn_virtual_cluster_XXXXXXXXX_44c7ee374113",
        "key": "aks_v2_007f03413ab3457aa5132b2c9415582f_a51b1fb20ac4a3af549503bb08cd309672fcada1030c5a494850e87ce5d4c613",
        "created_at": "2026-10-15T18:54:48.990229Z",
        "access_grants": [{
            "principal_kind": "agent",
            "resource_kind": "virtual_cluster",
            "resource_id": "vci_1d4930d7_8e6d_4ad9_b27a_654ed4aaa3ee"
        }]
    },
    "bootstrap_url": "api-417d3bf3-026d-4261-bb16-fe59a4262757.kafka.discoveryv2.prod-z.us-east-1.warpstream.com:9092"
}
```