> ## Documentation Index
> Fetch the complete documentation index at: https://docs.60db.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Agent

> Change one or more fields of an agent

Change any agent fields. Send at least one field. Fields you leave out keep their values. Send `""` or `null` for `greeting` to clear it. Field rules match [Create agent](https://docs.60db.ai/api-reference/agents/create-agent.md). This includes `transfer_targets` (call transfer); send `[]` to turn transfers off.

The change is applied to the agent's copy in the call runtime when one exists. If that copy cannot be updated, the change is reverted and you get `502 AGENTS_UPSTREAM_UNAVAILABLE`.

## Request

### Headers

**Authorization** `string` *required*

Bearer token with your API key (scope `agents`)

**Content-Type** `string` *required*

application/json

### Path

**agentId** `string` *required*

The agent `id` (UUID)

### Body

Any field from [Create agent](https://docs.60db.ai/api-reference/agents/create-agent.md), except `webhook_secret`. Most common:

**name** `string`

1–64 characters, unique in the workspace

**script** `string`

1–8,000 characters

**greeting** `string | null`

Up to 500 characters. `""` or `null` clears it

**call\_defaults** `object`

Replaces the defaults you send. Use the same keys as on create

## Response

**200 OK**. The updated agent (same shape as [Get agent](https://docs.60db.ai/api-reference/agents/get-agent.md), without `phone_lines`).

## Errors

| Status | Code | Meaning |
| - | - | - |
| 400 | `VALIDATION_ERROR` | A field is invalid. After the change is merged, `tools` without a `tool_webhook_url` also fails here |
| 404 | `AGENT_NOT_FOUND` | No agent with this ID in your workspace |
| 404 | `KNOWLEDGE_COLLECTION_NOT_FOUND` | The knowledge base is not in your workspace |
| 409 | `AGENT_NAME_TAKEN` | Another agent already uses this name |
| 422 | `KNOWLEDGE_COLLECTION_UNSUPPORTED` | The knowledge base is a personal collection |
| 422 | `UNSAFE_WEBHOOK_URL` | A webhook URL is not public HTTPS on port 443 |
| 502 | `AGENTS_UPSTREAM_UNAVAILABLE` | The change could not be synced to the call runtime. It was reverted. Retry shortly |

## Example

```bash cURL theme={null}
curl -X PATCH https://api.60db.ai/agents/AGENT_ID \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"greeting": "Hi there! What can I do for you?"}'
```

```javascript JavaScript theme={null}
await client.agents.update(agentId, { greeting: 'Hi there! What can I do for you?' });
```

```python Python theme={null}
client.agents.update(agent_id, greeting="Hi there! What can I do for you?")
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.