Tickets are the means through which your end users (customers) communicate with agents in Zendesk Support. Tickets can originate from a number of channels, including email, Help Center, chat, phone call, X (formerly Twitter), Facebook, or the API. All tickets have a core set of properties.

Tickets and Requests

Zendesk has both a Tickets API and a Requests API. A ticket is an agent's perspective on a ticket. A request is an end user's perspective on a ticket. End users can only see public comments and certain fields of a ticket. Therefore, use the Requests API to let end users view, update, and create tickets. Use the Tickets API described in the rest of this document to let agents and admins manage tickets.

Requesters and submitters

Every ticket has a requester and submitter. The user who is asking for support through a ticket is the requester. For most businesses that use Zendesk Support, the requester is a customer, but requesters can also be agents in your Zendesk Support instance.

The submitter is the user who created a ticket. By default, the requester of a ticket is the submitter. For example, if your customer emails your support address, this creates a ticket with the customer as both the requester and submitter. The requester will also appear as the author of the ticket's first comment.

However, a support agent can also create a ticket on behalf of a customer. If an agent creates a ticket through the web interface, the agent is set as the submitter. This can be accomplished equivalently through the API by passing the agent's user ID as the submitter_id when creating a ticket. In this case, the agent, who is the submitter, becomes the author of the ticket's first comment and the ticket shows that the agent created the ticket "on behalf of" the customer.

If you want to include placeholders in the first comment, create the ticket as an agent, not on behalf of an end user. Placeholders only work in comments if the comment is created by an agent. If an end user tries to enter a placeholder in a comment, it's treated as a static string and is displayed as such in the ticket.

The submitter is always the first comment author

In the description above, we see that a ticket's first comment author can differ depending on who created the ticket. In both examples, whomever is the submitter becomes the first comment author. This will hold true for all tickets created in Zendesk Support with one exception.

Exception: If the ticket is created as a follow-up ticket (i.e., if the ticket is created using via_followup_source_id), then any submitter_id attribute is ignored. The API sets whoever created the follow-up ticket (for the API, always the authenticated user) as the first comment author.

Description and first comment

When creating a ticket, use the comment property to set the ticket description, which is also the first comment. Example:

{"ticket": {"subject": "My printer is on fire!", "comment": {"body": "The smoke is very colorful."}}}

Important: Do not use the description property to set the first comment. The property is for reading purposes only. While it's possible to use the property to set the first comment, the functionality has limitations and is provided to support existing implementations.

Groups and assignees

Tickets in Zendesk Support can be passed to a group of agents unassigned, or to a specific agent in a specific group. A ticket can only be assigned to one assignee at a time.

Collaborators

Aside from the requester, a ticket can include other people in its communication, known as collaborators or cc's. Collaborators receive email notifications when tickets are updated. Collaborators can be either end users or agents.

Custom ticket statuses

If your account has activated custom ticket statuses, the status property contains the ticket's status category. An id for the custom ticket status is available in the custom_status_id property.

To get a human-readable label for a ticket's custom status, sideload custom_statuses in a GET request. Example:

GET /api/v2/tickets.json?include=custom_statuses
Response:{  "ticket": {    "id": 35436,    "custom_status_id": 123,    "status": "open",    ...  },  "custom_statuses": [    {      "id": 123,      "status_category": "open",      "agent_label": "Open",      "end_user_label": "Open",      ...    }  ]}

For more information about custom ticket statuses and status categories, see Creating custom ticket statuses.

JSON format

