Skip to content

Vote on a poll

POST
/cms/poll/{id}
curl --request POST \
--url https://api.example.com/cms/poll/example \
--header 'API-Key: <API-Key>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--data '{ "choice": 1, "product": "example", "paywall_id": "example", "paywall_key": "example", "phone_number": "example" }'
id
required
string

Vote payload

Media typeapplication/json
object
choice
required

Selected choice id

integer
product

For paywall voting rewards: Product identifier

string
paywall_id

For paywall voting rewards: Existing paywall ID

string
paywall_key

For paywall voting rewards: Existing paywall key

string
phone_number

Phone number for SMS validation (required if poll has SMS validation enabled)

string

Example generated

{
"choice": 1,
"product": "example",
"paywall_id": "example",
"paywall_key": "example",
"phone_number": "example"
}

Vote recorded

Media typeapplication/json
Poll

API representation of a poll

object
id

Poll ID (numeric string)

string
timestamp

Timestamp, MySQL datetime (Y-m-d H:i:s)

string
question

Question

string
choices

Choices

Array<object>
object
num

Choice number

integer
text

Choice text

string
image_url

Choice image URL (only when the choice has an image)

string
votes

Votes

integer
slug

Slug

string
category
PollCategory

API representation of a poll category

object
id

Category ID (numeric string)

string
name

Name

string
image

Image URL, or false when the poll has no image

One of:
string
results

Results, keyed by choice number, plus a total key with the total number of votes

object
total

Total number of votes

integer
key
additional properties
object
value

Number of votes

integer
percentage

Percentage of total votes, formatted with one decimal (e.g. “100.0”); the integer 0 when there are no votes

One of:
string
message

Message

string
nullable
onlyLoggedIn

Only logged in (“0” or “1”)

string
endDate

End date

string
nullable
voted

Voted (only true when voting)

boolean
voted_choice

Voted choice (only valid when voting); false when voting status is not included

One of:
integer
closed

Closed (“0” or “1”)

string

Example

{
"id": "7",
"timestamp": "2024-12-17 16:32:19",
"choices": [
{
"num": 1,
"text": "I like this"
}
],
"category": {
"id": "1"
},
"image": false,
"results": {
"1": {
"value": 16,
"percentage": "100.0"
},
"2": {
"value": 0,
"percentage": "0.0"
},
"total": 16
},
"onlyLoggedIn": "0",
"voted_choice": false,
"closed": "0"
}