Skip to content

Vote on a poll option

POST
/posts/polls/{poll}/options/{option}/vote
curl --request POST \
--url https://feed.work.optidata.cloud/api/posts/polls/140/options/616/vote \
--header 'Authorization: Bearer <token>'

Casts the caller’s vote for a poll option. Fails with 422 if the option is not part of the poll, the poll has ended or has not started, or the caller has already voted for this option.

poll
required
integer

Numeric id of the poll.

option
required
integer

Numeric id of the poll option.

The recorded vote.

Media typeapplication/json
object
id
required
integer
poll_option_id
required
integer
user_id
required
integer
created_at
string format: date-time
updated_at
string format: date-time
Examples
Exampleexample
{
"id": 506,
"poll_option_id": 616,
"user_id": 38,
"created_at": "2026-10-19T14:39:04.000000Z",
"updated_at": "2026-10-19T14:39:04.000000Z"
}

No authentication key was sent.

Media typeapplication/json

Authentication failures use an error key.

object
error
required
string
Examples
Exampleexample
{
"error": "JWT passport exception: Missing bearer token in request"
}

No matching resource, or it is not reachable through this path.

Media typeapplication/json
object
message
required
string
Examples
Exampleexample
{
"message": "No query results for model [App\\Models\\Category] 864"
}

The authentication key is expired or not recognised. Get a fresh one and retry.

Media typeapplication/json

Authentication failures use an error key.

object
error
required
string
Examples
Exampleexample
{
"error": "JWT passport expired: Passport expired"
}

The vote is not valid. The errors map is keyed by the failed check (option_belongs_to_poll, is_expired, is_voted_by_user).

Media typeapplication/json
object
message
required

The first validation message.

string
errors
required

Messages keyed by field name.

object
key
additional properties
Array<string>
Examples
ExamplealreadyVoted
{
"message": "You have already voted on this poll.",
"errors": {
"is_voted_by_user": [
"You have already voted on this poll."
]
}
}