> For the complete documentation index, see [llms.txt](https://dadocs.rickyjs.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dadocs.rickyjs.xyz/endpoints/poll/create.md).

# /create

{% hint style="danger" %}
This endpoint is only on the **BETA Version** of the API and may be unstable.

> Please report any & all bugs to the [Support Server](https://discord.com/invite/9s65BZDrbV)
> {% endhint %}

### Endpoint Headers:

* bot-token - Token of the Bot <mark style="color:orange;">**\[String]**</mark> (<mark style="color:red;">**Required**</mark>)&#x20;
* apikey - Your Api Auth Key <mark style="color:orange;">**\[String]**</mark> (<mark style="color:red;">**Required**</mark>)
* guild-id - ID of the guild to be fetched <mark style="color:orange;">**\[Snowflake]**</mark> (<mark style="color:red;">**Required**</mark>)&#x20;
* channel-id - ID of the channel to send the poll in <mark style="color:orange;">**\[Snowflake]**</mark> (<mark style="color:red;">**Required**</mark>)&#x20;

### Endpoint Body Parameters

* question - The question to ask <mark style="color:orange;">**\[String]**</mark> (<mark style="color:red;">**Required**</mark>)
* answers - Array of answer objects to choose from <mark style="color:orange;">**\[Array]**</mark> (<mark style="color:red;">**Required**</mark>) *(See below)*
* duration - How long, in hours, the poll runs for, default 24 <mark style="color:orange;">**\[Integer]**</mark> (<mark style="color:green;">**Optional**</mark>)
* multiselect - Allow users to select multiple answers, default false <mark style="color:orange;">**\[Boolean]**</mark> (<mark style="color:green;">**Optional**</mark>)
* content - Message content outside the poll to send <mark style="color:orange;">**\[String]**</mark> (<mark style="color:green;">**Optional**</mark>)

### Answer Objects

The `answers` array will consist of an object for each choice

* text - The actual content of the answer choice <mark style="color:orange;">**\[String]**</mark> (<mark style="color:red;">**Required**</mark>)
* emoji - An emoji object to display on the answer choice <mark style="color:orange;">**\[Object]**</mark> (<mark style="color:green;">**Optional**</mark>)

### Emoji Objects

Within the answer objects, is also an emoji object

* name - Name of emoji, only use for default discord emojis <mark style="color:orange;">**\[Unicode Emoji]**</mark> (<mark style="color:green;">**Optional**</mark>)\*
* id - Id of emoji, only use for custom emojis <mark style="color:orange;">**\[Snowflake]**</mark> (<mark style="color:green;">**Optional**</mark>)\*

{% hint style="warning" %}
&#x20;\* If using an emoji in an answer, at least one field is required.
{% endhint %}

### Examples:

{% hint style="info" %}
Data API version required. Must replace `<version>` with either **release** or **beta**.
{% endhint %}

<details>

<summary>Bot Designer for Discord</summary>

Example usage of `/poll/create` endpoint using BDFD

```bash
$httpAddHeader[apikey;<YOUR-API-KEY>]
$httpAddHeader[bot-token;<YOUR-BOT-TOKEN>]
$httpAddHeader[guild-id;1064100501764968492] 
$httpAddHeader[channel-id;106410057927968435] 
$httpPost[https://bdfddata.rickyjs.xyz/<version>/poll/create;{
"question": "How are you today",
 "answers": [
   {
     "text": "I'm doing alright",
   	"emoji": {"name": "👍"}
   },
   {
   "text": "I'm not okay.",
    "emoji": {"name": "👎"}
   }
 ],
  "duration": 24, $c[24 hours]
}]


$httpResult OR $httpResult[details]
```

</details>

<details>

<summary>Discord.js</summary>

Example usage of `/poll/create` endpoint using Discord.js

```javascript
const axios = require('axios');
(async () => {
return await axios.get('https://bdfddata.rickyjs.xyz/<version>/poll/create', {
"question": "How are you today",
 "answers": [
   {
     "text": "I'm doing alright",
   	"emoji": {"name": "👍"}
   },
   {
   "text": "I'm not okay.",
    "emoji": {"name": "👎"}
   }
 ],
  "duration": 24, //24 hours
},{
headers: {
"apikey": "<YOUR-API-KEY>",
"bot-token": "<YOUR-BOT-TOKEN>",
"guild-id": "16938230564996837",
"channel-id": "95727989795685839" 
}
}).then(res=>res.data)
})()
```

</details>

### Possible Responses (Codes)

<details>

<summary>Code 200 </summary>

API succeeded and details were fetched.

```javascript
{
  status: 200,
    details:  {
    // will return full message object, but here is how the poll looks
        "poll": {
            "question": {
                "text": "?"
            },
            "answers": [{
                "answer_id": 1,
                "poll_media": {
                    "text": "Do it!",
                    "emoji": {
                        "id": null,
                        "name": "👍"
                    }
                }
            }, {
                "answer_id": 2,
                "poll_media": {
                    "text": "It's not necessary",
                    "emoji": {
                        "id": null,
                        "name": "👎"
                    }
                }
            }],
            "expiry": "2025-06-18T13:38:36.734927+00:00",
            "allow_multiselect": true,
            "layout_type": 1,
            "results": {
                "answer_counts": [],
                "is_finalized": false
            }
        }
    }
    
    // Read more on Message Object: https://discord.com/developers/docs/resources/message#messages-resource
}
```

</details>

<details>

<summary>Code 400</summary>

An error occurred that stopped execution.

```javascript
{
    status: 400
    error: 'Cannot read ...  (This can vary)'
}
```

</details>

<details>

<summary>Code 401</summary>

Invalid bot token was provided.

```javascript
{
  status: 401,
  details: { message: '401: Unauthorized', code: 0 }
}
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dadocs.rickyjs.xyz/endpoints/poll/create.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
