# Change a voice clone

`PATCH https://my.neuronai.uz/api/v1/tts/voices/{id}`

Справочник API › Клонирование голоса

Changes a voice clone's name, language, transcript, tags or category. Send only the fields to change.

The voice keeps its `id` and its recording, and a change is applied in full or not at all.

**Authentication:** `Authorization: Bearer <API key>`, a key with `voices:write`.

## Параметры пути

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The voice id. |

## Тело запроса (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | At most 120 characters. |
| `category` | string | No | One of `conversational`, `narration`, `characters`, `social_media`, `educational`. |
| `language` | string | No | One of `uz`, `ru`, `en`, `kk`, `ky`, `tk`, `tg`, `az`, `tr`, `ug`, `tt`, `ba` and 24 more. |
| `ref_text` | string | No | What the recording says, word for word. It can be changed, not cleared. At most 1000 characters. |
| `tags` | string[] | No | Replaces the tags. `null` or `[]` clears them; blank tags are dropped. |

## Ответ (200, `application/json`)

Success.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | object | Yes |  |
| `data.id` | string | Yes |  |
| `data.name` | string | Yes |  |
| `data.language` | string | Yes |  |
| `data.tags` | string[] | Yes |  |
| `data.type` | string | Yes | One of `custom`, `stock`. |
| `data.category` | string \| null | No |  |
| `data.ref_text` | string \| null | No |  |
| `data.created_at` | string \| null | No |  |
| `request_id` | string | Yes |  |

```json
{
  "data": {
    "id": "7c4a8d09-ca37-4f3c-9e2b-1b0f3c2a9d41",
    "name": "Aziza",
    "language": "uz",
    "tags": [
      "calm"
    ],
    "type": "custom",
    "category": "narration",
    "ref_text": "Mening ismim Aziza, men sizga yordam berishga tayyorman.",
    "created_at": "2026-11-17T09:30:00Z"
  },
  "request_id": "7c4a8d09-ca37-4f3c-9e2b-1b0f3c2a9d41"
}
```

### Заголовки

| Header | Type | Description |
| --- | --- | --- |
| `X-Request-Id` | string | Identifies this request. A JSON body carries it as `request_id` too; quote it to support. |

## Ошибки

Every error has the same JSON shape:

```json
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_request",
    "message": "The request is malformed or failed validation.",
    "param": null
  },
  "request_id": "7c4a8d09-ca37-4f3c-9e2b-1b0f3c2a9d41"
}
```

| Status | Meaning |
| --- | --- |
| 401 | The API key is missing or not recognized (`invalid_api_key`), revoked (`api_key_revoked`), disabled (`api_key_disabled`) or expired (`api_key_expired`). |
| 403 | The key lacks the permission this endpoint needs (`insufficient_permissions`), or the client IP is not in its allowlist (`ip_not_allowed`). |
| 404 | No such voice for this key: `not_found`. |
| 422 | The request failed validation (`invalid_request`). `error.fields` names each invalid field. |
| 502 | The voice service could not do it: `upstream_error`. Nothing changes. |
| default | Any other error, in the same shape, such as `server_error` (500) or `service_unavailable` (503). |

## Examples

### cURL

```bash
curl -X PATCH "https://my.neuronai.uz/api/v1/tts/voices/<voice-id>" \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{"name": "Aziza, warm", "tags": ["warm", "narration"]}'
```

### TypeScript SDK

```typescript
import {NeuronAI} from "@naiuz/sdk";

const client = new NeuronAI();

const voice = await client.voices.update("<voice-id>", {
    name: "Aziza, warm",
    tags: ["warm", "narration"],
});

console.log(voice.name, voice.tags);
```

### Python SDK

```python
from naiuz import NeuronAI

client = NeuronAI()

voice = client.voices.update("<voice-id>", name="Aziza, warm", tags=["warm", "narration"])

print(voice.name, voice.tags)
```

### PHP SDK

```php
$client = new \Naiuz\NeuronAI();

$voice = $client->voices->update('<voice-id>', [
    'name' => 'Aziza, warm',
    'tags' => ['warm', 'narration'],
]);

echo $voice->name, ' ', implode(', ', $voice->tags), PHP_EOL;
```

### JavaScript

```javascript
const response = await fetch('https://my.neuronai.uz/api/v1/tts/voices/<voice-id>', {
    method: 'PATCH',
    headers: {
        'Authorization': 'Bearer <your-api-key>',
        'Content-Type': 'application/json',
    },
    body: JSON.stringify({ name: 'Aziza, warm', tags: ['warm', 'narration'] }),
});

const { data } = await response.json();  // data.id is unchanged
```

### Python

```python
import requests

response = requests.patch(
    "https://my.neuronai.uz/api/v1/tts/voices/<voice-id>",
    headers={"Authorization": "Bearer <your-api-key>"},
    json={"name": "Aziza, warm", "tags": ["warm", "narration"]},
)

response.raise_for_status()
voice = response.json()["data"]  # voice["id"] is unchanged
```

### PHP

```php
$ch = curl_init('https://my.neuronai.uz/api/v1/tts/voices/<voice-id>');

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer <your-api-key>',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'name' => 'Aziza, warm',
        'tags' => ['warm', 'narration'],
    ]),
]);

$response = curl_exec($ch);
curl_close($ch);

$voice = json_decode($response, true)['data']; // same id as before
```

---

Source: https://docs.neuronai.uz/ru/api/reference/voice-cloning/update-voice
