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 }valuemust be exactly1or-1(anything else →400).- An identical repeat is idempotent: the backend upserts on a partial unique index (
user + post,user + reply, oruser + 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
| Endpoint | Method | Returns |
|---|---|---|
/api/votes | GET | Paginated votes. Filters: boardId, threadId, postId, page, limit (max 100). |
/api/votes/board/:boardId | GET | Votes across a board (limit 100). |
/api/votes/thread/:threadId | GET | Votes across a thread (limit 100). |
/api/votes/user/:userId | GET | A user’s votes (limit 100). |
/api/votes/counts | GET | Aggregated { targetId: { total, upvotes, downvotes } }. |
/api/votes/state | POST | Batch 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
totalVoteScorebynewValue - oldValue. Self-votes never count toward reputation. - Vote points — a first upvote on approved content awards
10 × board.votePointsMultiplierpoints, credited to the author’s pending points and markedpointsAwardedon the vote so it cannot be awarded twice. Self-votes and unapproved content do not earn points. See Points & scoring. - Hot score — post/thread
hotScoreandcontroversyScoreare recalculated after vote-count changes.