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

# Update Agent

> Update an existing agent

## Request

Update the configuration of an existing AI voice agent. Only include fields you want to change.

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication. Format: `Bearer YOUR_API_KEY`
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be `application/json`
</ParamField>

### Path Parameters

<ParamField path="agent_id" type="string" required>
  The unique identifier of the agent to update
</ParamField>

### Body Parameters

All fields are optional. Only include fields you want to update.

<ParamField body="name" type="string">
  A friendly name for the agent
</ParamField>

<ParamField body="system_prompt" type="string">
  The instructions defining the agent's personality and behavior
</ParamField>

<ParamField body="voice_id" type="string">
  The voice to use for the agent
</ParamField>

<ParamField body="first_message" type="string">
  The greeting message when calls connect
</ParamField>

<ParamField body="language" type="string">
  Primary language (e.g., `en-US`, `es-ES`)
</ParamField>

<ParamField body="model" type="string">
  The LLM to use: `gpt-4o`, `gpt-4o-mini`, `claude-3-sonnet`
</ParamField>

<ParamField body="temperature" type="number">
  Creativity level (0.0-1.0)
</ParamField>

<ParamField body="max_tokens" type="integer">
  Maximum tokens per response
</ParamField>

<ParamField body="interruption_threshold" type="number">
  How easily the user can interrupt (0.0-1.0)
</ParamField>

<ParamField body="end_call_phrases" type="array">
  Phrases that will end the call
</ParamField>

<ParamField body="status" type="string">
  Set to `active` or `inactive`
</ParamField>

<ParamField body="metadata" type="object">
  Custom key-value pairs
</ParamField>

## Response

Returns the updated agent object.

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH https://api.ringyo.ai/v1/agents/agent_abc123 \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Sales Assistant v2",
      "temperature": 0.8,
      "first_message": "Hey there! Sarah from Acme here. Got a minute?"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.ringyo.ai/v1/agents/agent_abc123',
    {
      method: 'PATCH',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        name: 'Sales Assistant v2',
        temperature: 0.8,
        first_message: "Hey there! Sarah from Acme here. Got a minute?"
      })
    }
  );

  const agent = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.patch(
      'https://api.ringyo.ai/v1/agents/agent_abc123',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json',
      },
      json={
          'name': 'Sales Assistant v2',
          'temperature': 0.8,
          'first_message': "Hey there! Sarah from Acme here. Got a minute?"
      }
  )

  agent = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "id": "agent_abc123",
    "name": "Sales Assistant v2",
    "system_prompt": "You are Sarah, a friendly sales assistant...",
    "voice_id": "sarah-professional",
    "first_message": "Hey there! Sarah from Acme here. Got a minute?",
    "language": "en-US",
    "model": "gpt-4o",
    "temperature": 0.8,
    "max_tokens": 150,
    "interruption_threshold": 0.5,
    "end_call_phrases": [],
    "status": "active",
    "metadata": {},
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-20T16:45:00Z"
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "error": {
      "code": "agent_not_found",
      "message": "The specified agent does not exist"
    }
  }
  ```

  ```json 400 - Bad Request theme={null}
  {
    "error": {
      "code": "invalid_voice_id",
      "message": "The specified voice_id does not exist"
    }
  }
  ```
</ResponseExample>

## Error Codes

| Code                    | Description                            |
| ----------------------- | -------------------------------------- |
| `agent_not_found`       | The specified agent\_id does not exist |
| `invalid_voice_id`      | The specified voice does not exist     |
| `invalid_system_prompt` | System prompt is too long or invalid   |
| `unauthorized`          | You don't have access to this agent    |
