Ticket Import
You can use the imports API to move tickets in bulk from legacy systems into Zendesk Support.
Ticket imports support the normal ticket properties outlined in Tickets, but have some additional features and restrictions.
Timestamps
You can set the following time stamps on the tickets: solved_at
, updated_at
, and created_at
. However, providing a value for created_at
or updated_at
before 1970 will be automatically rounded up to 1970.
Comments
You can include one or more comments with a ticket. See Ticket Comments for the properties. You can use value
, body
, or html_body
for the comment body. You can also set the comment's created_at
time stamp. However, you can't set the time stamp before 1970 or in the future.
Direct to archive
Ticket imports support the additional request parameter of archive_immediately
. If true, any ticket created with a closed
status bypasses the normal ticket lifecycle and will be created directly in your ticket archive. It's important to note that archived tickets have a handful of restrictions around their use. You can read more about it here.
You may want to explore this option if you are importing a large amount of historical data (750,000+ tickets) and don't want to impact the performance of your active tickets.
Attachments
Attachments are handled the same way as in the tickets API. You upload the files then supply the token in the comment parameters. See Attaching files.
Triggers
No triggers are run on the imported tickets. As a result, there won't be any detailed ticket metrics for the tickets. Zendesk recommends setting a tag to signify that these tickets were added to Zendesk Support using import.
Notifications
No notifications are sent to users cc'ed on the imported tickets. Notifications are sent on subsequent updates to the tickets.
Ticket Import
POST /api/v2/imports/tickets
Allowed For
- Admins
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
archive_immediately | boolean | Query | false | If true , any ticket created with a closed status bypasses the normal ticket lifecycle and will be created directly in your ticket archive |
Example body
{
"ticket": {
"assignee_id": 19,
"comments": [
{
"author_id": 827,
"created_at": "2009-06-25T10:15:18Z",
"value": "This is a comment"
},
{
"author_id": 19,
"public": false,
"value": "This is a private comment"
}
],
"description": "A description",
"requester_id": 827,
"subject": "Help",
"tags": [
"foo",
"bar"
]
}
}
cURL
curl https://{subdomain}.zendesk.com/api/v2/imports/tickets.json \
-v -u {email_address}:{password} -X POST \
-d '{"ticket": {"subject": "Help", "comments": [{ "author_id": 19, "value": "This is a comment" }]}}' \
-H "Content-Type: application/json"
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
],
"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"
}
}
}
Ticket Bulk Import
POST /api/v2/imports/tickets/create_many
Accepts an array of up to 100 ticket objects.
Allowed For
- Admins
Example Response
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.
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
archive_immediately | boolean | Query | false | If true , any ticket created with a closed status bypasses the normal ticket lifecycle and will be created directly in your ticket archive |
Example body
{
"tickets": [
{
"assignee_id": 19,
"comments": [
{
"author_id": 827,
"created_at": "2009-06-25T10:15:18Z",
"value": "This is a comment"
},
{
"author_id": 19,
"public": false,
"value": "This is a private comment"
}
],
"description": "A description",
"requester_id": 827,
"subject": "Help",
"tags": [
"foo",
"bar"
]
},
{
"assignee_id": 21,
"comments": [
{
"author_id": 830,
"created_at": "2009-06-25T10:15:18Z",
"value": "This is a comment"
},
{
"author_id": 21,
"public": false,
"value": "This is a private comment"
}
],
"description": "A description",
"requester_id": 830,
"subject": "Missing Item",
"tags": [
"foo",
"bar"
]
}
]
}
cURL
curl https://{subdomain}.zendesk.com/api/v2/imports/tickets/create_many.json \
-v -u {email_address}:{password} -X POST \
-d '{"tickets": [{"subject": "Help!", "comments": [{ "author_id": 19, "value": "This is a comment" }]}, {"subject": "Help!!", "comments": [{ "author_id": 21, "value": "This is a comment" }]}]}' \
-H "Content-Type: application/json"
Example response(s)
200 OK
// Status 200 OK
{
"job_status": {
"id": "82de0b044094f0c67893ac9fe64f1a99",
"message": "Completed at 2018-03-08 10:07:04 +0000",
"progress": 2,
"results": [
{
"action": "update",
"id": 244,
"status": "Updated",
"success": true
},
{
"action": "update",
"id": 245,
"status": "Updated",
"success": true
}
],
"status": "completed",
"total": 2,
"url": "https://example.zendesk.com/api/v2/job_statuses/82de0b0467893ac9fe64f1a99.json"
}
}