---
title: "Create Agent Client Key"
method: POST
path: "/agents/{agentId}/client-keys"
tags: ["Client Keys"]
---

# Create Agent Client Key

`POST /agents/{agentId}/client-keys`

Create a client key scoped to a specific agent. Multiple keys per agent are allowed with different domain sets.

## Path parameters

- `agentId` string, required

## Request body

- CreateResourceClientKeyDto
  - `allowed_domains` string[], required
  - `name` string
  - `ttl_seconds` integer — Optional lifetime for a short-lived key, in seconds. Omit for a permanent key. When set and allowed_domains is empty, the key is created with a wildcard (`*`) allowed domain.

## Response `201`

Created

- ClientKeyResponseDto
  - `client_key` string, required
  - `allowed_domains` string[], required
  - `name` string
  - `resource_id` string
  - `created_at` string
  - `expires_at` string — ISO-8601 expiry for short-lived keys; absent for permanent keys.

## Other responses

- `400` — BadRequest
- `401` — AuthorizationError
- `404` — NotFound

---

[API](https://skmtc.net/d-id/apis/realtime-endpoints.md) · [All operations](https://skmtc.net/d-id/apis/realtime-endpoints/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/d-id/realtime-endpoints/versions/2f2425e1b6b6/schema)
