Skip to main content

Vote Queries

Votes are exposed through the votes field on a Post; the public API does not have a top-level vote or votes query.

Get Votes for a Post

query GetPostVotes(
$postId: String!
$cursor: String
$limit: Int
) {
post(id: $postId) {
id
votes(cursor: $cursor, limit: $limit) {
nodes {
id
type
}
hasMore
cursor
}
}
}

Variables

{
"postId": "POST_ID",
"cursor": null,
"limit": 25
}

Arguments

FieldTypeDescription
postIdString!ID of the post whose votes you want to retrieve
cursorStringCursor returned by the previous page
limitIntNumber of votes to return; the server limits this to 1โ€“50 and defaults to 25

Return Type

Post.votes returns VotesPayload or null.

FieldTypeDescription
nodes[Vote]!Votes in the current page
hasMoreBoolean!Whether another page is available
cursorStringCursor to use for the next page

Each Vote has an id, a type (UP, DOWN, or CANCEL), its post, and the voting user when that user is available.

Vote details are returned only when the board's Voters field is public. If that field is private, nodes is empty. Include apikey, ssotype, and ssoid in the request headers.