Tickets are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
allow_attachments boolean true false Permission for agents to add add attachments to a comment. Defaults to true
allow_channelback boolean true false Is false if channelback is disabled, true otherwise. Only applicable for channels framework ticket
assignee_email string false false Write only. The email address of the agent to assign the ticket to
assignee_id integer false false The agent currently assigned to the ticket
attribute_value_ids array false false Write only. An array of the IDs of attribute values to be associated with the ticket
brand_id integer false false Enterprise only. The id of the brand this ticket is associated with
collaborator_ids array false false The ids of users currently CC'ed on the ticket
collaborators array false false POST requests only. Users to add as cc's when creating a ticket. See Setting Collaborators
comment object false false Write only. An object that adds a comment to the ticket. See Ticket comments. To include an attachment with the comment, see Attaching files
created_at string true false When this record was created
custom_fields array false false Custom fields for the ticket. See Setting custom field values
custom_status_id integer false false The custom ticket status id of the ticket. See custom ticket statuses
description string true false Read-only first comment on the ticket. When creating a ticket, use comment to set the description. See Description and first comment
due_at string false false If this is a ticket of type "task" it has a due date. Due date format uses ISO 8601 format.
email_cc_ids array false false The ids of agents or end users currently CC'ed on the ticket. See CCs and followers resources in the Support Help Center
email_ccs object false false Write only. An array of objects that represent agent or end users email CCs to add or delete from the ticket. See Setting email CCs
external_id string false false An id you can use to link Zendesk Support tickets to local records
follower_ids array false false The ids of agents currently following the ticket. See CCs and followers resources
followers object false false Write only. An array of objects that represent agent followers to add or delete from the ticket. See Setting followers
followup_ids array true false The ids of the followups created from this ticket. Ids are only visible once the ticket is closed
forum_topic_id integer true false The topic in the Zendesk Web portal this ticket originated from, if any. The Web portal is deprecated
from_messaging_channel boolean true false If true, the ticket's via type is a messaging channel.
group_id integer false false The group this ticket is assigned to
has_incidents boolean true false Is true if a ticket is a problem type and has one or more incidents linked to it. Otherwise, the value is false.
id integer true false Automatically assigned when the ticket is created
is_public boolean true false Is true if any comments are public, false otherwise
macro_id integer false false Write only. A macro ID to be recorded in the ticket audit
macro_ids array false false POST requests only. List of macro IDs to be recorded in the ticket audit
metadata object false false Write only. Metadata for the audit. In the audit object, the data is specified in the custom property of the metadata object. See Setting Metadata
organization_id integer false false The organization of the requester. You can only specify the ID of an organization associated with the requester. See Organization Memberships
priority string false false The urgency with which the ticket should be addressed. Allowed values are "urgent", "high", "normal", or "low".
problem_id integer false false For tickets of type "incident", the ID of the problem the incident is linked to
raw_subject string false false The dynamic content placeholder, if present, or the "subject" value, if not. See Dynamic Content Items
recipient string false false The original recipient e-mail address of the ticket. Notification emails for the ticket are sent from this address
requester object false false Write only. See Creating a ticket with a new requester
requester_id integer false true The user who requested this ticket
safe_update boolean false false Write only. Optional boolean. When true and an update_stamp date is included, protects against ticket update collisions and returns a message to let you know if one occurs. See Protecting against ticket update collisions. A value of false has the same effect as true. Omit the property to force the updates to not be safe
satisfaction_rating object true false The satisfaction rating of the ticket, if it exists, or the state of satisfaction, "offered" or "unoffered". The value is null for plan types that don't support CSAT
sharing_agreement_ids array true false The ids of the sharing agreements used for this ticket
status string false false The state of the ticket. If your account has activated custom ticket statuses, this is the ticket's status category. See custom ticket statuses. Allowed values are "new", "open", "pending", "hold", "solved", or "closed".
subject string false false The value of the subject field for this ticket
submitter_id integer false false The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket
tags array false false The array of tags applied to this ticket
ticket_form_id integer false false Enterprise only. The id of the ticket form to render for the ticket
type string false false The type of this ticket. Allowed values are "problem", "incident", "question", or "task".
updated_at string true false When this record last got updated. It is updated only if the update generates a ticket event
updated_stamp string false false Write only. Datetime of last update received from API. See the safe_update property
url string true false The API url of this ticket
via object false false For more information, see the Via object reference
via_followup_source_id integer false false POST requests only. The id of a closed ticket when creating a follow-up ticket. See Creating a follow-up ticket
via_id integer false false Write only. For more information, see the Via object reference
voice_comment object false false Write only. See Creating voicemail ticket

You can also include a comment_count property in the JSON objects returned by GET requests by sideloading it. Example:

