> ## 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.

# Set Presence of the Session

> Set the presence status (online/offline) of the WhatsApp session

## Description

This endpoint allows you to set the presence status of the WhatsApp session, controlling whether the account appears as available (online) or unavailable (offline) to other users.

## URL Parameters

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

## Body

```json theme={null}
{
  "status": "value"
}
```

### Body Parameters

| Property | Type     | Required | Description                                                                                                                              |
| -------- | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `status` | `string` | ✅ Yes    | Presence status to be set. Accepted values: - `AVAILABLE` - Appears as available/online - `UNAVAILABLE` - Appears as unavailable/offline |

## Response

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "message": "Presence updated successfully",
    "status": "AVAILABLE"
  }
  ```
</ResponseExample>

## Status Codes

* `200` - Presence updated successfully
* `400` - Invalid parameters (status must be AVAILABLE or UNAVAILABLE)
* `401` - Unauthorized
* `404` - Session not found

## Usage Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.wappfy.com.br/api/my-session/presence \
    -H "Content-Type: application/json" \
    -d '{
      "status": "AVAILABLE"
    }'
  ```

  ```javascript JavaScript theme={null}
  const session = 'my-session';
  const response = await fetch(`https://api.wappfy.com.br/api/${session}/presence`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      status: 'AVAILABLE'
    })
  });
  const data = await response.json();
  console.log(data);
  ```

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

  session = 'my-session'
  response = requests.post(
    f'https://api.wappfy.com.br/api/{session}/presence',
    json={'status': 'AVAILABLE'}
  )
  data = response.json()
  print(data)
  ```
</CodeGroup>

## Notes

* The `AVAILABLE` status will make the account appear as online to other users
* The `UNAVAILABLE` status will make the account appear as offline
* This setting can be useful for controlling the visibility of the automation's presence


## OpenAPI

````yaml viewer-en.json post /api/{session}/presence
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}/presence:
    post:
      tags:
        - ✅ Presence
      summary: Set session presence
      description: The {session} parameter must be the session's instanceName.
      operationId: PresenceController_setPresence
      parameters:
        - name: session
          required: true
          in: path
          description: Session name (instanceName)
          example: my-session
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WAHASessionPresence'
      responses:
        '201':
          description: ''
      security:
        - api_key: []
components:
  schemas:
    WAHASessionPresence:
      type: object
      properties:
        chatId:
          type: string
          description: Chat ID - either group id or contact id
          example: 5511999999999@c.us
        presence:
          type: string
          enum:
            - offline
            - online
            - typing
            - recording
            - paused
      required:
        - chatId
        - presence
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: apikey
      description: Your Wappfy API key (get it at dash.wappfy.com.br)

````