Skip to main content
POST
/
v1
/
public
/
topic-votes.create
curl --location --request POST 'https://api.yourapp.com/v1/public/topic-votes.create' \
--header 'Authorization: Bearer SUBSCRIBER_JWT_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
  "id": "topic-uuid-123"
}'
{
  "data": {
    "id": "vote-uuid",
    "topicId": "topic-uuid-123",
    "creatorId": "sub-uuid-789",
    "createdAt": "2024-01-17T16:00:00Z"
  }
}

Authentication

Authorization: Bearer SUBSCRIBER_JWT_TOKEN

Request Body

id
string
required
Topic ID (UUID) to vote on

Response

data
object
Created vote object
curl --location --request POST 'https://api.yourapp.com/v1/public/topic-votes.create' \
--header 'Authorization: Bearer SUBSCRIBER_JWT_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
  "id": "topic-uuid-123"
}'
{
  "data": {
    "id": "vote-uuid",
    "topicId": "topic-uuid-123",
    "creatorId": "sub-uuid-789",
    "createdAt": "2024-01-17T16:00:00Z"
  }
}

Error Responses

Not Authenticated
{
  "error": "Bad request"
}
Already Voted
{
  "error": "Duplicate vote"
}

Behavior

  • One Vote Per Subscriber: Each subscriber can only vote once
  • Database Constraint: Prevents duplicate votes

Notes

  • Requires subscriber authentication
  • Returns error if already voted
  • Vote immediately visible in count