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

# Update Agent

## Update Agent

Update an existing agent. Users can only update their own agents.

<ParamField path="path" name="id" type="string" required>
  Agent ID (numeric or ElevenLabs agent ID)
</ParamField>

## Request Body

<ParamField body name="agent" type="object" required>
  Agent object with fields to update

  <ParamField body name="name" type="string" optional>
    Agent name
  </ParamField>

  <ParamField body name="tags" type="array" optional>
    Array of tag strings
  </ParamField>

  <ParamField body name="conversation_config" type="object" optional>
    Agent conversation configuration
  </ParamField>

  <ParamField body name="platform_settings" type="object" optional>
    Platform-specific settings
  </ParamField>

  <ParamField body name="widget_config" type="object" optional>
    Widget configuration for web integration
  </ParamField>
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT "https://api.example.com/api/v1/agents/123" \
    -H "X-API-Key: your-api-key-here" \
    -H "Content-Type: application/json" \
    -d '{
      "agent": {
        "name": "Updated Agent Name",
        "tags": ["support", "voice", "updated"],
        "conversation_config": {
          "temperature": 0.8
        }
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const agentId = '123';
  const response = await fetch(`https://api.example.com/api/v1/agents/${agentId}`, {
    method: 'PUT',
    headers: {
      'X-API-Key': 'your-api-key-here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      agent: {
        name: 'Updated Agent Name',
        tags: ['support', 'voice', 'updated'],
        conversation_config: {
          temperature: 0.8
        }
      }
    })
  });

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

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

  agent_id = '123'
  headers = {
      'X-API-Key': 'your-api-key-here',
      'Content-Type': 'application/json'
  }

  payload = {
      'agent': {
          'name': 'Updated Agent Name',
          'tags': ['support', 'voice', 'updated'],
          'conversation_config': {
              'temperature': 0.8
          }
      }
  }

  response = requests.put(
      f'https://api.example.com/api/v1/agents/{agent_id}',
      headers=headers,
      json=payload
  )

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

## Response

<ResponseField name="status" type="object">
  Response status information

  <ResponseField name="code" type="integer">
    HTTP status code (200)
  </ResponseField>

  <ResponseField name="message" type="string">
    Status message
  </ResponseField>
</ResponseField>

<ResponseField name="data" type="object">
  Updated agent object (see Agent schema)
</ResponseField>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "status": {
      "code": 200,
      "message": "Agent updated successfully"
    },
    "data": {
      "id": "123",
      "name": "Updated Agent Name",
      "tags": ["support", "voice", "updated"],
      "conversation_config": {
        "temperature": 0.8
      },
      "platform_settings": {},
      "published": true,
      "published_at": "2024-01-15T10:30:00Z",
      "elevenlabs_agent_id": "agent_abc123",
      "version": 2,
      "phone_numbers": [],
      "user_id": 1,
      "user_email": "user@example.com",
      "created_at": "2024-01-10T08:00:00Z",
      "updated_at": "2024-01-15T11:00:00Z"
    }
  }
  ```
</ResponseExample>

## Error Responses

<ResponseField name="401" type="object">
  Unauthorized - Invalid or missing authentication
</ResponseField>

<ResponseField name="404" type="object">
  Agent not found
</ResponseField>

<ResponseField name="422" type="object">
  Validation error - Invalid request body
</ResponseField>