GET /api/v2/tickets.json?include=comment_count

Example

{  "assignee_id": 235323,  "collaborator_ids": [    35334,    234  ],  "created_at": "2009-07-20T22:55:29Z",  "custom_fields": [    {      "id": 27642,      "value": "745"    },    {      "id": 27648,      "value": "yes"    }  ],  "custom_status_id": 123,  "description": "The fire is very colorful.",  "due_at": null,  "external_id": "ahg35h3jh",  "follower_ids": [    35334,    234  ],  "from_messaging_channel": false,  "group_id": 98738,  "has_incidents": false,  "id": 35436,  "organization_id": 509974,  "priority": "high",  "problem_id": 9873764,  "raw_subject": "{{dc.printer_on_fire}}",  "recipient": "[email protected]",  "requester_id": 20978392,  "satisfaction_rating": {    "comment": "Great support!",    "id": 1234,    "score": "good"  },  "sharing_agreement_ids": [    84432  ],  "status": "open",  "subject": "Help, my printer is on fire!",  "submitter_id": 76872,  "tags": [    "enterprise",    "other_tag"  ],  "type": "incident",  "updated_at": "2011-05-05T10:38:52Z",  "url": "https://company.zendesk.com/api/v2/tickets/35436.json",  "via": {    "channel": "web"  }}

List Tickets

  • GET /api/v2/tickets
  • GET /api/v2/organizations/{organization_id}/tickets
  • GET /api/v2/users/{user_id}/tickets/requested
  • GET /api/v2/users/{user_id}/tickets/ccd
  • GET /api/v2/users/{user_id}/tickets/followed
  • GET /api/v2/users/{user_id}/tickets/assigned
  • GET /api/v2/tickets/recent

ccd lists tickets that the specified user is cc'd on.

followed lists tickets that the specified user is following.

recent lists tickets that the requesting agent recently viewed in the agent interface, not recently created or updated tickets (unless by the agent recently in the agent interface).

To get a list of all tickets in your account, use the Incremental Ticket Export, Cursor Based or Incremental Ticket Export, Time Based endpoint.

For more filter options, use the Search API.

You can also sideload related records with the tickets. See Side-Loading.

Archived tickets are not included in the response. See About archived tickets in the Support Help Center.

If an agent with restricted access to tickets makes a request to the api/v2/tickets endpoint, the endpoint returns only the tickets the agent can access. For information on agents with restricted access to tickets, see Creating custom roles and assigning agents. In addition, the restricted agent's request includes up to 10,000 tickets where the agent is a CC or follower.

Allowed for

  • Agents

Pagination

  • Cursor pagination (recommended)
  • Offset pagination

See Pagination.

Returns a maximum of 100 records per page.

Sorting

By default, tickets are sorted by id from smallest to largest.

When using cursor pagination, use the following parameter to change the sort order:

Name Type Required Comments
sort string no Possible values are "updated_at", "id", "status" (ascending order) or "-updated_at", "-id", "-status" (descending order)

When using offset pagination, use the following parameters to change the sort order:

Name Type Required Comments
sort_by string no Possible values are "assignee", "assignee.name", "created_at", "group", "id", "locale", "requester", "requester.name", "status", "subject", "updated_at"
sort_order string no One of asc, desc. Defaults to asc

When sorting by creation date, the first ticket listed may not be the absolute oldest ticket in your account due to ticket archiving.

The query parameter is not supported for this endpoint. Use the Search API to narrow your results with query.

Parameters

Name Type In Required Description
external_id string Query false Lists tickets by external id. External ids don't have to be unique for each ticket. As a result, the request may return multiple tickets with the same external id.

Limits

This is the limit definition for the List Tickets endpoint

Rate Limits Scopes Interval Sandbox Trial Default
Standard Account 1 minute 100 100 N/A
With High Volume API Add On Account 1 minute 300 300 N/A

