Skip to Content
Voting

Voting

Votes power ranking and points. A vote is +1 (up), -1 (down), or 0 (removed). The same endpoint votes on a post, a reply, or an article — the backend resolves what the postId points at.

POST /api/votes and DELETE /api/votes/:userId/:postId require the x-wallet-address header, and it must match the acting user’s Solana walletAddress or EVM evmAddress (case-insensitive). Missing header → 401; mismatched owner → 403.

Cast or change a vote

POST /api/votes x-wallet-address: 0xAbC... Content-Type: application/json { "userId": "<uuid|wallet>", "postId": "<post|reply|article id>", "value": 1 }
  • value must be exactly 1 or -1 (anything else → 400).
  • An identical repeat is idempotent: the backend upserts on a partial unique index (user + post, user + reply, or user + article) rather than inserting a second row.
  • To toggle, send the opposite value. To remove, use the delete endpoint, which sets value = 0 (it does not delete the row).

Writes run inside a transaction that locks the target row (SELECT ... FOR UPDATE), so concurrent votes on the same content cannot double-award points or miscount. That makes retries safe.

Remove a vote

DELETE /api/votes/:userId/:postId x-wallet-address: 0xAbC...

Read votes

EndpointMethodReturns
/api/votesGETPaginated votes. Filters: boardId, threadId, postId, page, limit (max 100).
/api/votes/board/:boardIdGETVotes across a board (limit 100).
/api/votes/thread/:threadIdGETVotes across a thread (limit 100).
/api/votes/user/:userIdGETA user’s votes (limit 100).
/api/votes/countsGETAggregated { targetId: { total, upvotes, downvotes } }.
/api/votes/statePOSTBatch viewer state. Body { userId, postIds: [] }, returns { voteState }.

Feeds also expose counts directly: voteCount is the net (up - down), alongside upvoteCount and downvoteCount. Passing userId to feeds injects a per-item userVote (1, -1, or null/0).

How votes affect reputation and points

  • Reputation — a vote changes the author’s totalVoteScore by newValue - oldValue. Self-votes never count toward reputation.
  • Vote points — a first upvote on approved content awards 10 × board.votePointsMultiplier points, credited to the author’s pending points and marked pointsAwarded on the vote so it cannot be awarded twice. Self-votes and unapproved content do not earn points. See Points & scoring.
  • Hot score — post/thread hotScore and controversyScore are recalculated after vote-count changes.