Sections contain related articles. SeeOrganizing knowledge base content in categories and sectionsin Zendesk help.

JSON format

Sections are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
category_id integer false false The id of the category to which this section belongs
created_at string true false The time at which the section was created
description string false false The description of the section
html_url string true false The url of this section in HC
id integer true false Automatically assigned when creating subscriptions
locale string false true The locale in which the section is displayed
name string false true The name of the section
outdated boolean true false Whether the section is out of date
parent_section_id integer false false The id of the section to which this section belongs. Only writable for Guide Enterprise customers
position integer false false The position of this section in the section list. Used when sorting is set to ´manual´. By default the section is added to the end of the list
source_locale string true false The source (default) locale of the section
theme_template string false false The theme template name used to display this section in Help Center.
updated_at string true false The time at which the section was last updated
url string true false The API url of this section

Example

             
{"category_id":3465,"description":"This section contains tricks for the airborne","id":1635,"locale":"en-us","name":"Avionics"}

List Sections

  • GET /api/v2/help_center{/locale}/sections
  • GET /api/v2/help_center/{locale}/categories/{category_id}/sections

Lists all the sections in Help Center or in a specificcategory.

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

Allowed for

  • Agents
  • End users
  • Anonymous users

The response will list only the sections that the requesting agent, end user, or anonymous user can view in the help center.

Pagination

  • Cursor pagination (recommended)
  • Offset pagination

SeePagination.

Sorting

You can sort the results with thesort_byandsort_orderquery string parameters.

             
GET/api/v2/help_center/en-us/sections.json?sort_by=updated_at&sort_order=asc

Thesort_byparameter can have one of the following values:

value description
position order set manually using the Arrange Content page. Default order
created_at order by creation time
updated_at order by update time

Thesort_orderparameter can have one of the following values:

value description
asc ascending order
desc descending order

Sideloads

The following sideloads are supported:

Name Will sideload
categories the category
translations the section and category translations, if any

Unlike other sideloads, translations are embedded within the section because they're not shared between resources. Category translations are only sideloaded if categories are.

Parameters

Name Type In Required Description
sort_by string 查询 false Sorts the results by one of the accepted values. Allowed values are "position", "created_at", or "updated_at".
sort_order string 查询 false Selects the order of the results. Allowed values are "asc", or "desc".
locale string Path false The locale the item is displayed in

代码Samples

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/help_center/{locale}/sections.json\-v -u{email_address}:{password}
Go
              
import("fmt""io""net/http")funcmain(){url:="https://support.zendesk.com/api/v2/help_center{/locale}/sections?sort_by=&sort_order="method:="GET"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/help_center{/locale}/sections").newBuilder().addQueryParameter("sort_by","").addQueryParameter("sort_order","");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("GET",null).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:“得到”,url:'https://support.zendesk.com/api/v2/help_center{/locale}/sections',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},params:{'sort_by':'','sort_order':'',},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://support.zendesk.com/api/v2/help_center{/locale}/sections?sort_by=&sort_order="headers={"Content-Type":"application/json",}response=requests.request("GET",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://support.zendesk.com/api/v2/help_center{/locale}/sections")uri.query=URI.encode_www_form("sort_by":"","sort_order":"")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:truedo|http|http.request(request)end

Example response(s)

200 OK
              
// Status 200 OK{"sections":[{"category_id":888887,"description":"This section contains articles on flight instruments","id":35467,"locale":"en-us","name":"Avionics"},{"category_id":887285,"description":"This section contains weather resources for pilots","id":36169,"locale":"en-us","name":"Weather"}]}

Show Section

  • GET /api/v2/help_center{/locale}/sections/{section_id}

Note:{/locale}is an optional parameter for admins and agents. End users and anonymous users must provide the parameter.

Allowed for

  • Agents
  • End users
  • Anonymous users

Sideloads

The following sideloads are supported:

Name Will sideload
categories the category
translations the section and category translations, if any

Unlike other sideloads, translations are embedded within the section since they're not shared between resources.Categorytranslations are only sideloaded if categories are.

Parameters

Name Type In Required Description
locale string Path false The locale the item is displayed in
section_id integer Path true The unique ID of the section

代码Samples

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/help_center/{locale}/sections/{section_id}.json\-v -u{email_address}:{password}
Go
              
import("fmt""io""net/http")funcmain(){url:="https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313"method:="GET"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313").newBuilder();Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("GET",null).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:“得到”,url:'https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313"headers={"Content-Type":"application/json",}response=requests.request("GET",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313")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:truedo|http|http.request(request)end

Example response(s)

200 OK
              
// Status 200 OK{"section":{"description":"This section contains articles on flight instruments","id":3457836,"locale":"en-us","name":"Avionics","position":2}}

Create Section

  • POST /api/v2/help_center{/locale}/categories/{category_id}/sections

Creates a section in a givencategory. You must specify a section name and locale. The locale can be omitted if it's specified in the URL. Optionally, you can specify multipletranslationsfor the section. The specified locales must be enabled for the current Help Center.

Allowed for

  • Agents

Parameters

Name Type In Required Description
category_id integer Path true The unique ID of the category
locale string Path false The locale the item is displayed in

代码Samples

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/help_center/categories/{category_id}/sections.json\-d'{"section": {"position": 2, "locale": "en-us", "name": "Avionics", \"description": "This section contains articles on flight instruments"}}'\-v -u{email_address}:{password}-X POST -H"Content-Type: application/json"# You can also specify multiple translations for the new section:curlhttps://{subdomain}.zendesk.com/api/v2/help_center/categories/{category_id}/sections.json\-d'{"section": {"position": 2, "translations": \[{"locale": "en-us", "title": "Avionics", \"body": "This section contains articles on flight instruments"}, \{"locale": "fr", "title": "Avionique", \"body": "Cette section contient des articles sur les instruments de vol"}]}}'\-v -u{email_address}:{password}-X POST -H"Content-Type: application/json"
Go
              
import("fmt""io""net/http")funcmain(){url:="https://support.zendesk.com/api/v2/help_center{/locale}/categories/360002011513/sections"method:="POST"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/help_center{/locale}/categories/360002011513/sections").newBuilder();RequestBodybody=RequestBody.create(MediaType.parse("application/json"),"""""");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("POST",body).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'POST',url:'https://support.zendesk.com/api/v2/help_center{/locale}/categories/360002011513/sections',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://support.zendesk.com/api/v2/help_center{/locale}/categories/360002011513/sections"headers={"Content-Type":"application/json",}response=requests.request("POST",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://support.zendesk.com/api/v2/help_center{/locale}/categories/360002011513/sections")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:truedo|http|http.request(request)end

Example response(s)

201 Created
              
// Status 201 Created{"section":{"description":"This section contains articles on flight instruments","id":3457836,"locale":"en-us","name":"Avionics","position":2}}
400 Bad Request
              
// Status 400 Bad Request{"errors":{"parent_section_id":["cannot be assigned non-null value on this Guide plan"]}}

Update Section

  • PUT /api/v2/help_center{/locale}/sections/{section_id}

Update section. This endpoint updates section-level data, specifically:

  • name (in the source locale)
  • description (in the source locale)
  • position
  • sorting
  • category_id
  • parent_section_id
  • theme_template

To update non-source section translations, seeTranslations.

Allowed for

  • Help Center managers

Parameters

Name Type In Required Description
locale string Path false The locale the item is displayed in
section_id integer Path true The unique ID of the section

Example body

             
{"section":{"position":3}}

代码Samples

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/help_center/sections/{section_id}.json\-d'{"section": {"position": 42}}'\-v -u{email_address}:{password}-X PUT -H"Content-Type: application/json"
Go
              
import("fmt""io""net/http""strings")funcmain(){url:="https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313"method:="PUT"payload:=strings.NewReader(`{"section": {"position": 3}}`)req,err:=http.NewRequest(method,url,payload)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313").newBuilder();RequestBodybody=RequestBody.create(MediaType.parse("application/json"),"""{\"section\":{\"position\":3}}""");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("PUT",body).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');vardata=JSON.stringify({"section":{"position":3}});varconfig={method:'PUT',url:'https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},data:data,};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsimportjsonurl="https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313"payload=json.loads("""{"section": {"position": 3}}""")headers={"Content-Type":"application/json",}response=requests.request("PUT",url,auth=('',''),headers=headers,json=payload)print(response.text)
Ruby
              
require"net/http"uri=URI("https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313")request=Net::HTTP::Put.new(uri,"Content-Type":"application/json")request.body=%q({"section":{"position":3}})request.basic_auth"username","password"response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|http.request(request)end

Example response(s)

200 OK
              
// Status 200 OK{"section":{"description":"This section contains articles on flight instruments","id":3457836,"locale":"en-us","name":"Avionics","position":2}}
400 Bad Request
              
// Status 400 Bad Request{"errors":{"parent_section_id":["would result in a cycle"]}}

Update Section Source Locale

  • PUT /api/v2/help_center{/locale}/sections/{section_id}/source_locale

This endpoint lets you set a section's source language to something other than the default language of your Help Center. For example, if the default language of your Help Center is English but your KB has a section only for Japanese customers, you can set the section's source locale to 'ja'.

Allowed for

  • Help Center managers

Parameters

Name Type In Required Description
locale string Path false The locale the item is displayed in
section_id integer Path true The unique ID of the section

代码Samples

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/help_center/sections/{section_id}/source_locale.json\-d'{"section_locale": "fr"}'-v -u{email_address}:{password}-X PUT\-H"Content-Type: application/json"
Go
              
import("fmt""io""net/http")funcmain(){url:="https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313/source_locale"method:="PUT"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313/source_locale").newBuilder();RequestBodybody=RequestBody.create(MediaType.parse("application/json"),"""""");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("PUT",body).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'PUT',url:'https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313/source_locale',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313/source_locale"headers={"Content-Type":"application/json",}response=requests.request("PUT",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313/source_locale")request=Net::HTTP::Put.new(uri,"Content-Type":"application/json")request.basic_auth"username","password"response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|http.request(request)end

Example response(s)

200 OK
              
// Status 200 OKnull

删除Section

  • DELETE /api/v2/help_center{/locale}/sections/{section_id}

WARNING: All articles in the section will also be deleted.

Allowed for

  • Help Center managers

Parameters

Name Type In Required Description
locale string Path false The locale the item is displayed in
section_id integer Path true The unique ID of the section

代码Samples

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/help_center/sections/{section_id}.json\-v -u{email_address}:{password}-X DELETE
Go
              
import("fmt""io""net/http")funcmain(){url:="https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313"method:="DELETE"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313").newBuilder();Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("DELETE",null).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'DELETE',url:'https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313"headers={"Content-Type":"application/json",}response=requests.request("DELETE",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://support.zendesk.com/api/v2/help_center{/locale}/sections/360004785313")request=Net::HTTP::删除.new(uri,"Content-Type":"application/json")request.basic_auth"username","password"response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|http.request(request)end

Example response(s)

204 No Content
              
// Status 204 No Contentnull