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

integer format: int64
timestamp

Timestamp

string
question

Question

string
choices

Choices

Array<string>
votes

Votes

integer
slug

Slug

string
category
PollCategory

API representation of a poll category

object
id

Category ID

integer format: int64
name

Name

string
image

Image

string
results

Results

Array<object>
object
value

Number of votes

integer format: int64
percentage

Percentage of total votes

number format: float
message

Message

string
onlyLoggedIn

Only logged in

integer
endDate

End date

string
nullable
voted

Voted (only true when voting)

boolean
voted_choice

Voted choice (only valid when voting)

integer
closed

Closed

integer

Example generated

{
"id": 1,
"timestamp": "example",
"question": "example",
"choices": [
"example"
],
"votes": 1,
"slug": "example",
"category": {
"id": 1,
"name": "example"
},
"image": "example",
"results": [
{
"value": 1,
"percentage": 1
}
],
"message": "example",
"onlyLoggedIn": 1,
"endDate": "example",
"voted": true,
"voted_choice": 1,
"closed": 1
}