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

> Creates a poll with single or multiple-choice options

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

## Description

Sends a poll to a 1-to-1 contact, group (`@g.us`) or newsletter (`@newsletter`). Supports **2 to 12 options** (WhatsApp limit). The `maxAnswer` field controls how many options the user can select: `1` (default) = single choice; `> 1` = multiple choice. If `maxAnswer` is omitted, invalid (`< 1`) or larger than `len(options)`, the server normalizes it automatically to `1` or to the total number of options, respectively. Supports `delay`, `replyTo` and `replyPrivate`.

## Examples

### Simple poll (single choice)

Creates a poll with three options (`9am`, `2pm`, `4pm`) and `maxAnswer` implicitly set to `1`, the respondent can only pick one.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/message/poll/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "number":   "5511999999999",
      "question": "Which time works best for the meeting?",
      "options":  ["9am", "2pm", "4pm"]
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/message/poll/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      number:   "5511999999999",
      question: "Which time works best for the meeting?",
      options:  ["9am", "2pm", "4pm"]
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/message/poll/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "number":   "5511999999999",
          "question": "Which time works best for the meeting?",
          "options":  ["9am", "2pm", "4pm"]
      }
  )
  ```

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

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

  func main() {
      body := strings.NewReader(`{
          "number":   "5511999999999",
          "question": "Which time works best for the meeting?",
          "options":  ["9am", "2pm", "4pm"]
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/message/poll/"+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>

### Multiple-choice poll

`maxAnswer: 3` lets the respondent pick up to three options.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/message/poll/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "number":    "120363406289005073@g.us",
      "question":  "Which languages do you use day-to-day?",
      "options":   ["Go", "Python", "JavaScript", "TypeScript", "Rust", "Java"],
      "maxAnswer": 3
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/message/poll/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      number:    "120363406289005073@g.us",
      question:  "Which languages do you use day-to-day?",
      options:   ["Go", "Python", "JavaScript", "TypeScript", "Rust", "Java"],
      maxAnswer: 3
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/message/poll/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "number":    "120363406289005073@g.us",
          "question":  "Which languages do you use day-to-day?",
          "options":   ["Go", "Python", "JavaScript", "TypeScript", "Rust", "Java"],
          "maxAnswer": 3
      }
  )
  ```

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

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

  func main() {
      body := strings.NewReader(`{
          "number":    "120363406289005073@g.us",
          "question":  "Which languages do you use day-to-day?",
          "options":   ["Go", "Python", "JavaScript", "TypeScript", "Rust", "Java"],
          "maxAnswer": 3
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/message/poll/"+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>

### Poll as a reply to a message

Quotes an existing message via `replyTo`. The original message must belong to the same instance.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/message/poll/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "number":   "5511999999999",
      "question": "Are you confirming the event on date X?",
      "options":  ["Yes, confirmed", "Can't make it", "Maybe"],
      "replyTo":  "3EB08FCF27E532F1B0F5",
      "delay":    2
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/message/poll/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      number:   "5511999999999",
      question: "Are you confirming the event on date X?",
      options:  ["Yes, confirmed", "Can't make it", "Maybe"],
      replyTo:  "3EB08FCF27E532F1B0F5",
      delay:    2
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/message/poll/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "number":   "5511999999999",
          "question": "Are you confirming the event on date X?",
          "options":  ["Yes, confirmed", "Can't make it", "Maybe"],
          "replyTo":  "3EB08FCF27E532F1B0F5",
          "delay":    2
      }
  )
  ```

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

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

  func main() {
      body := strings.NewReader(`{
          "number":   "5511999999999",
          "question": "Are you confirming the event on date X?",
          "options":  ["Yes, confirmed", "Can't make it", "Maybe"],
          "replyTo":  "3EB08FCF27E532F1B0F5",
          "delay":    2
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/message/poll/"+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

The returned `content` pre-formats the question alongside the numbered options (`1. ... 2. ...`), it's the textual representation used to index the poll in the history. The `messageId` is what you need to keep around to correlate votes received via webhook.

```json 200 OK theme={null}
{
  "success": true,
  "message": "Poll sent successfully",
  "status":  "sent",
  "data": {
    "messageId":   "3EB08FCF27E532F1D3D3",
    "direction":   "sent",
    "messageType": "poll",
    "content":     "Which time works best for the meeting?\n\nOptions:\n1. 14:00\n2. 15:00\n3. 16:00\n",
    "source":      "api",
    "timestamp":   "2026-04-30T14:30:00Z",
    "chat": {
      "jid":     "5511999999999@s.whatsapp.net",
      "isGroup": false
    },
    "sender": {
      "jid":      "5511777777777@s.whatsapp.net",
      "instance": "my-instance"
    }
  }
}
```

<Note>
  Participant responses don't arrive synchronously in this response, they flow as `poll-update` events on the configured webhook/WebSocket, referencing the poll's `messageId`.
</Note>

## Path parameters

<ParamField path="instance" type="string" required>
  Instance name (e.g., `$Instance_Name`).
</ParamField>

## Headers

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

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

## Request body

<ParamField body="number" type="string" required>
  Destination: phone (`5511999999999`) or JID (`@s.whatsapp.net`, `@lid`, `@g.us`, `@newsletter`).
</ParamField>

<ParamField body="question" type="string" required>
  Question shown at the top of the poll.
</ParamField>

<ParamField body="options" type="string[]" required>
  List of options. **Minimum 2, maximum 12** (WhatsApp limit). Duplicate strings are accepted but not recommended.
</ParamField>

<ParamField body="maxAnswer" type="int" default="1">
  Maximum number of options the respondent can select. `1` = single choice; `> 1` = multiple choice. Values `< 1` are normalized to `1`; values larger than `len(options)` are clamped to the list size.
</ParamField>

<ParamField body="delay" type="int" default="0">
  Time in **seconds** to wait before sending. During the interval, the server shows the "typing..." indicator to the recipient and triggers "paused" before the actual send.
</ParamField>

<ParamField body="replyTo" type="string">
  ID of the message to reply to. The original message must belong to the same instance and be saved in the database.
</ParamField>

<ParamField body="replyPrivate" type="boolean" default="false">
  When `true` **and** `replyTo` points to a message originating from a group, the poll is redirected to the **private chat** of the original author (keeping the quote).
</ParamField>

<ParamField body="source" type="string" default="api">
  Origin identifier for traceability (e.g., `crm`, `support-bot`, `n8n`). Saved on the message record and propagated to webhooks.
</ParamField>

## Notes

<Note>
  * **`delay` is in seconds** (not milliseconds).
  * WhatsApp accepts **2 to 12 options** per poll. Anything more is truncated by the recipient's client.
  * `maxAnswer` is normalized by the server: `< 1` becomes `1`, and any value larger than `len(options)` falls back to `len(options)`.
  * Votes don't come back in this call, subscribe to webhook/WebSocket events to receive `poll-update` when someone votes.
  * On newsletters (`@newsletter`), polls may have limited behavior depending on channel permissions.
</Note>

## Errors

| HTTP | Internal status  | Message                                 |
| ---- | ---------------- | --------------------------------------- |
| 400  | ,                | `Instance name is required`             |
| 400  | ,                | `Invalid request body: <detail>`        |
| 400  | ,                | `Number is required`                    |
| 400  | ,                | `Question is required`                  |
| 400  | ,                | `At least 2 options are required`       |
| 400  | `invalid_number` | `Invalid phone number format: <detail>` |
| 404  | ,                | `Instance not found`                    |
| 500  | `send_failed`    | `Failed to send poll: <reason>`         |
| 503  | `disconnected`   | `Instance is not connected to WhatsApp` |

Error envelope:

```json theme={null}
{
  "success": false,
  "error": { "message": "At least 2 options are required" }
}
```