"Default" applies to all Zendesk suite and support plans. Please refer to the general account limits for more information.

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/tickets.json \  -v -u {email_address}:{password}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/tickets?external_id="	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://example.zendesk.com/api/v2/tickets")		.newBuilder()		.addQueryParameter("external_id", "");
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://example.zendesk.com/api/v2/tickets',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"  },  params: {    'external_id': '',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://example.zendesk.com/api/v2/tickets?external_id="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://example.zendesk.com/api/v2/tickets")uri.query = URI.encode_www_form("external_id": "")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
{  "tickets": [    {      "assignee_id": 235323,      "collaborator_ids": [        35334,        234      ],      "created_at": "2009-07-20T22:55:29Z",      "custom_fields": [        {          "id": 27642,          "value": "745"        },        {          "id": 27648,          "value": "yes"        }      ],      "custom_status_id": 123,      "description": "The fire is very colorful.",      "due_at": null,      "external_id": "ahg35h3jh",      "follower_ids": [        35334,        234      ],      "from_messaging_channel": false,      "group_id": 98738,      "has_incidents": false,      "id": 35436,      "organization_id": 509974,      "priority": "high",      "problem_id": 9873764,      "raw_subject": "{{dc.printer_on_fire}}",      "recipient": "[email protected]",      "requester_id": 20978392,      "satisfaction_rating": {        "comment": "Great support!",        "id": 1234,        "score": "good"      },      "sharing_agreement_ids": [        84432      ],      "status": "open",      "subject": "Help, my printer is on fire!",      "submitter_id": 76872,      "tags": [        "enterprise",        "other_tag"      ],      "type": "incident",      "updated_at": "2011-05-05T10:38:52Z",      "url": "https://company.zendesk.com/api/v2/tickets/35436.json",      "via": {        "channel": "web"      }    }  ]}

Count Tickets

  • GET /api/v2/tickets/count
  • GET /api/v2/organizations/{organization_id}/tickets/count
  • GET /api/v2/users/{user_id}/tickets/ccd/count
  • GET /api/v2/users/{user_id}/tickets/assigned/count

Returns an approximate count of tickets in the account. If the count exceeds 100,000, it is updated every 24 hours.

ccd lists tickets that the specified user is cc'd on.

The count[refreshed_at] property is a timestamp that indicates when the count was last updated.

Note: When the count exceeds 100,000, count[refreshed_at] may occasionally be null. This indicates that the count is being updated in the background, and count[value] is limited to 100,000 until the update is complete.

Allowed For

  • Agents

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/tickets/count.json \  -v -u {email_address}:{password}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/tickets/count"	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://example.zendesk.com/api/v2/tickets/count")		.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://example.zendesk.com/api/v2/tickets/count',  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://example.zendesk.com/api/v2/tickets/count"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://example.zendesk.com/api/v2/tickets/count")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
{  "count": {    "refreshed_at": "2020-04-06T02:18:17Z",    "value": 102  }}

Show Ticket

  • GET /api/v2/tickets/{ticket_id}

Returns a number of ticket properties though not the ticket comments. To get the comments, use List Comments

Allowed For

  • Agents

Parameters

Name Type In Required Description
ticket_id integer Path true The ID of the ticket

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/tickets/{ticket_id}.json \  -v -u {email_address}:{password}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/tickets/123456"	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://example.zendesk.com/api/v2/tickets/123456")		.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://example.zendesk.com/api/v2/tickets/123456',  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://example.zendesk.com/api/v2/tickets/123456"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://example.zendesk.com/api/v2/tickets/123456")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
{  "ticket": {    "assignee_id": 235323,    "collaborator_ids": [      35334,      234    ],    "created_at": "2009-07-20T22:55:29Z",    "custom_fields": [      {        "id": 27642,        "value": "745"      },      {        "id": 27648,        "value": "yes"      }    ],    "custom_status_id": 123,    "description": "The fire is very colorful.",    "due_at": null,    "external_id": "ahg35h3jh",    "follower_ids": [      35334,      234    ],    "from_messaging_channel": false,    "group_id": 98738,    "has_incidents": false,    "id": 35436,    "organization_id": 509974,    "priority": "high",    "problem_id": 9873764,    "raw_subject": "{{dc.printer_on_fire}}",    "recipient": "[email protected]",    "requester_id": 20978392,    "satisfaction_rating": {      "comment": "Great support!",      "id": 1234,      "score": "good"    },    "sharing_agreement_ids": [      84432    ],    "status": "open",    "subject": "Help, my printer is on fire!",    "submitter_id": 76872,    "tags": [      "enterprise",      "other_tag"    ],    "type": "incident",    "updated_at": "2011-05-05T10:38:52Z",    "url": "https://company.zendesk.com/api/v2/tickets/35436.json",    "via": {      "channel": "web"    }  }}

