Content Subscriptions
Users can subscribe to sections, articles, community posts, and community topics. Users are notified when somebody adds an article to a section, adds a comment to an article or a post, or adds a post to a topic.
JSON format
Content Subscriptions are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
content_id | integer | true | false | The id of the subscribed item |
content_type | string | true | false | The type of the subscribed item |
created_at | string | true | false | The time at which the subscription was created |
id | integer | true | false | Automatically assigned when the subscription is created |
include_comments | boolean | true | false | Subscribe also to article comments / post comments. Only for section / topic subscriptions. |
locale | string | true | true | The locale of the subscribed item |
source_locale | string | false | false | Used only for Create Section Subscription and Create Article Subscription, where it's mandatory. Selects the locale of the content to be subscribed |
updated_at | string | true | false | The time at which the subscription was last updated |
url | string | true | false | The API url of the subscription |
user_id | integer | true | false | The id of the user who has this subscription |
Example
{
"content_id": 65466,
"created_at": "2012-04-04T09:14:57Z",
"id": 1635,
"locale": "en-us",
"user_id": 3465
}
List Content Subscriptions By User
GET /api/v2/help_center/users/{user_id}/subscriptions
Lists the content subscriptions of a given user. To list your own subscriptions,
specify me
as the user id.
Allowed for
- End users
Pagination
- Cursor pagination (recommended)
- Offset pagination
See Pagination.
Sideloads
The following sideloads are supported:
Name | Will sideload | For |
---|---|---|
users | users | all |
articles | articles | article subscriptions |
sections | sections | section subscriptions |
questions | questions | question subscriptions |
topics | topics | topic subscriptions |
translations | translations | article or section subscriptions |
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
user_id | integer | Path | true | The unique ID of the user |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/users/{user_id}/subscriptions.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/help_center/users/1234/subscriptions"
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 "{email_address}/token:{api_token}"
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/subscriptions")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.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/subscriptions',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/help_center/users/1234/subscriptions"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/help_center/users/1234/subscriptions")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"subscriptions": [
{
"content_id": 8748733,
"content_type": "Article",
"id": 35467,
"locale": "en",
"user_id": 888887
}
]
}
List Topic Subscriptions
GET /api/v2/community/topics/{topic_id}/subscriptions
Lists the subscriptions to a given topic.
Allowed for
- End users
For end users, the response will list only the subscriptions created by the requesting end user.
Pagination
- Cursor pagination (recommended)
- Offset pagination
See Pagination.
Sideloads
The following sideloads are supported:
Name | Will sideload |
---|---|
users | users |
topics | topics |
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
topic_id | integer | Path | true | The unique ID of the topic |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/community/topics/{topic_id}/subscriptions.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions"
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 "{email_address}/token:{api_token}"
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/community/topics/360001326113/subscriptions")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"subscriptions": [
{
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
]
}
Show Topic Subscription
GET /api/v2/community/topics/{topic_id}/subscriptions/{subscription_id}
Allowed for
- End users
For end users, the response will only show a subscription created by the requesting end user.
Sideloads
The following sideloads are supported:
Name | Will sideload | For |
---|---|---|
users | users | all |
topics | topics | topic subscriptions |
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
subscription_id | integer | Path | true | The unique ID of the subscription |
topic_id | integer | Path | true | The unique ID of the topic |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/community/topics/{topic_id}/subscriptions/{subscription_id}.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions/1234"
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 "{email_address}/token:{api_token}"
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/community/topics/360001326113/subscriptions/1234")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions/1234',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions/1234"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions/1234")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"subscription": {
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
}
Create Topic Subscription
POST /api/v2/community/topics/{topic_id}/subscriptions
Creates a subscription to a given topic.
Allowed for
- End users
Agents with the Help Center manager role can optionally supply a user_id
value. If provided, the user associated with user_id
will be subscribed
to the topic.
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
topic_id | integer | Path | true | The unique ID of the topic |
Code Samples
curl
# you can use `"include_comments": true` to Subscribe also to new post comments. Default is false
curl https://{subdomain}.zendesk.com/api/v2/community/topics/{topic_id}/subscriptions.json \
-d '{"subscription": {"include_comments": true}}' \
-v -u {email_address}/token:{api_token} -X POST -H "Content-Type: application/json"
# with `user_id`
curl https://{subdomain}.zendesk.com/api/v2/community/topics/{topic_id}/subscriptions.json \
-d '{"subscription": {"include_comments": false, "user_id": 10056}}' \
-v -u {email_address}/token:{api_token} -X POST -H "Content-Type: application/json"
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions"
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 "{email_address}/token:{api_token}"
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/community/topics/360001326113/subscriptions")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
""");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'POST',
url: 'https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"POST",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions")
request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
201 Created
// Status 201 Created
{
"subscription": {
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
}
Update Topic Subscription
PUT /api/v2/community/topics/{topic_id}/subscriptions/{subscription_id}
Allowed for
- End users
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
subscription_id | integer | Path | true | The unique ID of the subscription |
topic_id | integer | Path | true | The unique ID of the topic |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/community/topics/{topic_id}/subscriptions/{subscription_id}.json \
-d '{"subscription": {"include_comments": true}}' \
-v -u {email_address}/token:{api_token} -X PUT -H "Content-Type: application/json"
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions/1234"
method := "PUT"
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 "{email_address}/token:{api_token}"
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/community/topics/360001326113/subscriptions/1234")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
""");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("PUT", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'PUT',
url: 'https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions/1234',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions/1234"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"PUT",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions/1234")
request = Net::HTTP::Put.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"subscription": {
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
}
Delete Topic Subscription
DELETE /api/v2/community/topics/{topic_id}/subscriptions/{subscription_id}
Removes a subscription to a given topic.
Allowed for
- End users
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
subscription_id | integer | Path | true | The unique ID of the subscription |
topic_id | integer | Path | true | The unique ID of the topic |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/community/topics/{topic_id}/subscriptions/{subscription_id}.json \
-v -u {email_address}/token:{api_token} -X DELETE
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions/1234"
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 "{email_address}/token:{api_token}"
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/community/topics/360001326113/subscriptions/1234")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("DELETE", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'DELETE',
url: 'https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions/1234',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions/1234"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"DELETE",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/community/topics/360001326113/subscriptions/1234")
request = Net::HTTP::Delete.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
List Post Subscriptions
GET /api/v2/community/posts/{post_id}/subscriptions
Lists the subscriptions to a given post.
Allowed for
- End users
For end-users, the response will list only the subscriptions created by the requesting end-user.
Sideloads
The following sideloads are supported:
Name | Will sideload |
---|---|
users | users |
posts | posts |
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
post_id | integer | Path | true | The unique ID of the post |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/community/posts/{post_id}/subscriptions.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions"
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 "{email_address}/token:{api_token}"
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/community/posts/360039436873/subscriptions")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"subscriptions": [
{
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
]
}
Show Post Subscription
GET /api/v2/community/posts/{post_id}/subscriptions/{subscription_id}
Allowed for
- End users
For end users, the response will only show a subscription created by the requesting end user.
Sideloads
The following sideloads are supported:
Name | Will sideload | For |
---|---|---|
users | users | all |
posts | posts | post subscriptions |
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
post_id | integer | Path | true | The unique ID of the post |
subscription_id | integer | Path | true | The unique ID of the subscription |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/community/posts/{post_id}/subscriptions/{subscription_id}.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions/1234"
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 "{email_address}/token:{api_token}"
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/community/posts/360039436873/subscriptions/1234")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions/1234',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions/1234"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions/1234")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"subscription": {
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
}
Create Post Subscription
POST /api/v2/community/posts/{post_id}/subscriptions
Creates a subscription to a given post.
Allowed for
- End users
Agents with the Help Center manager role can optionally supply a
subscription
object containing a user_id
value. If provided,
the user associated with user_id
will be subscrbed to the post.
Pagination
- Cursor pagination (recommended)
- Offset pagination
See Pagination.
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
post_id | integer | Path | true | The unique ID of the post |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/community/posts/{post_id}/subscriptions.json \
-v -u {email_address}/token:{api_token} -X POST -H "Content-Type: application/json"
# with `user_id`
curl https://{subdomain}.zendesk.com/api/v2/community/posts/{post_id}/subscriptions.json \
-d '{"subscription": {"user_id": 10056}}' \
-v -u {email_address}/token:{api_token} -X POST -H "Content-Type: application/json"
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions"
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 "{email_address}/token:{api_token}"
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/community/posts/360039436873/subscriptions")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
""");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'POST',
url: 'https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"POST",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions")
request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
201 Created
// Status 201 Created
{
"subscription": {
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
}
Delete Post Subscription
DELETE /api/v2/community/posts/{post_id}/subscriptions/{subscription_id}
Removes a subscription to a given post.
Allowed for
- End-users
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
post_id | integer | Path | true | The unique ID of the post |
subscription_id | integer | Path | true | The unique ID of the subscription |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/community/posts/{post_id}/subscriptions/{subscription_id}.json \
-v -u {email_address}/token:{api_token} -X DELETE
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions/1234"
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 "{email_address}/token:{api_token}"
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/community/posts/360039436873/subscriptions/1234")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("DELETE", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'DELETE',
url: 'https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions/1234',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions/1234"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"DELETE",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/community/posts/360039436873/subscriptions/1234")
request = Net::HTTP::Delete.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
List Section Subscriptions
GET /api/v2/help_center/{locale}/sections/{section_id}/subscriptions
GET /api/v2/help_center/sections/{section_id}/subscriptions
Lists the subscriptions to a given section.
Note: {/locale}
is an optional parameter for admins and agents. End users and anonymous users must provide the parameter.
Allowed for
- End users
For end-users, the response will list only the subscriptions created by the requesting end-user.
Pagination
- Cursor pagination (recommended)
- Offset pagination
See Pagination.
Sideloads
The following sideloads are supported:
Name | Will sideload |
---|---|
users | users |
sections | sections |
translations | translations of any sideloaded articles and sections |
To sideload the section translations, specify the translations
sideload in
addition to sections
.
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
locale | string | Path | true | The locale the item is displayed in |
section_id | integer | Path | true | The unique ID of the section |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/{locale}/sections/{section_id}/subscriptions.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/help_center/en-us/sections/360004785313/subscriptions"
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 "{email_address}/token:{api_token}"
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/sections/360004785313/subscriptions")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.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/en-us/sections/360004785313/subscriptions',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/help_center/en-us/sections/360004785313/subscriptions"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/help_center/en-us/sections/360004785313/subscriptions")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"subscriptions": [
{
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
]
}
Show Section Subscription
GET /api/v2/help_center/{locale}/sections/{section_id}/subscriptions/{subscription_id}
GET /api/v2/help_center/sections/{section_id}/subscriptions/{subscription_id}
Note: {/locale}
is an optional parameter for admins and agents. End users and anonymous users must provide the parameter.
Allowed for
- End users
Sideloads
The following sideloads are supported:
Name | Will sideload | For |
---|---|---|
users | users | all |
sections | sections | section subscriptions |
translations | translations | article or section subscriptions |
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
locale | string | Path | true | The locale the item is displayed in |
section_id | integer | Path | true | The unique ID of the section |
subscription_id | integer | Path | true | The unique ID of the subscription |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/{locale}/sections/{section_id}/subscriptions/{subscription_id}.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/help_center/en-us/sections/360004785313/subscriptions/1234"
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 "{email_address}/token:{api_token}"
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/sections/360004785313/subscriptions/1234")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.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/en-us/sections/360004785313/subscriptions/1234',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/help_center/en-us/sections/360004785313/subscriptions/1234"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/help_center/en-us/sections/360004785313/subscriptions/1234")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"subscription": {
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
}
Create Section Subscription
POST /api/v2/help_center/{locale}/sections/{section_id}/subscriptions
POST /api/v2/help_center/sections/{section_id}/subscriptions
Creates a subscription to a given section.
Allowed for
- End users
Agents with the Help Center manager role can optionally supply a user_id
value. If provided, the user associated with user_id
will be subscribed
to the section.
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
locale | string | Path | true | The locale the item is displayed in |
section_id | integer | Path | true | The unique ID of the section |
Code Samples
curl
# you can use `"include_comments": true` to Subscribe also to new post comments. Default is false
curl https://{subdomain}.zendesk.com/api/v2/help_center/sections/{section_id}/subscriptions.json \
-d '{"subscription": {"source_locale": "en-us", "include_comments": true}}' \
-v -u {email_address}/token:{api_token} -X POST -H "Content-Type: application/json"
# with `include_comments`
curl https://{subdomain}.zendesk.com/api/v2/help_center/sections/{section_id}/subscriptions.json \
-d '{"subscription": {"source_locale": "en-us", "include_comments": false, "user_id": 10056}}' \
-v -u {email_address}/token:{api_token} -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/sections/360004785313/subscriptions"
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 "{email_address}/token:{api_token}"
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/sections/360004785313/subscriptions")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
""");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.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/sections/360004785313/subscriptions',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/help_center/en-us/sections/360004785313/subscriptions"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"POST",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/help_center/en-us/sections/360004785313/subscriptions")
request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
201 Created
// Status 201 Created
{
"subscription": {
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
}
Delete Section Subscription
DELETE /api/v2/help_center/{locale}/sections/{section_id}/subscriptions/{subscription_id}
DELETE /api/v2/help_center/sections/{section_id}/subscriptions/{subscription_id}
Removes the specified subscription from the specified section.
Allowed for
- End users
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
locale | string | Path | true | The locale the item is displayed in |
section_id | integer | Path | true | The unique ID of the section |
subscription_id | integer | Path | true | The unique ID of the subscription |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/sections/{section_id}/subscriptions/{subscription_id}.json \
-v -u {email_address}/token:{api_token} -X DELETE
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/help_center/en-us/sections/360004785313/subscriptions/1234"
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 "{email_address}/token:{api_token}"
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/sections/360004785313/subscriptions/1234")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("DELETE", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.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/en-us/sections/360004785313/subscriptions/1234',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/help_center/en-us/sections/360004785313/subscriptions/1234"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"DELETE",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/help_center/en-us/sections/360004785313/subscriptions/1234")
request = Net::HTTP::Delete.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
List Article Subscriptions
GET /api/v2/help_center/{locale}/articles/{article_id}/subscriptions
GET /api/v2/help_center/articles/{article_id}/subscriptions
Lists the subscriptions to a given article.
Note: {/locale}
is an optional parameter for admins and agents. End users and anonymous users must provide the parameter.
Allowed for
- End users
For end-users, the response will list only the subscriptions created by the requesting end-user.
Pagination
- Cursor pagination (recommended)
- Offset pagination
See Pagination.
Sideloads
The following sideloads are supported:
Name | Will sideload |
---|---|
users | users |
articles | articles |
sections | sections |
Note that you need to specify the articles
sideload to get the sections
and translations sideloaded because these are not directly associated with the
subscriptions.
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
article_id | integer | Path | true | The unique ID of the article |
locale | string | Path | true | The locale the item is displayed in |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/{locale}/articles/{article_id}/subscriptions.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/subscriptions"
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 "{email_address}/token:{api_token}"
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/subscriptions")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.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/en-us/articles/360026053753/subscriptions',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/subscriptions"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/subscriptions")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"subscriptions": [
{
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
]
}
Show Article Subscription
GET /api/v2/help_center/{locale}/articles/{article_id}/subscriptions/{subscription_id}
GET /api/v2/help_center/articles/{article_id}/subscriptions/{subscription_id}
Note: {/locale}
is an optional parameter for admins and agents. End users and anonymous users must provide the parameter.
Allowed for
- End users
For end-users, the response will only show a subscription created by the requesting end-user.
Sideloads
The following sideloads are supported:
Name | Will sideload | For |
---|---|---|
users | users | all |
articles | articles | article subscriptions |
sections | sections | section subscriptions |
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
article_id | integer | Path | true | The unique ID of the article |
locale | string | Path | true | The locale the item is displayed in |
subscription_id | integer | Path | true | The unique ID of the subscription |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/{locale}/articles/{article_id}/subscriptions/{subscription_id}.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/subscriptions/1234"
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 "{email_address}/token:{api_token}"
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/subscriptions/1234")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.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/en-us/articles/360026053753/subscriptions/1234',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/subscriptions/1234"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/subscriptions/1234")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"subscription": {
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
}
Create Article Subscription
POST /api/v2/help_center/{locale}/articles/{article_id}/subscriptions
POST /api/v2/help_center/articles/{article_id}/subscriptions
Creates a subscription to a given article.
Allowed for
- End users
Agents with the Help Center manager role can optionally supply a user_id
value. If provided, the user associated with user_id
will be subscribed
to the article.
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
article_id | integer | Path | true | The unique ID of the article |
locale | string | Path | true | The locale the item is displayed in |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/subscriptions.json \
-d '{"subscription": {"source_locale": "en-us"}}' \
-v -u {email_address}/token:{api_token} -X POST -H "Content-Type: application/json"
# with `user_id`
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/subscriptions.json \
-d '{"subscription": {"source_locale": "en-us", "user_id": 10056}}' \
-v -u {email_address}/token:{api_token} -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/subscriptions"
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 "{email_address}/token:{api_token}"
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/subscriptions")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
""");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.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/subscriptions',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/subscriptions"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"POST",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/subscriptions")
request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
201 Created
// Status 201 Created
{
"subscription": {
"content_id": 8748733,
"id": 35467,
"locale": "en",
"user_id": 888887
}
}
Delete Article Subscription
DELETE /api/v2/help_center/{locale}/articles/{article_id}/subscriptions/{subscription_id}
DELETE /api/v2/help_center/articles/{article_id}/subscriptions/{subscription_id}
Removes the specified subscription from the specified article.
Allowed for
- End users
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
article_id | integer | Path | true | The unique ID of the article |
locale | string | Path | true | The locale the item is displayed in |
subscription_id | integer | Path | true | The unique ID of the subscription |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/subscriptions/{subscription_id}.json \
-v -u {email_address}/token:{api_token} -X DELETE
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/subscriptions/1234"
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 "{email_address}/token:{api_token}"
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/subscriptions/1234")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("DELETE", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.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/en-us/articles/360026053753/subscriptions/1234',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/subscriptions/1234"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"DELETE",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/help_center/en-us/articles/360026053753/subscriptions/1234")
request = Net::HTTP::Delete.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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