Social API reference

Social API · Stories

post/v1/communities/{community_id}/posts/{post_id}/votesAuth

Cast or change a vote on a poll.

Last-vote-wins: an actor changing their vote replaces the prior one. 422 if the post has no poll, if `option_index` is out of range, or on self-vote of own poll. 409 if a block exists between voter and post author. Fires a `vote` notification to the post author.

Path parameters

community_id*string

Community UUID.

post_id*string

Post UUID containing the poll.

Headers

Idempotency-Keystring

Opaque client-generated string (1-256 chars, `[A-Za-z0-9._:-]`) that makes a retry safe: within 24 h a repeat with the same key and body returns the original response with `Idempotent-Replay: true` instead of running again. Same key with a different body is `409 IDEMPOTENCY_KEY_REUSE`.

Request body

actor_id*string · uuid

Voter social actor UUID.

Example: "aaaaaaaa-0000-0000-0000-000000000002"

option_index*number

Zero-based index into post.attributes.poll.options.

Example: 1

Response · 204

Vote recorded or replaced.

Example

Request

POST https://social.productcraft.co/v1/communities/{community_id}/posts/{post_id}/votes
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "actor_id": "aaaaaaaa-0000-0000-0000-000000000002",
  "option_index": 1
}