Votes represents positive and negative opinions of users about articles, article comments, posts or post comments.

JSON format

Votes are represented as JSON objects with the following properties:

NameTypeRead-onlyMandatoryDescription
created_atstringtruefalseThe time at which the vote was created
idintegertruefalseAutomatically assigned when the vote is created
item_idintegertruefalseThe id of the item for which this vote was cast
item_typestringtruefalseThe type of the item. Can be "Article", "Comment", "Post" or "PostComment"
updated_atstringtruefalseThe time at which the vote was last updated
urlstringtruefalseThe API url of this vote
user_idintegertruefalseThe id of the user who cast this vote
valueintegerfalsetrueThe value of the vote

Example

{  "created_at": "2012-04-04T09:14:57Z",  "id": 1635,  "item_id": 65466,  "item_type": "Article",  "user_id": 3465,  "value": 1}

List Votes

  • GET /api/v2/help_center/users/{user_id}/votes
  • GET /api/v2/help_center/{locale}/articles/{article_id}/votes
  • GET /api/v2/help_center/{locale}/articles/{article_id}/comments/{comment_id}/votes
  • GET /api/v2/community/posts/{post_id}/votes
  • GET /api/v2/community/posts/{post_id}/comments/{comment_id}/votes

Lists all votes cast by a given user, or all votes cast by all users for a given article, article comment, post, or post comment.

To list only your own votes, specify me as the user id.

The {locale} for article and article comment votes is required only for end users. Admins and agents can omit it.

Allowed for

  • End users

Pagination

  • Cursor pagination (recommended)
  • Offset pagination

See Pagination.

Sideloads

The following sideloads are supported:

NameWill sideload
usersauthors
articlesarticles
translationstranslations of any sideloaded articles
postsposts
commentscomments

Note that you must sideload articles in order to sideload translations.

On requests to the /api/v2/help_center/users/{user_id}/votes.json endpoint, article comments must be sideloaded using article_comments. The comments sideload will only return community comments.

You can also use different URL to perform this operation

ResourceURLRequired parameters
Article/api/v2/help_center{/locale}/articles/{article_id}/votesarticle_id: The Id of the Article
Comment/api/v2/help_center{/locale}/articles/{article_id}/comments/{comment_id}/votesarticle_id: The Id of the Article, comment_id: The ID of the comment
Post/api/v2/help_center/posts/{post_id}/votespost_id: The Id of the Post
Post Comment/api/v2/community/posts/{post_id}/comments/{post_comment_id}/votespost_id: The Id of the Post, post_comment_id: The ID of the post comment

Parameters

NameTypeInRequiredDescription
user_idintegerPathtrueThe unique ID of the user

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/users/{user_id}/votes.json \  -v -u {email_address}:{password}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://support.zendesk.com/api/v2/help_center/users/1234/votes"	method := "GET"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "username:password"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/help_center/users/1234/votes")		.newBuilder();
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", Credentials.basic("your-email", "your-password"))		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'GET',  url: 'https://support.zendesk.com/api/v2/help_center/users/1234/votes',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://support.zendesk.com/api/v2/help_center/users/1234/votes"headers = {	"Content-Type": "application/json",}
response = requests.request(	"GET",	url,	auth=('<username>', '<password>'),	headers=headers)
print(response.text)
Ruby
require "net/http"uri = URI("https://support.zendesk.com/api/v2/help_center/users/1234/votes")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")request.basic_auth "username", "password"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "votes": [    {      "id": 35467,      "user_id": 888887,      "value": -1    }  ]}

Show Vote

  • GET /api/v2/help_center/votes/{vote_id}

Allowed for

  • End users

Sideloads

The following sideloads are supported:

NameWill sideload
usersauthors
articlesarticles
translationstranslations of any sideloaded articles
postsposts
commentscomments

Note that you must sideload articles in order to sideload translations.

Parameters

NameTypeInRequiredDescription
vote_idintegerPathtrueThe unique ID of the vote

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/votes/{vote_id}.json \  -v -u {email_address}:{password}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://support.zendesk.com/api/v2/help_center/votes/35467"	method := "GET"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "username:password"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/help_center/votes/35467")		.newBuilder();
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", Credentials.basic("your-email", "your-password"))		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'GET',  url: 'https://support.zendesk.com/api/v2/help_center/votes/35467',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://support.zendesk.com/api/v2/help_center/votes/35467"headers = {	"Content-Type": "application/json",}
response = requests.request(	"GET",	url,	auth=('<username>', '<password>'),	headers=headers)
print(response.text)
Ruby
require "net/http"uri = URI("https://support.zendesk.com/api/v2/help_center/votes/35467")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")request.basic_auth "username", "password"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "vote": {    "id": 35467,    "user_id": 888887,    "value": -1  }}

