Create Task
This request creates a batch task.
| post | /batch/tasks |
There are four types of batch tasks specified by the method field:
POST- create new objectsGET- export existing objects to a CSV filePATCH- update existing objectsDELETE- delete existing objects
With any of these methods, set the results_email field to get a summary email when the task completes.
The method field values are not to be confused with the HTTP methods used to make the request. The method field values are used to specify the type of batch task to create, and the HTTP method to create a task object is always POST.
POST - Create New Objects
The data field is used to specify the objects to create. It is an array of objects, each object representing a new object to create.
The type field specifies the type of object to create. Refer to this table to view all types that can be created.
The entries and field fields are not used for POST operations and must be set to null or not be included in the request body.
Example Request
An example request to create a batch task that orders two phonenumbers to be added to the same trunk group:
{
"method": "POST",
"review": false,
"type": "phonenumber",
"data": [
{
"phonenumber": "14849687406",
"trunk_group_sid": "2297adf9-cc6f-45f0-9501-5e8c69d21f11"
},
{
"phonenumber": "14849723113",
"trunk_group_sid": "2297adf9-cc6f-45f0-9501-5e8c69d21f11"
}
]
}
The following is the cURL POST request to create a batch task:
curl -X POST \
'https://api.carrierx.com/core/v2/batch/tasks' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${TOKEN}" \
--data-binary '{
"method":"POST",
"review":false,
"type":"phonenumber",
"data":[
{
"phonenumber":"14849687406",
"trunk_group_sid":"2297adf9-cc6f-45f0-9501-5e8c69d21f11"
},
{
"phonenumber":"14849723113",
"trunk_group_sid":"2297adf9-cc6f-45f0-9501-5e8c69d21f11"
}
]
}'
Response
201 status code with a serialized copy of the Task object:
{
"data": [
{
"phonenumber": "14849687406",
"trunk_group_sid": "2297adf9-cc6f-45f0-9501-5e8c69d21f11"
},
{
"phonenumber": "14849723113",
"trunk_group_sid": "2297adf9-cc6f-45f0-9501-5e8c69d21f11"
}
],
"date_created": "2026-04-08T22:04:00.607Z",
"date_modified": "2026-04-08T22:04:00.607Z",
"entries": [],
"failure": null,
"field": null,
"method": "POST",
"partner_sid": "7140b67f-f8a0-428f-a9a9-97c66d6523cb",
"processed": null,
"results_email": null,
"results_url": null,
"review": false,
"status": "created",
"success": null,
"task_sid": "f3ca0cfc-09da-4744-8764-378d0cc2077c",
"total": null,
"type": "phonenumber"
}
GET - Export Existing Objects
A GET task exports the selected objects to a CSV file. When the task completes, the link to the file appears in the results_url attribute.
The following rules apply to GET tasks:
- The
typefield must bephonenumber. Other types do not support theGETmethod. - The
reviewfield must befalseor not included in the request body.GETtasks do not have a review stage. - The
fieldandentriesfields select the objects to export, the same as forPATCHandDELETEtasks. Iffieldis not included, the task exports all objects that the requester can access. - The
datafield is optional. It selects the columns of the file with theinclude_fieldsorexclude_fieldskey. Each key takes a comma-separated list of field names, the same as the field filtering query arguments. Unknown field names are ignored. - A task can export up to 500,000 objects.
- When the task completes, the
total,processed, andsuccesscounters are equal to the number of exported objects, andfailureis0.
Example Request: Export Filtered DIDs
An example request to create a batch task that exports the secure ID, phone number, and name of all DIDs in a DID group. When the task completes, a summary is sent to the results_email address:
{
"method": "GET",
"type": "phonenumber",
"field": "filter",
"entries": [
"did_group_sid eq d9b2e4a5-9d6c-4c1a-8e2f-3f7b6a5c4d21"
],
"data": {
"include_fields": "phonenumber,did_sid,name"
},
"results_email": "[email protected]"
}
The following is the cURL request to create this batch task:
curl -X POST \
'https://api.carrierx.com/core/v2/batch/tasks' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${TOKEN}" \
--data-binary '{
"method":"GET",
"type":"phonenumber",
"field":"filter",
"entries":["did_group_sid eq d9b2e4a5-9d6c-4c1a-8e2f-3f7b6a5c4d21"],
"data":{"include_fields":"phonenumber,did_sid,name"},
"results_email":"[email protected]"
}'
Response
201 status code with a serialized copy of the Task object:
{
"data": {
"include_fields": "phonenumber,did_sid,name"
},
"date_created": "2026-10-20T13:19:08.267Z",
"date_modified": "2026-10-20T13:19:08.267Z",
"entries": [
"did_group_sid eq d9b2e4a5-9d6c-4c1a-8e2f-3f7b6a5c4d21"
],
"failure": null,
"field": "filter",
"method": "GET",
"partner_sid": "7140b67f-f8a0-428f-a9a9-97c66d6523cb",
"processed": null,
"results_email": "[email protected]",
"results_url": null,
"review": false,
"status": "created",
"success": null,
"task_sid": "9b3e5d71-2c8a-4f6e-a1d4-7e0c3b9f2a58",
"total": null,
"type": "phonenumber"
}
The results file of this task has the columns in the same order as the fields of the DID object:
did_sid,phonenumber,name
5c1f8e2a-7b3d-4e9a-a6c2-0d8b4f1e9a37,14849687406,(484) 968-7406
b8e27d4c-1a9f-4c3e-8d5b-6f2a0e7c3b91,14849723113,(484) 972-3113
Example Request: Export All DIDs
An example request to create a batch task that exports all DIDs of the partner. The attributes and transformations fields are not included in the file:
{
"method": "GET",
"type": "phonenumber",
"data": {
"exclude_fields": "attributes,transformations"
}
}
The following is the cURL request to create this batch task:
curl -X POST \
'https://api.carrierx.com/core/v2/batch/tasks' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${TOKEN}" \
--data-binary '{
"method":"GET",
"type":"phonenumber",
"data":{"exclude_fields":"attributes,transformations"}
}'
Response
201 status code with a serialized copy of the Task object:
{
"data": {
"exclude_fields": "attributes,transformations"
},
"date_created": "2026-10-20T13:19:09.187Z",
"date_modified": "2026-10-20T13:19:09.187Z",
"entries": [],
"failure": null,
"field": null,
"method": "GET",
"partner_sid": "7140b67f-f8a0-428f-a9a9-97c66d6523cb",
"processed": null,
"results_email": null,
"results_url": null,
"review": false,
"status": "created",
"success": null,
"task_sid": "c2d8a4f7-6e1b-4b9c-8d3a-5f7e0a2c1b64",
"total": null,
"type": "phonenumber"
}
PATCH - Update Existing Objects
The entries field is used to specify the objects to update. It is an array of strings, each string representing an object to update.
The field field specifies the field to use to locate the objects to update.
The data field is used to specify the data to update the objects with. It is an object, each key-value pair representing a field to update the objects with.
The type field specifies the type of object to update. Refer to this table to view all types that can be updated.
Example Request
An example request to create a batch task that updates the trunk group of two phonenumbers:
To make it more readable, the JSON payload for the example request is shown below.
{
"method": "PATCH",
"type": "phonenumber",
"review": true,
"field":"phonenumber",
"data":{
"trunk_group_sid": "9070c888-ee95-449b-803b-f2fa082325f8"
},
"entries":[
"14849687406",
"14849723113"
]
}
The following is the cURL PATCH request to create a batch task to update the trunk group of two phonenumbers:
curl -X POST \
'https://api.carrierx.com/core/v2/batch/tasks' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${TOKEN}" \
--data-binary '{
"method":"PATCH",
"type":"phonenumber",
"review":true,
"field":"phonenumber",
"data":{"trunk_group_sid":"9070c888-ee95-449b-803b-f2fa082325f8"},
"entries":["14849687406","14849723113"]
}'
Response
201 status code with a serialized copy of the Task object:
{
"data": {
"trunk_group_sid": "9070c888-ee95-449b-803b-f2fa082325f8"
},
"date_created": "2026-04-09T00:21:40.402Z",
"date_modified": "2026-04-09T00:21:40.402Z",
"entries": [
"14849687406",
"14849723113"
],
"failure": null,
"field": "phonenumber",
"method": "PATCH",
"partner_sid": "2a8aed9a-544e-435c-86fc-3378cf9c4127",
"processed": null,
"results_email": null,
"results_url": null,
"review": true,
"status": "created",
"success": null,
"task_sid": "415d3012-b3a5-4e0f-8c12-49a9cbb12309",
"total": null,
"type": "phonenumber"
}
DELETE - Delete Existing Objects
The entries field is used to specify the objects to delete. It is an array of strings, each string representing an object to delete.
The field field specifies the field to use to locate the objects to delete.
The type field specifies the type of object to delete. Refer to this table to view all types that can be deleted.
The data field is not used for DELETE operations and must be set to null or not be included in the request body.
Example Request
An example request to create a batch task that deletes two phonenumbers:
To make it more readable, the JSON payload for the example request is shown below.
{
"method": "DELETE",
"type": "phonenumber",
"review": true,
"field":"phonenumber",
"entries":[
"14849687406",
"14849723113"
]
}
The following is the cURL DELETE request to create a batch task to delete two phonenumbers:
curl -X POST \
'https://api.carrierx.com/core/v2/batch/tasks' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${TOKEN}" \
--data-binary '{
"method":"DELETE",
"type":"phonenumber",
"review":true,
"field":"phonenumber",
"entries":["14849687406","14849723113"]
}'
Response
201 status code with a serialized copy of the Task object:
{
"data": null,
"date_created": "2026-04-09T00:30:53.619Z",
"date_modified": "2026-04-09T00:30:53.619Z",
"entries": [
"14849687406",
"14849723113"
],
"failure": null,
"field": "phonenumber",
"method": "DELETE",
"partner_sid": "6e5291c5-f996-4c9d-b7b5-e03d7be7aa95",
"processed": null,
"results_email": null,
"results_url": null,
"review": true,
"status": "created",
"success": null,
"task_sid": "2f32f2f3-0acf-4aed-8607-b42d5875f4ec",
"total": null,
"type": "phonenumber"
}
Update DID Settings
The sms_enablement, line_information, and emergency task types update the messaging, line information, and emergency settings of many DIDs in one task. Refer to DID Settings Task Types for the methods and data fields that each type accepts.
Example Request: Enable Messaging
An example request to create a batch task that enables SMS/MMS messaging for all DIDs in a DID group:
{
"method": "PATCH",
"type": "sms_enablement",
"review": true,
"field": "filter",
"entries": [
"did_group_sid eq d9b2e4a5-9d6c-4c1a-8e2f-3f7b6a5c4d21"
],
"data": {
"enabled": true
}
}
The following is the cURL request to create this batch task:
curl -X POST \
'https://api.carrierx.com/core/v2/batch/tasks' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${TOKEN}" \
--data-binary '{
"method":"PATCH",
"type":"sms_enablement",
"review":true,
"field":"filter",
"entries":["did_group_sid eq d9b2e4a5-9d6c-4c1a-8e2f-3f7b6a5c4d21"],
"data":{"enabled":true}
}'
Response
201 status code with a serialized copy of the Task object:
{
"data": {
"enabled": true
},
"date_created": "2026-10-20T09:52:49.865Z",
"date_modified": "2026-10-20T09:52:49.865Z",
"entries": [
"did_group_sid eq d9b2e4a5-9d6c-4c1a-8e2f-3f7b6a5c4d21"
],
"failure": null,
"field": "filter",
"method": "PATCH",
"partner_sid": "7140b67f-f8a0-428f-a9a9-97c66d6523cb",
"processed": null,
"results_email": null,
"results_url": null,
"review": true,
"status": "created",
"success": null,
"task_sid": "4e7a2c19-8d3b-4f6e-b1a5-9c0d2e8f7a63",
"total": null,
"type": "sms_enablement"
}
Example Request: Update Line Information
An example request to create a batch task that sets the same caller name for two DIDs. The DIDs are selected by their phonenumber_sid values:
{
"method": "PATCH",
"type": "line_information",
"review": true,
"field": "phonenumber_sid",
"entries": [
"5c1f8e2a-7b3d-4e9a-a6c2-0d8b4f1e9a37",
"b8e27d4c-1a9f-4c3e-8d5b-6f2a0e7c3b91"
],
"data": {
"enabled": true,
"caller_name": "ACME CORP"
}
}
The following is the cURL request to create this batch task:
curl -X POST \
'https://api.carrierx.com/core/v2/batch/tasks' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${TOKEN}" \
--data-binary '{
"method":"PATCH",
"type":"line_information",
"review":true,
"field":"phonenumber_sid",
"entries":[
"5c1f8e2a-7b3d-4e9a-a6c2-0d8b4f1e9a37",
"b8e27d4c-1a9f-4c3e-8d5b-6f2a0e7c3b91"
],
"data":{"enabled":true,"caller_name":"ACME CORP"}
}'
Response
201 status code with a serialized copy of the Task object:
{
"data": {
"enabled": true,
"caller_name": "ACME CORP"
},
"date_created": "2026-10-20T09:52:52.497Z",
"date_modified": "2026-10-20T09:52:52.497Z",
"entries": [
"5c1f8e2a-7b3d-4e9a-a6c2-0d8b4f1e9a37",
"b8e27d4c-1a9f-4c3e-8d5b-6f2a0e7c3b91"
],
"failure": null,
"field": "phonenumber_sid",
"method": "PATCH",
"partner_sid": "7140b67f-f8a0-428f-a9a9-97c66d6523cb",
"processed": null,
"results_email": null,
"results_url": null,
"review": true,
"status": "created",
"success": null,
"task_sid": "a3d91f6e-2b7c-4a8e-9f14-5e6b0c3d2a87",
"total": null,
"type": "line_information"
}
Example Request: Update Emergency Information
An example request to create a batch task that sets the same emergency caller name and location for two DIDs:
{
"method": "PATCH",
"type": "emergency",
"review": true,
"field": "phonenumber",
"entries": [
"14849687406",
"14849723113"
],
"data": {
"enabled": true,
"caller_name": "ACME CORP",
"locations": [
{
"country_code": "USA",
"address_1": "123 Main St",
"city": "Austin",
"state": "TX",
"zip": "78701"
}
]
}
}
The following is the cURL request to create this batch task:
curl -X POST \
'https://api.carrierx.com/core/v2/batch/tasks' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${TOKEN}" \
--data-binary '{
"method":"PATCH",
"type":"emergency",
"review":true,
"field":"phonenumber",
"entries":["14849687406","14849723113"],
"data":{
"enabled":true,
"caller_name":"ACME CORP",
"locations":[
{
"country_code":"USA",
"address_1":"123 Main St",
"city":"Austin",
"state":"TX",
"zip":"78701"
}
]
}
}'
Response
201 status code with a serialized copy of the Task object:
{
"data": {
"enabled": true,
"caller_name": "ACME CORP",
"locations": [
{
"country_code": "USA",
"address_1": "123 Main St",
"city": "Austin",
"state": "TX",
"zip": "78701"
}
]
},
"date_created": "2026-10-20T09:52:55.890Z",
"date_modified": "2026-10-20T09:52:55.890Z",
"entries": [
"14849687406",
"14849723113"
],
"failure": null,
"field": "phonenumber",
"method": "PATCH",
"partner_sid": "7140b67f-f8a0-428f-a9a9-97c66d6523cb",
"processed": null,
"results_email": null,
"results_url": null,
"review": true,
"status": "created",
"success": null,
"task_sid": "e6b4c8a2-9f1d-4e3b-a7c5-2d8f0b6e1a94",
"total": null,
"type": "emergency"
}
Example Request: Delete Emergency Information
An example request to create a batch task that removes the emergency information from two DIDs. The data field must be empty for DELETE tasks. A line_information task with the DELETE method uses the same request body with a different type value.
{
"method": "DELETE",
"type": "emergency",
"review": true,
"field": "phonenumber",
"entries": [
"14849687406",
"14849723113"
]
}
The following is the cURL request to create this batch task:
curl -X POST \
'https://api.carrierx.com/core/v2/batch/tasks' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${TOKEN}" \
--data-binary '{
"method":"DELETE",
"type":"emergency",
"review":true,
"field":"phonenumber",
"entries":["14849687406","14849723113"]
}'
Response
201 status code with a serialized copy of the Task object:
{
"data": null,
"date_created": "2026-10-20T09:52:56.716Z",
"date_modified": "2026-10-20T09:52:56.716Z",
"entries": [
"14849687406",
"14849723113"
],
"failure": null,
"field": "phonenumber",
"method": "DELETE",
"partner_sid": "7140b67f-f8a0-428f-a9a9-97c66d6523cb",
"processed": null,
"results_email": null,
"results_url": null,
"review": true,
"status": "created",
"success": null,
"task_sid": "1f9d7e3b-6a2c-4b8d-9e5f-0c4a7b2d8e16",
"total": null,
"type": "emergency"
}
Required Scopes
To create a Task object, the partner must have one of the following scopes enabled:
batch.managebatch.create
Body Arguments
JSON representation of the fields and values of the Task object to be created.
Required fields to create a batch task depend on the method field value of the Task object:
| "method" Field Value | Required Fields |
|---|---|
"DELETE" | entries, field, method, type |
"GET" | method, type |
"PATCH" | data, entries, field, method, type |
"POST" | data, method, type |
Refer to this table to view all fields that appear in the Task object.