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

# Update Label

> Update name and color of an existing label

## Description

This endpoint allows you to update information of an existing label, such as its name and color.

## URL Parameters

<ParamField path="session" type="string" required>
  WhatsApp unique session ID
</ParamField>

<ParamField path="labelId" type="string" required>
  ID of the label to be updated
</ParamField>

## Request Body

<ParamField body="name" type="string" required>
  New name of the label
</ParamField>

<ParamField body="color" type="number" required>
  New numeric code of the label color
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the label was updated successfully
</ResponseField>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "label": {
      "id": "label123",
      "name": "Premium Clients",
      "color": 3
    }
  }
  ```
</ResponseExample>

## Status Codes

* `200` - Label updated successfully
* `400` - Invalid parameters
* `401` - Unauthorized
* `404` - Label not found

## Usage Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT https://api.wappfy.com.br/api/my-session/labels/label123 \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Premium Clients",
      "color": 3
    }'
  ```

  ```javascript JavaScript theme={null}
  const session = 'my-session';
  const labelId = 'label123';
  const response = await fetch(`https://api.wappfy.com.br/api/${session}/labels/${labelId}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Premium Clients',
      color: 3
    })
  });
  const data = await response.json();
  console.log(data);
  ```

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

  session = 'my-session'
  label_id = 'label123'
  response = requests.put(
    f'https://api.wappfy.com.br/api/{session}/labels/{label_id}',
    json={
      'name': 'Premium Clients',
      'color': 3
    }
  )
  data = response.json()
  print(data)
  ```
</CodeGroup>


## OpenAPI

````yaml viewer-en.json put /api/{session}/labels/{labelId}
openapi: 3.1.0
info:
  title: Wappfy - WhatsApp HTTP API
  version: '2.0'
  contact: {}
servers:
  - url: https://{host}
    description: Customizable Server
    variables:
      host:
        default: api.wappfy.com.br
        description: Server URL (e.g., api.wappfy.com.br or your-server.com)
security:
  - api_key: []
tags:
  - name: 🖥️ Sessions
    description: Control WhatsApp sessions (accounts)
  - name: 🔑 Auth
    description: Authentication
  - name: 🆔 Profile
    description: Your profile information
  - name: 🖼️ Screenshot
    description: Get WhatsApp screenshot and display QR code
  - name: 📤 Chatting
    description: Conversation methods
  - name: 📢 Channels
    description: Channels (newsletters) methods
  - name: 🟢 Status
    description: Status (aka stories) methods
  - name: 💬 Chats
    description: Conversations methods
  - name: 👤 Contacts
    description: |-
      Contacts methods.<br>
                      Use phone number (without +) or phone number and `@c.us` at the end as `contactId`.<br>
                      E.g: `12312312310` OR `12312312310@c.us`<br>
  - name: 👥 Groups
    description: Groups methods.<br>
  - name: ✅ Presence
    description: Presence information
  - name: 📅 Events
    description: Event Message
  - name: 🏷️ Labels
    description: Labels - available only for WhatsApp Business accounts
  - name: 🔍 Observability
    description: Other methods
  - name: 🗄️ Storage
    description: Storage methods
externalDocs:
  description: Wappfy - WhatsApp API
  url: https://docs.wappfy.com.br/
paths:
  /api/{session}/labels/{labelId}:
    put:
      tags:
        - 🏷️ Labels
      summary: Update a label
      description: The {session} parameter must be the session's instanceName.
      operationId: LabelsController_update
      parameters:
        - name: labelId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LabelBody'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Label'
      security:
        - api_key: []
components:
  schemas:
    LabelBody:
      type: object
      properties:
        name:
          type: string
          example: Lead
          description: Label name
        colorHex:
          type: string
          example: '#ff9485'
          description: Color in hex
        color:
          type: number
          example: null
          description: Color number, not hex
      required:
        - name
    Label:
      type: object
      properties:
        id:
          type: string
          example: '1'
          description: Label ID
        name:
          type: string
          example: Lead
          description: Label name
        color:
          type: number
          example: 0
          description: Color number, not hex
        colorHex:
          type: string
          example: '#ff9485'
          description: Color in hex
      required:
        - id
        - name
        - color
        - colorHex
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: apikey
      description: Your Wappfy API key (get it at dash.wappfy.com.br)

````