Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Job Resource


The Job resource allows you to view and delete the requests for exports of arbitrary date ranges, submitted through the ExportCustom Job.


Job Properties

job-properties page anchor
Property nameTypePIIDescription
resource_typestring
Not PII

The type of communication – Messages, Calls, Conferences, and Participants


friendly_namestring

The friendly name specified when creating the job


detailsobject

The details of a job which is an object that contains an array of status grouped by status state. Each status object has a status string, a count which is the number of days in that status, and list of days in that status. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a status object for SUBMITTED each with its own count and list of days.


start_daystring

The start time for the export specified when creating the job


end_daystring

The end time for the export specified when creating the job


job_sidSID<JS>

The job_sid returned when the export was created

Pattern: ^JS[0-9a-fA-F]{32}$Min length: 34Max length: 34

webhook_urlstring

The optional webhook url called on completion


webhook_methodstring

This is the method used to call the webhook


emailstring

The optional email to send the completion notification to


urlstring<uri>

job_queue_positionstring

This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease


estimated_completion_timestring

this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position

ENUM:STATUS possible values
ErrorDuringRunThe Job was attempted, but an error prevented completion. This is not a final status, the job will be retried.
SubmittedThe Job has been successfully submitted and is in the queue to execute.
RunningThe job is currently running. The output should be available shortly. Multiple Jobs may run at the same time. You can use the 'estimated_completion_time' to get a sense of when your job will be complete.
CompletedEmptyRecordsThe Job has completed, however, no records for the requested resource have been found. An empty file will be available at the Day endpoint.
CompletedThe Job is successfully completed, and the result files are available at the Day endpoint.
FailedThe Job was attempted, but an error prevented completion. This is a final status, as the job has already been tried multiple times and has not been successful. Try submitting the job again, or reach out to your Twilio support team if problem continues to persist.
RunningToBeDeletedThe Job is currently running, but it has been marked for deletion, and will be deleted soon.

GET https://bulkexports.twilio.com/v1/Exports/Jobs/{JobSid}

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
JobSidSID<JS>required

The unique string that that we created to identify the Bulk Export job

Pattern: ^JS[0-9a-fA-F]{32}$Min length: 34Max length: 34

Fetch a Job

fetch-a-job page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function fetchJob() {
_18
const job = await client.bulkexports.v1.exports
_18
.jobs("JSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.fetch();
_18
_18
console.log(job.resourceType);
_18
}
_18
_18
fetchJob();

Output

_14
{
_14
"start_day": "start_day",
_14
"job_sid": "JSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"url": "https://bulkexports.twilio.com/v1/Exports/Jobs/JSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"friendly_name": "friendly_name",
_14
"end_day": "end_day",
_14
"details": {},
_14
"webhook_url": "https://webhookexample.com",
_14
"webhook_method": "webhook_method",
_14
"email": "email",
_14
"resource_type": "resource_type",
_14
"job_queue_position": "1",
_14
"estimated_completion_time": "2021-03-15T20:20:14.547"
_14
}


DELETE https://bulkexports.twilio.com/v1/Exports/Jobs/{JobSid}

Property nameTypeRequiredPIIDescription
JobSidSID<JS>required

The unique string that that we created to identify the Bulk Export job

Pattern: ^JS[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function deleteJob() {
_16
await client.bulkexports.v1.exports
_16
.jobs("JSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_16
.remove();
_16
}
_16
_16
deleteJob();


Rate this page: