# Update an agent

`PATCH` `https://goblins-call-api.onrender.com/v1/agents/:id`

Changes the fields you send and leaves the rest as they are. Calls started afterwards use the new settings; calls already under way keep the ones they started with.

Needs a [workspace API key](https://www.cracklehq.com/docs/authentication).

## Path parameters

- `id` (string, required): The agent’s ID, such as `ua_3f9a1c2b`.

## Body

- `name` (string, optional, 1–100 chars): What the agent is called in the studio and in call logs.
- `systemInstruction` (string, optional, up to 25,000 chars): The agent’s instructions: who it is, what it does and how it should speak. May contain `{{variables}}` and mention tools as `@tool_name`.
- `greetingMode` (enum, optional, generate · static · none; default generate): `generate` has the model write the opening line from `greetingInstruction`, `static` speaks `greetingText` as written, and `none` waits for the caller to speak first.
- `greetingText` (string, optional): The opening line when `greetingMode` is `static`. May contain `{{variables}}`.
- `greetingInstruction` (string, optional): What the opening line should do when `greetingMode` is `generate`. May contain `{{variables}}`.
- `voice` (object, optional): How the agent sounds. Anything left out is filled in with the platform’s default.
- `voice.provider` (string, optional): The voice engine, one of the `ttsProviders` in the catalog.
- `voice.language` (string, optional): The language the agent speaks, one of the `languages` in the catalog, such as `hi`, `hinglish` or `en`.
- `voice.speaker` (string, optional): The voice: an ID from the voice library, or a named speaker of the engine. The catalog’s `voices` list an engine’s named speakers; one that carries `languages` speaks those languages, so choose it together with `voice.language`.
- `voice.speed` (number, optional, 0.2–2, default 1): Speaking rate.
- `voice.volume` (number, optional, 0.5–2): Loudness, with 1 as the voice’s own level. Engines without a volume control ignore it.
- `voice.emotion` (string, optional): A delivery the engine supports, such as `calm`. Engines without emotions ignore it.
- `llm` (object, optional): The model that writes the replies. `provider` and `model` come from the `llmModels` in the catalog; `temperature` (0–2) and `maxTokens` are snapped to what that model allows.
- `stt` (object, optional): How the agent listens. `provider` is one of the `sttProviders` in the catalog; send it alone to change engines. An engine that lists `languages` transcribes only those, and an agent set to any other language is transcribed by the default engine. `language` is the ISO code of the language callers speak, such as `hi` or `ta`; English words in it are understood as well. Set it alongside `voice.language` when the agent speaks anything but the default language.
- `variables` (object, optional): The variables the instructions use, by name. Each is `{ "defaultValue": "…", "description": "…" }`; the default applies when a call does not send that variable.
- `toolIds` (string[], optional): The agent’s tools that are switched on. Naming another agent’s tool gives this agent a copy of it under a new ID.
- `tools` (object[], optional): Tool definitions to save with the agent, each shaped like the body of Create a tool. A definition whose `name` matches one of the agent’s tools updates that tool.
- `documentIds` (string[], optional): The workspace’s documents the agent answers from. IDs that are not documents of the workspace are dropped.
- `systemTools` (object, optional): Built-in actions the agent may take on its own: `{ "endCall": true, "changeLanguage": true }`.
- `webhookUrl` (string, optional): A URL that receives every event of this agent’s calls. Must be a public address. An empty string removes it.
- `embed` (object, optional): What the agent’s publishable key may do from a web page: `enabled`, `allowedOrigins` (up to 20 hosts; empty allows any site), `maxCallSeconds` (30–3,600, default 300) and `dailySpendLimit` (default 5). Off until `enabled` is `true`.

## Errors

- `400`: The body failed validation. `details` lists each field and what is wrong with it.
- `400` `URL_NOT_ALLOWED`: The URL is not a public `http(s)` address.
- `404`: No agent in your workspace has that ID.

Every request can also answer `401`, `429` and `500`: see [Errors](https://www.cracklehq.com/docs/errors).

## Notes

- `voice`, `llm` and `stt` are merged field by field, so you can send just the part you are changing. `variables` is replaced as a whole: send every variable you want to keep.

Request:

cURL:

```bash
curl -X PATCH "https://goblins-call-api.onrender.com/v1/agents/ua_3f9a1c2b" \
  -H "Authorization: Bearer $CRACKLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "voice": {
    "speed": 1.1
  },
  "systemTools": {
    "endCall": true,
    "changeLanguage": true
  }
}'
```

Node.js:

```js
const response = await fetch('https://goblins-call-api.onrender.com/v1/agents/ua_3f9a1c2b', {
  method: 'PATCH',
  headers: {
    Authorization: `Bearer ${process.env.CRACKLE_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    voice: {
      speed: 1.1,
    },
    systemTools: {
      endCall: true,
      changeLanguage: true,
    },
  }),
});
if (!response.ok) throw new Error(await response.text());
const data = await response.json();
```

Python:

```python
import os
import requests

response = requests.patch(
    "https://goblins-call-api.onrender.com/v1/agents/ua_3f9a1c2b",
    headers={"Authorization": f"Bearer {os.environ['CRACKLE_API_KEY']}"},
    json={
        "voice": {
            "speed": 1.1,
        },
        "systemTools": {
            "endCall": True,
            "changeLanguage": True,
        },
    },
    timeout=30,
)
response.raise_for_status()
data = response.json()
```

Response · 200 OK:

```json
{
  "agent": {
    "id": "ua_3f9a1c2b",
    "userId": "usr_8c1d2e3f4a5b",
    "name": "Front desk",
    "costPerMinute": 0.07,
    "apiKey": "gs_agent_…",
    "webhookUrl": "",
    "systemInstruction": "You answer calls for Sunrise Dental…",
    "greetingMode": "generate",
    "greetingText": "",
    "greetingInstruction": "Greet {{customer_name}} warmly in one short sentence.",
    "voice": { "provider": "cartesia", "language": "en", "speaker": "…", "speed": 1 },
    "llm": { "provider": "…", "model": "…", "temperature": 0.6, "maxTokens": 90 },
    "stt": { "provider": "…", "language": "en", "detectLanguage": false },
    "variables": { "customer_name": { "defaultValue": "there" } },
    "toolIds": [],
    "tools": [],
    "systemTools": { "endCall": true },
    "stats": { "totalCalls": 0, "totalSeconds": 0, "totalCost": 0 },
    "createdAt": "2026-10-11T08:12:44.000Z",
    "updatedAt": "2026-10-11T08:12:44.000Z"
  }
}
```

Source: https://www.cracklehq.com/docs/reference/agents/update