Create Vote

  • POST /api/v2/help_center/{locale}/articles/{article_id}/up
  • POST /api/v2/help_center/articles/{article_id}/up
  • POST /api/v2/help_center/articles/{article_id}/down
  • POST /api/v2/help_center/articles/{article_id}/comments/{comment_id}/up
  • POST /api/v2/help_center/articles/{article_id}/comments/{comment_id}/down
  • POST /api/v2/community/posts/{post_id}/up
  • POST /api/v2/community/posts/{post_id}/down
  • POST /api/v2/community/posts/{post_id}/comments/{comment_id}/up
  • POST /api/v2/community/posts/{post_id}/comments/{comment_id}/down

Creates an up or down vote for a given article, article comment, post, or post comment. If a vote already exists for the source object, it's updated.

Allowed for

  • End users

Agents with the Help Center manager role can optionally supply a vote object containing a user_id value. If provided, the vote will be cast by the user associated with user_id.

Agents with the Help Center manager role can also specify created_at as part of the vote object. If it is not provided created_at is set to the current time.

You can also use different URL to perform this operation, depending on the object you want to vote:

ResourceVoteURLRequired parameters
ArticleDown/api/v2/help_center/articles/{article_id}/downarticle_id: The Id of the Article
CommentUp/api/v2/help_center/articles/{article_id}/comments/{comment_id}/uparticle_id: The Id of the Article, comment_id: The ID of the comment
CommentDown/api/v2/help_center/articles/{article_id}/comments/{comment_id}/downarticle_id: The Id of the Article, comment_id: The ID of the comment
PostUp/api/v2/help_center/posts/{post_id}/uppost_id: The Id of the Post
PostDown/api/v2/help_center/posts/{post_id}/downpost_id: The Id of the Post
Post CommentUp/api/v2/community/posts/{post_id}/comments/{post_comment_id}/uppost_id: The Id of the Post, post_comment_id: The ID of the post comment
Post CommentDown/api/v2/community/posts/{post_id}/comments/{post_comment_id}/downpost_id: The Id of the Post, post_comment_id: The ID of the post comment

Parameters

NameTypeInRequiredDescription
article_idintegerPathtrueThe unique ID of the article
localestringPathtrueThe locale the item is displayed in

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/up.json \  -v -u {email_address}:{password} -X POST -H "Content-Type: application/json"
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/comments/{comment_id}/up.json \  -v -u {email_address}:{password} -X POST -H "Content-Type: application/json"
curl https://{subdomain}.zendesk.com/api/v2/community/posts/{post_id}/up.json \  -v -u {email_address}:{password} -X POST -H "Content-Type: application/json"
curl https://{subdomain}.zendesk.com/api/v2/community/posts/{post_id}/comments/{post_comment_id}/up.json \  -v -u {email_address}:{password} -X POST -H "Content-Type: application/json"
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/down.json \  -d '{"vote": {"user_id": 10056}}' \  -v -u {email_address}:{password} -X POST -H "Content-Type: application/json"
curl https://{subdomain}.zendesk.com/api/v2/community/posts/{post_id}/down.json \  -d '{"vote": {"user_id": 10056}}' \  -v -u {email_address}:{password} -X POST -H "Content-Type: application/json"
curl https://{subdomain}.zendesk.com/api/v2/community/posts/{post_id}/comments/{post_comment_id}/down.json \  -d '{"vote": {"user_id": 10056}}' \  -v -u {email_address}:{password} -X POST -H "Content-Type: application/json"
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/up"	method := "POST"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "username:password"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/up")		.newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),		"""""");
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("POST", body)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", Credentials.basic("your-email", "your-password"))		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'POST',  url: 'https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/up',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/up"headers = {	"Content-Type": "application/json",}
response = requests.request(	"POST",	url,	auth=('<username>', '<password>'),	headers=headers)
print(response.text)
Ruby
require "net/http"uri = URI("https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/up")request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")request.basic_auth "username", "password"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "vote": {    "id": 37486578,    "value": 1  }}

Delete Vote

  • DELETE /api/v2/help_center/votes/{vote_id}

Allowed for

  • End users

Parameters

NameTypeInRequiredDescription
vote_idintegerPathtrueThe unique ID of the vote

Code Samples

Curl
curl --request DELETE https://support.zendesk.com/api/v2/help_center/votes/35467 \--header "Content-Type: application/json" \-u username:password
curl https://{subdomain}.zendesk.com/api/v2/help_center/votes/{vote_id}.json \  -v -u {email_address}:{password} -X DELETE
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://support.zendesk.com/api/v2/help_center/votes/35467"	method := "DELETE"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "username:password"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/help_center/votes/35467")		.newBuilder();
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("DELETE", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", Credentials.basic("your-email", "your-password"))		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'DELETE',  url: 'https://support.zendesk.com/api/v2/help_center/votes/35467',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://support.zendesk.com/api/v2/help_center/votes/35467"headers = {	"Content-Type": "application/json",}
response = requests.request(	"DELETE",	url,	auth=('<username>', '<password>'),	headers=headers)
print(response.text)
Ruby
require "net/http"uri = URI("https://support.zendesk.com/api/v2/help_center/votes/35467")request = Net::HTTP::Delete.new(uri, "Content-Type": "application/json")request.basic_auth "username", "password"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

204 No Content
// Status 204 No Content
null