The Job object

A job is an object used to perform long-running tasks. For example, closing 10k tickets, exporting 500k tickets, and more.

Jobs are processed asynchronously, meaning that once a job is created, it will run in background on Gorgias's servers. According to the type and size of the task, a job can take a few minutes or several hours to be executed. You can use our API to check the status of the job.

Jobs can be canceled at any time but be aware that if a job already started, changes done by this one won't be reverted. For example, if you created a job to close 10k tickets and you cancel it at some point, the already closed tickets won't be reopened.

Job properties

integer

ID of the job.

ISO 8601 datetime

When the job cancellation was requested.

ISO 8601 datetime

When the job was canceled.

ISO 8601 datetime

When the job was created.

ISO 8601 datetime

When the job ended.

ISO 8601 datetime

When the job failed.

object

Data concerning the progress of the job. E.g: how many objects the job has already processed.

ISO 8601 datetime

When the job was locked. A job is only locked while it's actively running.

object | null

Metadata associated with the job. You can use this parameter to store structured information (key-value data) about the job. This field is not used by Gorgias.

object

The parameters of the job.

ISO 8601 datetime

When the job was scheduled to be started. A job cannot be scheduled more than 60 minutes in the future. If unspecified, the job is queued for execution immediately after creation.

ISO 8601 datetime

When the job started.

string

The status of the job. Options: cancel_requested, canceled, done, errored, fatal_errored, pending, running, scheduled

string

The type of the job. Options: applyMacro, deleteTicket, exportTicket, importMacro, exportMacro, updateTicket, exportTicketDrilldown, exportConvertCampaignSalesDrilldown

integer

The ID of the user who created this job.

string

URI of the job.

Job example object

{
  "id": 1234,
  "cancel_requested_datetime": "2019-11-23T16:31:00.966927",
  "cancelled_datetime": "2019-11-23T16:32:00.966927",
  "created_datetime": "2019-11-23T16:00:00.966927",
  "ended_datetime": "2019-11-23T16:32:00.966927",
  "failed_datetime": "2019-11-23T15:59:41.966927",
  "info": {
    "progress_count": 123
  },
  "locked_datetime": "2019-11-23T16:30:01.966927",
  "meta": {
    "description": "This job closes all tickets created in 2018"
  },
  "params": {
    "ticket_ids": [
      1,
      2,
      3
    ],
    "updates": {
      "status": "open"
    }
  },
  "scheduled_datetime": "2019-11-23T16:30:00.966927",
  "started_datetime": "2019-11-23T16:30:01.966927",
  "status": "canceled",
  "type": "updateTicket",
  "user_id": 42,
  "uri": "/api/jobs/1234/"
}