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

# Send presence

> Shows typing, recording, or pause for a chat

**Auth:** `TokenAccount` or `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotent:** yes (ephemeral)

Emits a presence indicator ("typing...", "recording audio...", or pause) to a chat. Ideal to simulate realistic interaction before sending a message.

## Examples

### Typing for 5s

Shows the "typing..." indicator on the recipient's chat and automatically dispatches `pause` after 5 seconds (thanks to `duration: 5`). Ideal to precede sending a text message.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/chat/presence/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "number": "5511999999999",
      "state": "typing",
      "duration": 5
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/chat/presence/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      number:   "5511999999999",
      state:    "typing",
      duration: 5
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/chat/presence/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "number":   "5511999999999",
          "state":    "typing",
          "duration": 5
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "number": "5511999999999",
          "state": "typing",
          "duration": 5
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/chat/presence/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Recording audio

Displays "recording audio..." with `state: "recording"`. Without `duration`, the indicator stays until WhatsApp expires it naturally (\~5–10s) or until you send `pause` manually.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/chat/presence/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "number": "5511999999999",
      "state": "recording"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/chat/presence/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      number: "5511999999999",
      state:  "recording"
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/chat/presence/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "number": "5511999999999",
          "state":  "recording"
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "number": "5511999999999",
          "state": "recording"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/chat/presence/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Cancel indicator

With `state: "pause"`, immediately ends any active "typing..." or "recording..." indicator on the chat. Useful when an automated flow ends before the planned `duration`.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/chat/presence/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "number": "5511999999999",
      "state": "pause"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/chat/presence/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      number: "5511999999999",
      state:  "pause"
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/chat/presence/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "number": "5511999999999",
          "state":  "pause"
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "number": "5511999999999",
          "state": "pause"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/chat/presence/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Success response

<Tabs>
  <Tab title="With duration">
    ```json 200 OK theme={null}
    {
      "success": true,
      "message": "Presence 'typing' sent successfully (will auto-pause after 5 seconds)",
      "chat_jid": "5511999999999@s.whatsapp.net",
      "state": "typing",
      "duration": 5
    }
    ```
  </Tab>

  <Tab title="Without duration">
    ```json 200 OK theme={null}
    {
      "success": true,
      "message": "Presence 'typing' sent successfully",
      "chat_jid": "5511999999999@s.whatsapp.net",
      "state": "typing",
      "duration": 0
    }
    ```
  </Tab>
</Tabs>

## Path parameters

<ParamField path="instance" type="string" required>
  Instance name.
</ParamField>

## Headers

<ParamField header="token" type="string" required>
  TokenAccount or TokenInstance.
</ParamField>

## Request body

<ParamField body="number" type="string" required>
  Phone number or JID of the chat.
</ParamField>

<ParamField body="state" type="string" required>
  `typing` / `recording` / `pause` / `paused` (case-insensitive).
</ParamField>

<ParamField body="duration" type="int" default="0">
  Seconds until auto-pause (0–60). When >0 and `state` is `typing`/`recording`, the API automatically sends `pause` after that interval. Ignored when `pause`/`paused`.
</ParamField>

## Accepted states

| `state`            | Effect                              |
| ------------------ | ----------------------------------- |
| `typing`           | "typing..." on the recipient's chat |
| `recording`        | "recording audio..."                |
| `pause` / `paused` | Cancels any current indicator       |

## Notes

<Note>
  * Presences are ephemeral, they are not persisted, and WhatsApp expires the indicator on the recipient's phone in \~5–10s even without an explicit pause.
  * `duration > 60` is truncated to 60 (internal cap).
  * In chats where the recipient disabled presence acknowledgments, the indicator may not appear.
</Note>

## Error responses

| HTTP | `error.message`                                            | When               |
| ---- | ---------------------------------------------------------- | ------------------ |
| 400  | `Invalid request body`                                     | Malformed JSON.    |
| 400  | `Number is required`                                       | Missing field.     |
| 400  | `State is required. Use 'typing', 'recording', or 'pause'` | Empty `state`.     |
| 400  | `Invalid state. Use 'typing', 'recording', or 'pause'`     | Outside the enum.  |
| 401  | `Invalid token`                                            | ,                  |
| 404  | `Instance not found`                                       | ,                  |
| 503  | `Instance is not connected to WhatsApp`                    | No active session. |
