# Create Vote

Now that you have a Poll with some options, let's go ahead and add vote to it.

## Add vote to an option in a poll

<mark style="color:green;">`POST`</mark> `https://api.pollsapi.com/v1/create/vote`

This endpoint helps you add a vote to an option

#### Headers

| Name         | Type   | Description              |
| ------------ | ------ | ------------------------ |
| Content-Type | string | application/json         |
| api-key      | string | API Key for your account |

#### Request Body

| Name       | Type   | Description                                            |
| ---------- | ------ | ------------------------------------------------------ |
| poll\_id   | string | ID of the Poll on which the vote will be added         |
| option\_id | string | ID of the Option the vote will be on                   |
| identifier | string | Custom field that can be used to store some identifier |

{% tabs %}
{% tab title="200 Poll Created" %}

```javascript
{
  "status": "success",
  "statusCode": 200,
  "data": {
    "identifier": "user_12",
    "poll_id": "5f9f7b186477891e5bc646a1",
    "option_id": "5f9f7b186477891e5bc646a2",
    "created_at": "2020-11-02T06:24:24.760Z",
    "updated_at": "2020-11-02T06:24:24.760Z",
    "id": "5f9fa6186477891e5bc646a5",
    "entity": "Vote"
  }
}



```

{% endtab %}
{% endtabs %}

### Example cURL Request

```bash
curl -X POST https://api.pollsapi.com/v1/create/vote \
  -H "content-type: application/json" \
  -H "api-key: $API_KEY" \
  -d '
  {
      "poll_id": "5f9f7b186477891e5bc646a1",
      "option_id": "5f9f7b186477891e5bc646a2",
      "identifier": "user_12"
  }
  '
```

### Request Body

```javascript
{
    "poll_id": "5f9f7b186477891e5bc646a1",
    "option_id": "5f9f7b186477891e5bc646a2",
    "identifier": "user_12"
}
```


---

# Agent Instructions: 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:

```
GET https://docs.pollsapi.com/api/add-vote.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
