# Voices

> A section of the Kumkuat API 1.0.0 reference. The rest of it: https://product.tech/docs-kumkuat-ai/api-reference.md (API Reference). Base URL: `https://api.kumkuat.ai`.

The personas you can write as in content creation, including executives materialised from their own statements.

## List voices

`GET /api/v1/voices`

Every persona offered as a content-creation voice, plus executives that have been materialised as voices whether or not they are currently enabled.

### Returns (200, object)

OK

- `total` (integer, required)
- `voices` (array of object, required)
  - `category` (string, nullable)
  - `enabled` (boolean, required): Whether the voice is offered in content creation.
  - `executive` (string, nullable): The executive's name as it appears on documents; null for an ordinary persona.
  - `kind` (string, required, for example "executive"): `executive` for a voice materialised from an executive's own statements, else `persona`.
  - `name` (string, required, for example "Jane Doe")
  - `persona_id` (string, required, for example "d4e9b2a1-6c3f-4b8e-9f21-0a7c5e3d1b60")
  - `tuned` (boolean, required): Whether a voice profile has been analysed from writing samples or statements.

### Responses

- `200`: OK
- `422`: Unprocessable Entity

### Example request

```bash
curl https://api.kumkuat.ai/api/v1/voices \
  -H 'X-API-Key: <api key>'
```

### Example response

```json
{
  "total": 0,
  "voices": [
    {
      "category": "string",
      "enabled": true,
      "executive": "string",
      "kind": "executive",
      "name": "Jane Doe",
      "persona_id": "d4e9b2a1-6c3f-4b8e-9f21-0a7c5e3d1b60"
    }
  ]
}
```

## Add a voice

`POST /api/v1/voices`

``{"executive": "<name>"}`` materialises an executive named on the workspace's documents as a tuned voice persona (one model call on first creation; an existing voice is re-enabled). ``{"persona_id": "<id>"}`` offers an existing persona as a voice. Answers 201 with the voice.

### Request body (application/json, required)

- `executive` (string, nullable, for example "Jane Doe"): Materialise this executive, as named on the workspace's documents, as a tuned voice. Idempotent: an existing voice is re-enabled.
- `persona_id` (string, nullable): Offer an existing persona as a voice instead. Send exactly one of executive or persona_id.

### Returns (201, object)

Created

- `category` (string, nullable)
- `created` (boolean, required): True when a new persona was created for the executive.
- `enabled` (boolean, required): Whether the voice is offered in content creation.
- `executive` (string, nullable): The executive's name as it appears on documents; null for an ordinary persona.
- `kind` (string, required, for example "executive"): `executive` for a voice materialised from an executive's own statements, else `persona`.
- `name` (string, required, for example "Jane Doe")
- `persona_id` (string, required, for example "d4e9b2a1-6c3f-4b8e-9f21-0a7c5e3d1b60")
- `tuned` (boolean, required): Whether a voice profile has been analysed from writing samples or statements.

### Responses

- `201`: Created
- `422`: Unprocessable Entity

### Example request

```bash
curl https://api.kumkuat.ai/api/v1/voices \
  -H 'X-API-Key: <api key>' \
  -H 'Content-Type: application/json' \
  -d '{"executive":"Jane Doe","persona_id":"string"}'
```

### Example response

```json
{
  "category": "string",
  "created": true,
  "enabled": true,
  "executive": "string",
  "kind": "executive",
  "name": "Jane Doe",
  "persona_id": "d4e9b2a1-6c3f-4b8e-9f21-0a7c5e3d1b60",
  "tuned": true
}
```

## Get a voice

`GET /api/v1/voices/{persona_id}`

One voice by its persona id. 404 when the persona is not a voice in this workspace.

### Path parameters

- `persona_id` (string, required): Persona id of the voice, as listed by GET /api/v1/voices.

### Returns (200, object)

OK

- `category` (string, nullable)
- `enabled` (boolean, required): Whether the voice is offered in content creation.
- `executive` (string, nullable): The executive's name as it appears on documents; null for an ordinary persona.
- `kind` (string, required, for example "executive"): `executive` for a voice materialised from an executive's own statements, else `persona`.
- `name` (string, required, for example "Jane Doe")
- `persona_id` (string, required, for example "d4e9b2a1-6c3f-4b8e-9f21-0a7c5e3d1b60")
- `tuned` (boolean, required): Whether a voice profile has been analysed from writing samples or statements.

### Responses

- `200`: OK
- `422`: Unprocessable Entity

### Example request

```bash
curl --globoff 'https://api.kumkuat.ai/api/v1/voices/{persona_id}' \
  -H 'X-API-Key: <api key>'
```

### Example response

```json
{
  "category": "string",
  "enabled": true,
  "executive": "string",
  "kind": "executive",
  "name": "Jane Doe",
  "persona_id": "d4e9b2a1-6c3f-4b8e-9f21-0a7c5e3d1b60",
  "tuned": true
}
```

## Enable or disable a voice

`PUT /api/v1/voices/{persona_id}`

Body ``{"enabled": true|false}``. For an executive's voice this is the same toggle as the executives page: enabling tunes the persona from the executive's statements when it has not been tuned yet, disabling keeps the tuned persona. For any other persona it sets ``include_in_voice_list``.

### Path parameters

- `persona_id` (string, required): Persona id of the voice, as listed by GET /api/v1/voices.

### Request body (application/json, required)

- `enabled` (boolean, required): True offers the voice in content creation; false withdraws it but keeps the persona and its tuning.

### Returns (200, object)

OK

- `category` (string, nullable)
- `enabled` (boolean, required): Whether the voice is offered in content creation.
- `executive` (string, nullable): The executive's name as it appears on documents; null for an ordinary persona.
- `kind` (string, required, for example "executive"): `executive` for a voice materialised from an executive's own statements, else `persona`.
- `name` (string, required, for example "Jane Doe")
- `persona_id` (string, required, for example "d4e9b2a1-6c3f-4b8e-9f21-0a7c5e3d1b60")
- `tuned` (boolean, required): Whether a voice profile has been analysed from writing samples or statements.

### Responses

- `200`: OK
- `422`: Unprocessable Entity

### Example request

```bash
curl --globoff 'https://api.kumkuat.ai/api/v1/voices/{persona_id}' \
  -X PUT \
  -H 'X-API-Key: <api key>' \
  -H 'Content-Type: application/json' \
  -d '{"enabled":true}'
```

### Example response

```json
{
  "category": "string",
  "enabled": true,
  "executive": "string",
  "kind": "executive",
  "name": "Jane Doe",
  "persona_id": "d4e9b2a1-6c3f-4b8e-9f21-0a7c5e3d1b60",
  "tuned": true
}
```
