# Update a vocabulary

Adds entries to a saved vocabulary, removes some, replaces them all, or renames it.

`PATCH /v1/vocabularies/{id}` on `https://api.eu.vatis.tech`

> **Admin key only.** A Member key gets `403` `admin_only`. Roles: [Authentication and API keys](https://platform.vatis.tech/docs/authentication).

## Path parameters

| parameter | values | default | meaning |
|---|---|---|---|
| `id` | a vocabulary id, `voc_...` | required | The vocabulary. |

## Headers

| header | values | default | meaning |
|---|---|---|---|
| `Authorization` | `Bearer <api key>` | required | An Admin key ([Roles](https://platform.vatis.tech/docs/authentication#roles)). A Member key gets `403` `admin_only`. |

## Body fields (`application/json`)

| field | values | default | meaning |
|---|---|---|---|
| `name` | 1 to 64 letters, digits, dots, dashes or underscores |  | A new name. |
| `add_entries` | a JSON list of strings |  | Entries to add, at the end. One that is there already takes the new spelling and keeps its place. |
| `remove_entries` | a JSON list of strings |  | Entries to remove, whatever their case. One that is not there is no error. |
| `entries` | a JSON list of strings |  | All the entries, in place of the ones there. Not with `add_entries` or `remove_entries`. |

## Response fields

| field | when | meaning |
|---|---|---|
| `id` |  | `voc_` and 12 hex digits: a session's `vocabulary_id`. |
| `name` |  | The vocabulary's name. |
| `entry_count` |  | How many entries it holds. |
| `created_at` |  | When it was made: ISO 8601, UTC. |
| `updated_at` |  | Its last change: ISO 8601, UTC. |
| `entries` |  | The entries, in the order they were added. |

## Responses

`200`: The vocabulary as it is now.

```json
{
  "id": "voc_3f9c1a2b7d4e",
  "name": "streets-bucharest",
  "entry_count": 3,
  "created_at": "2026-11-11T09:14:03Z",
  "updated_at": "2026-11-11T10:01:44Z",
  "entries": [
    "Calea Victoriei",
    "Strada 13 Septembrie",
    "Bulevardul Iuliu Maniu"
  ]
}
```

`400` `invalid_parameter`: A field that is unknown or not valid, an entry that is not one (`param` `add_entries[<index>]`, its place in the list sent), `entries` together with one of the other two, more than 10,000 entries after the change, or a query parameter. The `param` names it. Nothing of a refused request is applied.

`400` `invalid_request`: A body that is not a JSON object.

`401` `unauthorized`: No key, or a wrong, revoked or expired one.

```json
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid, revoked or expired key.",
    "param": null,
    "request_id": "req_bf2fed760ba5437ba0933a57"
  }
}
```

`403` `admin_only`: A Member key.

`404` `not_found`: No vocabulary of your workspace has that id.

```json
{
  "error": {
    "code": "not_found",
    "message": "Vocabulary not found.",
    "param": null,
    "request_id": "req_bf2fed760ba5437ba0933a57"
  }
}
```

`409` `name_taken`: Another vocabulary of your workspace has that name. Pick another name, or change that one.

`413` `request_too_large`: A JSON body over 8 MB.

`503` `unavailable`: The service is busy for a moment. Send the request again after the seconds of the `Retry-After` header.

## Notes

- **Removed first, then added:** with both `remove_entries` and `add_entries`, what is removed goes first.
- **New sessions and files only:** a session reads its vocabulary when it starts, a file when its job is accepted. Open sessions keep the entries they started with. The first session after a change of a long list may get its first text a moment later.
- A request that changes nothing (the same name, entries to remove that are not there, an empty object) answers the vocabulary as it is, and `updated_at` stays.
