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

# Atualizar Configurações Avançadas

> Alternar recursos do agente, como cache de custos otimizados

# Atualizar Configurações Avançadas

Alterna recursos avançados do agente. Atualmente, a única configuração é `enable_initial_message_cache`, que ativa a precificação com custos otimizados assim que o agente atinge o limite de elegibilidade.

## Endpoint

```
PATCH /api/v1/agents/{agent_id}/advanced-settings
```

## Parâmetros de caminho

<ParamField path="agent_id" type="string" required>
  UUID do agente.
</ParamField>

## Cabeçalhos da requisição

<ParamField header="Authorization" type="string" required>
  Token Bearer para autenticação. Formato: `Bearer talq_your_environment_token_here`
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Deve ser definido como `application/json`
</ParamField>

## Corpo da requisição

<ParamField body="enable_initial_message_cache" type="boolean">
  Quando `true`, habilita o cache do áudio da mensagem inicial do agente para chamadas de saída repetidas. Reduz o custo de síntese de voz por chamada. Requer que o agente seja elegível — veja [Verificar Elegibilidade para Custos Otimizados](/api-reference/endpoints/check-optimized-costs-eligibility).
</ParamField>

## Exemplos

<RequestExample>
  ```bash theme={null}
  curl -X PATCH "https://app.talkover.ai/api/v1/agents/550e8400-e29b-41d4-a716-446655440000/advanced-settings" \
    -H "Authorization: Bearer talq_your_environment_token_here" \
    -H "Content-Type: application/json" \
    -d '{
      "enable_initial_message_cache": true
    }'
  ```

  ```javascript theme={null}
  const response = await fetch('https://app.talkover.ai/api/v1/agents/550e8400-e29b-41d4-a716-446655440000/advanced-settings', {
    method: 'PATCH',
    headers: {
      'Authorization': 'Bearer talq_your_environment_token_here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      enable_initial_message_cache: true
    })
  });

  const result = await response.json();
  ```
</RequestExample>

## Resposta

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "message": "Advanced settings updated successfully",
    "data": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "SupportBot",
      "advanced_settings": {
        "enable_initial_message_cache": true
      },
      "updated_at": "2024-01-15T11:00:00Z"
    }
  }
  ```
</ResponseExample>

## Respostas de erro

### 422 Não Elegível

<ResponseExample>
  ```json theme={null}
  {
    "success": false,
    "message": "Agent does not meet the call volume threshold for optimized costs",
    "code": "OPTIMIZED_COSTS_NOT_ELIGIBLE",
    "details": {
      "current_calls": 312,
      "required_calls": 700,
      "threshold_days": 7
    }
  }
  ```
</ResponseExample>

## Observações

* A elegibilidade é aplicada no servidor. Alternar `enable_initial_message_cache: true` em um agente não elegível falha com `422`.
* Desabilitar o cache (`false`) é sempre permitido.
