Suspended Tickets
In most cases, when an end user submits a support request by email, the email becomes a new ticket or adds a comment to an existing ticket. However, in certain cases, the email becomes a suspended ticket. It remains suspended until someone reviews the email and decides whether to accept or reject it. If no one reviews it, the email is deleted after 14 days.
You can use this API to list, recover, or delete suspended tickets. For more information about suspended tickets, see Understanding and managing suspended tickets and spam and Guidelines for reviewing suspended tickets in Zendesk help.
JSON format
Suspended Tickets are represented as JSON objects with the following properties:
| Name | Type | Read-only | Mandatory | Description |
|---|---|---|---|---|
| attachments | array | true | false | The attachments, if any associated to this suspended ticket. See Attachments |
| author | object | true | false | The author id (if available), name and email |
| brand_id | integer | true | false | The id of the brand this ticket is associated with. Only applicable for Enterprise accounts |
| cause | string | true | false | Why the ticket was suspended |
| cause_id | integer | true | false | The ID of the cause |
| content | string | true | false | The content that was flagged |
| content_html | string | true | false | Sanitized HTML content when the suspended ticket was created from rich content. Omitted for plain-text suspended tickets. |
| created_at | string | true | false | The ticket ID this suspended email is associated with, if available |
| error_messages | array | true | false | The error messages if any associated to this suspended ticket |
| id | integer | true | false | Automatically assigned |
| message_id | string | true | false | The ID of the email, if available |
| recipient | string | true | false | The original recipient e-mail address of the ticket |
| subject | string | true | false | The value of the subject field for this ticket |
| ticket_id | integer | true | false | The ticket ID this suspended email is associated with, if available |
| updated_at | string | true | false | When the ticket was assigned |
| url | string | true | false | The API url of this ticket |
| via | object | true | false | An object explaining how the ticket was created. See the Via object reference |
Example
{"attachments": [],"author": {"email": "[email protected]","id": 1111,"name": "Mr. Roboto"},"brand_id": 123,"cause": "Detected as spam","cause_id": 0,"content": "Out Of Office Reply","created_at": "2009-07-20T22:55:29Z","error_messages": null,"id": 435,"message_id": "[email protected]","recipient": "[email protected]","subject": "Help, my printer is on fire!","ticket_id": 67321,"updated_at": "2011-05-05T10:38:52Z","url": "https://example.zendesk.com/api/v2/tickets/35436","via": {"channel": "email","source": {"from": {"address": "[email protected]","name": "TotallyLegit"},"rel": null,"to": {"address": "[email protected]","name": "Example Account"}}}}
List Suspended Tickets
GET /api/v2/suspended_tickets
Allowed For
- Admins and agents in custom roles with permission to manage suspended tickets on Enterprise plans
- Unrestricted agents on all other plans
Sorting
You can sort the tickets with the sort_by and sort_order query string parameters.
Pagination
- Cursor pagination
See Pagination.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| page | Query | false | Pagination parameter. Supports both traditional offset and cursor-based pagination: - Traditional: ?page=2 (integer page number) - Cursor: ?page[size]=50&page[after]=cursor (deepObject with size, after, before) These are mutually exclusive - use one format or the other, not both. | |
| per_page | integer | Query | false | Number of records to return per page. Note: Default and maximum values vary by endpoint. Check endpoint-specific documentation for limits. |
| sort_by | string | Query | false | The field to sort the suspended tickets by. One of "author_email", "cause", "created_at", or "subject" |
| sort_order | string | Query | false | The order in which to sort the suspended tickets. This can take value asc or desc. |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/suspended_tickets \-H "Authorization: Bearer {access_token}"
Go
import ("fmt""io""net/http")func main() {url := "https://example.zendesk.com/api/v2/suspended_tickets?page=&per_page=50&sort_by=author_email&sort_order=asc"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://example.zendesk.com/api/v2/suspended_tickets").newBuilder().addQueryParameter("page", "").addQueryParameter("per_page", "50").addQueryParameter("sort_by", "author_email").addQueryParameter("sort_order", "asc");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://example.zendesk.com/api/v2/suspended_tickets',headers: {'Content-Type': 'application/json','Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"},params: {'page': '','per_page': '50','sort_by': 'author_email','sort_order': 'asc',},};axios(config).then(function (response) {console.log(JSON.stringify(response.data));}).catch(function (error) {console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuthurl = "https://example.zendesk.com/api/v2/suspended_tickets?page=&per_page=50&sort_by=author_email&sort_order=asc"headers = {"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = 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://example.zendesk.com/api/v2/suspended_tickets")uri.query = URI.encode_www_form("page": "", "per_page": "50", "sort_by": "author_email", "sort_order": "asc")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{"suspended_tickets": [{"attachments": [],"author": {"email": "[email protected]","id": 1,"name": "Mr. Roboto"},"brand_id": 123,"cause": "Detected as spam","cause_id": 0,"content": "Out Of Office Reply","created_at": "2009-07-20T22:55:29Z","error_messages": null,"id": 435,"message_id": "[email protected]","recipient": "[email protected]","subject": "Help, my printer is on fire!","ticket_id": 67321,"updated_at": "2011-05-05T10:38:52Z","url": "https://example.zendesk.com/api/v2/tickets/35436","via": {"channel": "email","source": {"from": {"address": "[email protected]","name": "TotallyLegit"},"rel": null,"to": {"address": "[email protected]","name": "Example Account"}}}},{"attachments": [],"author": {"email": "[email protected]","id": 1,"name": "Mr. Roboto"},"brand_id": 123,"cause": "Automated response mail","cause_id": 0,"content": "Out Of Office Reply","created_at": "2009-07-20T22:55:29Z","error_messages": null,"id": 207623,"message_id": "[email protected]","recipient": "[email protected]","subject": "Not just anybody!","ticket_id": 67321,"updated_at": "2011-05-05T10:38:52Z","url": "https://example.zendesk.com/api/v2/tickets/35436","via": {"channel": "email","source": {"from": {"address": "[email protected]","name": "TotallyLegit"},"rel": null,"to": {"address": "[email protected]","name": "Example Account"}}}}]}
Show Suspended Ticket
GET /api/v2/suspended_tickets/{id}
Allowed For
- Admins and agents in custom roles with permission to manage suspended tickets on Enterprise plans
- Unrestricted agents on all other plans
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| id | integer | Path | true | id of the suspended ticket |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/suspended_tickets/{id} \-H "Authorization: Bearer {access_token}"
Go
import ("fmt""io""net/http")func main() {url := "https://example.zendesk.com/api/v2/suspended_tickets/35436"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