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

# Actualizar Etapa

> Actualiza el nombre o color de una etapa

<Info>
  **Scope requerido:** `funnels:write`
</Info>

Modifica las propiedades de una etapa existente. Solo envía los campos que quieres modificar.

***

## Path Parameters

<ParamField path="id" type="string" required>
  UUID de la etapa a actualizar
</ParamField>

***

## Body Parameters

<ParamField body="name" type="string">
  Nuevo nombre (1-100 caracteres)
</ParamField>

<ParamField body="color" type="string">
  Nuevo color en formato hex
</ParamField>

<Note>
  Envía solo los campos que quieres modificar.
</Note>

***

## Ejemplos

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH https://api.whaapy.com/funnel/v1/stages/550e8400-e29b-41d4-a716-446655440000 \
    -H "Authorization: Bearer wha_TU_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Hot Lead",
      "color": "#ef4444"
    }'
  ```

  ```javascript Node.js theme={null}
  const stageId = '550e8400-e29b-41d4-a716-446655440000';
  const response = await fetch(
    `https://api.whaapy.com/funnel/v1/stages/${stageId}`,
    {
      method: 'PATCH',
      headers: {
        'Authorization': 'Bearer wha_TU_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        name: 'Hot Lead',
        color: '#ef4444'
      })
    }
  );
  ```

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

  stage_id = '550e8400-e29b-41d4-a716-446655440000'
  response = requests.patch(
      f'https://api.whaapy.com/funnel/v1/stages/{stage_id}',
      headers={
          'Authorization': 'Bearer wha_TU_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'name': 'Hot Lead',
          'color': '#ef4444'
      }
  )
  ```

  ```php PHP theme={null}
  $stageId = '550e8400-e29b-41d4-a716-446655440000';
  $ch = curl_init("https://api.whaapy.com/funnel/v1/stages/{$stageId}");
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer wha_TU_API_KEY',
      'Content-Type: application/json'
  ]);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
      'name' => 'Hot Lead',
      'color' => '#ef4444'
  ]));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $response = curl_exec($ch);
  ```
</RequestExample>

***

## Respuesta Exitosa

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "stage": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Hot Lead",
      "position": 0,
      "color": "#ef4444",
      "contact_count": 120,
      "created_at": "2026-01-01T00:00:00Z",
      "updated_at": "2026-01-28T12:30:00Z"
    }
  }
  ```
</ResponseExample>

***

## Errores

### 400 Bad Request

<ResponseExample>
  ```json 400 Bad Request theme={null}
  {
    "error": "validation_error",
    "message": "Datos inválidos",
    "details": {
      "color": ["Color inválido. Usar formato hex: #RRGGBB"]
    }
  }
  ```
</ResponseExample>

### 404 Not Found

<ResponseExample>
  ```json 404 Not Found theme={null}
  {
    "error": "not_found",
    "message": "Etapa no encontrada"
  }
  ```
</ResponseExample>

***

## Webhooks

Cuando actualizas una etapa, se dispara el webhook `funnel_stage.updated`:

```json theme={null}
{
  "event": "funnel_stage.updated",
  "data": {
    "stage_id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Hot Lead",
    "color": "#ef4444",
    "updated_at": "2026-01-28T12:30:00Z"
  }
}
```

***

## Próximos Pasos

<CardGroup cols={2}>
  <Card title="Reordenar Etapas" icon="arrows-up-down" href="/api-reference/funnels/stages-reorder">
    Cambiar posición de etapas
  </Card>

  <Card title="Eliminar Etapa" icon="trash" href="/api-reference/funnels/stages-delete">
    Eliminar etapa
  </Card>
</CardGroup>