Show Multiple Tickets

  • GET /api/v2/tickets/show_many?ids={ids}

Accepts a comma-separated list of ticket ids to return.

This endpoint will return up to 100 tickets records.

Allowed For

  • Agents

Parameters

Name Type In Required Description
ids string Query true Comma-separated list of ticket ids

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/tickets/show_many.json?ids=1,2,3 \  -v -u {email_address}:{password}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/tickets/show_many?ids=35436%2C35437"	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://example.zendesk.com/api/v2/tickets/show_many")		.newBuilder()		.addQueryParameter("ids", "35436,35437");
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://example.zendesk.com/api/v2/tickets/show_many',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"  },  params: {    'ids': '35436%2C35437',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://example.zendesk.com/api/v2/tickets/show_many?ids=35436%2C35437"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://example.zendesk.com/api/v2/tickets/show_many")uri.query = URI.encode_www_form("ids": "35436,35437")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
{  "tickets": [    {      "assignee_id": 235323,      "collaborator_ids": [        35334,        234      ],      "created_at": "2009-07-20T22:55:29Z",      "custom_fields": [        {          "id": 27642,          "value": "745"        },        {          "id": 27648,          "value": "yes"        }      ],      "custom_status_id": 123,      "description": "The fire is very colorful.",      "due_at": null,      "external_id": "ahg35h3jh",      "follower_ids": [        35334,        234      ],      "from_messaging_channel": false,      "group_id": 98738,      "has_incidents": false,      "id": 35436,      "organization_id": 509974,      "priority": "high",      "problem_id": 9873764,      "raw_subject": "{{dc.printer_on_fire}}",      "recipient": "[email protected]",      "requester_id": 20978392,      "satisfaction_rating": {        "comment": "Great support!",        "id": 1234,        "score": "good"      },      "sharing_agreement_ids": [        84432      ],      "status": "open",      "subject": "Help, my printer is on fire!",      "submitter_id": 76872,      "tags": [        "enterprise",        "other_tag"      ],      "type": "incident",      "updated_at": "2011-05-05T10:38:52Z",      "url": "https://company.zendesk.com/api/v2/tickets/35436.json",      "via": {        "channel": "web"      }    }  ]}

Create Ticket

  • POST /api/v2/tickets

Takes a ticket object that specifies the ticket properties. The only required property is comment. See Ticket Comments. All writable properties listed in JSON Format are optional.

To submit a ticket with HTML data in a comment, use html_body instead of body in your request. HTML data is stripped out of the request if you use body.

An audit object is generated and included in the response when you create or update a ticket. The audit object has an events array listing all the updates made to the new ticket. For more information, see Ticket Audits. You can also add your own metadata to the audit object. See Setting metadata.

For more information on creating tickets, see:

Allowed For

  • Agents

Example body

{  "ticket": {    "comment": {      "body": "The smoke is very colorful."    },    "priority": "urgent",    "subject": "My printer is on fire!"  }}

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/tickets.json \  -d '{"ticket": {"subject": "My printer is on fire!", "comment": { "body": "The smoke is very colorful." }}}' \  -H "Content-Type: application/json" -v -u {email_address}:{password} -X POST
Go
import (	"fmt"	"io"	"net/http"	"strings")
func main() {	url := "https://example.zendesk.com/api/v2/tickets"	method := "POST"	payload := strings.NewReader(`{  "ticket": {    "comment": {      "body": "The smoke is very colorful."    },    "priority": "urgent",    "subject": "My printer is on fire!"  }}`)	req, err := http.NewRequest(method, url, payload)
	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://example.zendesk.com/api/v2/tickets")		.newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),		"""{  \"ticket\": {    \"comment\": {      \"body\": \"The smoke is very colorful.\"    },    \"priority\": \"urgent\",    \"subject\": \"My printer is on fire!\"  }}""");
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 data = JSON.stringify({  "ticket": {    "comment": {      "body": "The smoke is very colorful."    },    "priority": "urgent",    "subject": "My printer is on fire!"  }});
var config = {  method: 'POST',  url: 'https://example.zendesk.com/api/v2/tickets',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"  },  data : data,};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsimport json
url = "https://example.zendesk.com/api/v2/tickets"
payload = json.loads("""{  "ticket": {    "comment": {      "body": "The smoke is very colorful."    },    "priority": "urgent",    "subject": "My printer is on fire!"  }}""")headers = {	"Content-Type": "application/json",}
response = requests.request(	"POST",	url,	auth=('<username>', '<password>'),	headers=headers,	json=payload)
print(response.text)
Ruby
require "net/http"uri = URI("https://example.zendesk.com/api/v2/tickets")request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")request.body = %q({  "ticket": {    "comment": {      "body": "The smoke is very colorful."    },    "priority": "urgent",    "subject": "My printer is on fire!"  }})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)

201 Created
// Status 201 Created
{  "ticket": {    "assignee_id": 235323,    "collaborator_ids": [      35334,      234    ],    "created_at": "2009-07-20T22:55:29Z",    "custom_fields": [      {        "id": 27642,        "value": "745"      },      {        "id": 27648,        "value": "yes"      }    ],    "custom_status_id": 123,    "description": "The fire is very colorful.",    "due_at": null,    "external_id": "ahg35h3jh",    "follower_ids": [      35334,      234    ],    "from_messaging_channel": false,    "group_id": 98738,    "has_incidents": false,    "id": 35436,    "organization_id": 509974,    "priority": "high",    "problem_id": 9873764,    "raw_subject": "{{dc.printer_on_fire}}",    "recipient": "[email protected]",    "requester_id": 20978392,    "satisfaction_rating": {      "comment": "Great support!",      "id": 1234,      "score": "good"    },    "sharing_agreement_ids": [      84432    ],    "status": "open",    "subject": "Help, my printer is on fire!",    "submitter_id": 76872,    "tags": [      "enterprise",      "other_tag"    ],    "type": "incident",    "updated_at": "2011-05-05T10:38:52Z",    "url": "https://company.zendesk.com/api/v2/tickets/35436.json",    "via": {      "channel": "web"    }  }}

Create Many Tickets

  • POST /api/v2/tickets/create_many

Accepts an array of up to 100 ticket objects. Note: Every ticket created with this endpoint may be affected by your business rules, which can include sending email notifications to your end users. If you are importing historical tickets or creating more than 1000 tickets, consider using the Ticket Bulk Import endpoint.

This endpoint returns a job_status JSON object and queues a background job to do the work. Use the Show Job Status endpoint to check for the job's completion. Only a certain number of jobs can be queued or running at the same time. See Job limit for more information.

Allowed For

  • Agents

Example body

{  "tickets": [    {      "comment": {        "body": "The smoke is very colorful."      },      "priority": "urgent",      "subject": "My printer is on fire!"    },    {      "comment": {        "body": "This is a comment"      },      "priority": "normal",      "subject": "Help"    }  ]}

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/tickets/create_many.json \  -d '{"tickets": [{"subject": "My printer is on fire!", "comment": { "body": "The smoke is very colorful." }}, {"subject": "Help!", "comment": { "body": "Help I need somebody." }}]}' \  -H "Content-Type: application/json" -v -u {email_address}:{password} -X POST
Go
import (	"fmt"	"io"	"net/http"	"strings")
func main() {	url := "https://example.zendesk.com/api/v2/tickets/create_many"	method := "POST"	payload := strings.NewReader(`{  "tickets": [    {      "comment": {        "body": "The smoke is very colorful."      },      "priority": "urgent",      "subject": "My printer is on fire!"    },    {      "comment": {        "body": "This is a comment"      },      "priority": "normal",      "subject": "Help"    }  ]}`)	req, err := http.NewRequest(method, url, payload)
	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