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

# Atualizar Sessão

> Atualiza configurações de uma sessão

Atualiza o nome, configurações de grupo ou webhook de uma sessão existente.

## Path Parameters

<ParamField path="id" type="string" required>
  ID da sessão (UUID).
</ParamField>

## Request Body

<ParamField body="name" type="string">
  Novo nome da sessão.
</ParamField>

<ParamField body="allowGroup" type="boolean">
  Habilitar/desabilitar mensagens de grupo.
</ParamField>

<ParamField body="webhookUrl" type="string">
  Nova URL do webhook. Use `null` para remover.
</ParamField>

<ParamField body="webhookEvents" type="string[]">
  Novos eventos do webhook.
</ParamField>

<ParamField body="webhookSecret" type="string">
  Novo secret do webhook.
</ParamField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl -X PUT "https://api.oxenty.api.br/api/sessions/550e8400-e29b-41d4-a716-446655440000" \
    -H "X-API-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "atendimento-vip",
      "allowGroup": false,
      "webhookUrl": "https://novo-servidor.com/webhook"
    }'
  ```

  ```typescript TypeScript theme={"system"}
  const session = await client.sessions.update(
    '550e8400-e29b-41d4-a716-446655440000',
    {
      name: 'atendimento-vip',
      allowGroup: false,
      webhookUrl: 'https://novo-servidor.com/webhook',
    }
  );
  ```

  ```python Python theme={"system"}
  session = client.sessions.update(
      '550e8400-e29b-41d4-a716-446655440000',
      name='atendimento-vip',
      allow_group=False,
      webhook_url='https://novo-servidor.com/webhook'
  )
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={"system"}
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "atendimento-vip",
    "status": "connected",
    "phone": "5511999999999",
    "allowGroup": false,
    "webhookUrl": "https://novo-servidor.com/webhook",
    "webhookEvents": ["message.received", "message.status"],
    "hasWebhook": true,
    "createdAt": "2024-01-15T10:00:00.000Z",
    "updatedAt": "2024-01-15T12:00:00.000Z",
    "connectedAt": "2024-01-15T10:05:00.000Z"
  }
  ```

  ```json 404 Not Found theme={"system"}
  {
    "statusCode": 404,
    "error": "SESSION_NOT_FOUND",
    "message": "Sessão não encontrada"
  }
  ```

  ```json 409 Conflict theme={"system"}
  {
    "statusCode": 409,
    "error": "SESSION_ALREADY_EXISTS",
    "message": "Já existe uma sessão com o nome 'atendimento-vip'"
  }
  ```
</ResponseExample>
