cURL
curl --request POST \
--url https://www.oration.ai/api/v2/customers/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-workspace-id: <x-workspace-id>' \
--header 'x-workspace-slug: <x-workspace-slug>' \
--data '
{
"customers": [
{
"identifier": "<string>",
"name": "<string>",
"phoneNumber": "<string>",
"email": "jsmith@example.com",
"metadata": "<string>",
"source": {
"method": "api"
},
"priority": 5,
"isDoNotDisturbEnabled": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"strategy": "insert",
"partial": false
}
'import requests
url = "https://www.oration.ai/api/v2/customers/batch"
payload = {
"customers": [
{
"identifier": "<string>",
"name": "<string>",
"phoneNumber": "<string>",
"email": "jsmith@example.com",
"metadata": "<string>",
"source": { "method": "api" },
"priority": 5,
"isDoNotDisturbEnabled": True,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"strategy": "insert",
"partial": False
}
headers = {
"x-api-key": "<x-api-key>",
"x-workspace-slug": "<x-workspace-slug>",
"x-workspace-id": "<x-workspace-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-workspace-slug': '<x-workspace-slug>',
'x-workspace-id': '<x-workspace-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customers: [
{
identifier: '<string>',
name: '<string>',
phoneNumber: '<string>',
email: 'jsmith@example.com',
metadata: '<string>',
source: {method: 'api'},
priority: 5,
isDoNotDisturbEnabled: true,
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
],
strategy: 'insert',
partial: false
})
};
fetch('https://www.oration.ai/api/v2/customers/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.oration.ai/api/v2/customers/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customers' => [
[
'identifier' => '<string>',
'name' => '<string>',
'phoneNumber' => '<string>',
'email' => 'jsmith@example.com',
'metadata' => '<string>',
'source' => [
'method' => 'api'
],
'priority' => 5,
'isDoNotDisturbEnabled' => true,
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'strategy' => 'insert',
'partial' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-api-key: <x-api-key>",
"x-workspace-id: <x-workspace-id>",
"x-workspace-slug: <x-workspace-slug>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.oration.ai/api/v2/customers/batch"
payload := strings.NewReader("{\n \"customers\": [\n {\n \"identifier\": \"<string>\",\n \"name\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"metadata\": \"<string>\",\n \"source\": {\n \"method\": \"api\"\n },\n \"priority\": 5,\n \"isDoNotDisturbEnabled\": true,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"strategy\": \"insert\",\n \"partial\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-workspace-slug", "<x-workspace-slug>")
req.Header.Add("x-workspace-id", "<x-workspace-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.oration.ai/api/v2/customers/batch")
.header("x-api-key", "<x-api-key>")
.header("x-workspace-slug", "<x-workspace-slug>")
.header("x-workspace-id", "<x-workspace-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customers\": [\n {\n \"identifier\": \"<string>\",\n \"name\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"metadata\": \"<string>\",\n \"source\": {\n \"method\": \"api\"\n },\n \"priority\": 5,\n \"isDoNotDisturbEnabled\": true,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"strategy\": \"insert\",\n \"partial\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.oration.ai/api/v2/customers/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-workspace-slug"] = '<x-workspace-slug>'
request["x-workspace-id"] = '<x-workspace-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customers\": [\n {\n \"identifier\": \"<string>\",\n \"name\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"metadata\": \"<string>\",\n \"source\": {\n \"method\": \"api\"\n },\n \"priority\": 5,\n \"isDoNotDisturbEnabled\": true,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"strategy\": \"insert\",\n \"partial\": false\n}"
response = http.request(request)
puts response.read_body{
"jobId": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}Customers
Create Customers
POST
/
customers
/
batch
cURL
curl --request POST \
--url https://www.oration.ai/api/v2/customers/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-workspace-id: <x-workspace-id>' \
--header 'x-workspace-slug: <x-workspace-slug>' \
--data '
{
"customers": [
{
"identifier": "<string>",
"name": "<string>",
"phoneNumber": "<string>",
"email": "jsmith@example.com",
"metadata": "<string>",
"source": {
"method": "api"
},
"priority": 5,
"isDoNotDisturbEnabled": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"strategy": "insert",
"partial": false
}
'import requests
url = "https://www.oration.ai/api/v2/customers/batch"
payload = {
"customers": [
{
"identifier": "<string>",
"name": "<string>",
"phoneNumber": "<string>",
"email": "jsmith@example.com",
"metadata": "<string>",
"source": { "method": "api" },
"priority": 5,
"isDoNotDisturbEnabled": True,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"strategy": "insert",
"partial": False
}
headers = {
"x-api-key": "<x-api-key>",
"x-workspace-slug": "<x-workspace-slug>",
"x-workspace-id": "<x-workspace-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-workspace-slug': '<x-workspace-slug>',
'x-workspace-id': '<x-workspace-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customers: [
{
identifier: '<string>',
name: '<string>',
phoneNumber: '<string>',
email: 'jsmith@example.com',
metadata: '<string>',
source: {method: 'api'},
priority: 5,
isDoNotDisturbEnabled: true,
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
],
strategy: 'insert',
partial: false
})
};
fetch('https://www.oration.ai/api/v2/customers/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.oration.ai/api/v2/customers/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customers' => [
[
'identifier' => '<string>',
'name' => '<string>',
'phoneNumber' => '<string>',
'email' => 'jsmith@example.com',
'metadata' => '<string>',
'source' => [
'method' => 'api'
],
'priority' => 5,
'isDoNotDisturbEnabled' => true,
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'strategy' => 'insert',
'partial' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-api-key: <x-api-key>",
"x-workspace-id: <x-workspace-id>",
"x-workspace-slug: <x-workspace-slug>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.oration.ai/api/v2/customers/batch"
payload := strings.NewReader("{\n \"customers\": [\n {\n \"identifier\": \"<string>\",\n \"name\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"metadata\": \"<string>\",\n \"source\": {\n \"method\": \"api\"\n },\n \"priority\": 5,\n \"isDoNotDisturbEnabled\": true,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"strategy\": \"insert\",\n \"partial\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-workspace-slug", "<x-workspace-slug>")
req.Header.Add("x-workspace-id", "<x-workspace-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.oration.ai/api/v2/customers/batch")
.header("x-api-key", "<x-api-key>")
.header("x-workspace-slug", "<x-workspace-slug>")
.header("x-workspace-id", "<x-workspace-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customers\": [\n {\n \"identifier\": \"<string>\",\n \"name\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"metadata\": \"<string>\",\n \"source\": {\n \"method\": \"api\"\n },\n \"priority\": 5,\n \"isDoNotDisturbEnabled\": true,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"strategy\": \"insert\",\n \"partial\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.oration.ai/api/v2/customers/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-workspace-slug"] = '<x-workspace-slug>'
request["x-workspace-id"] = '<x-workspace-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customers\": [\n {\n \"identifier\": \"<string>\",\n \"name\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"metadata\": \"<string>\",\n \"source\": {\n \"method\": \"api\"\n },\n \"priority\": 5,\n \"isDoNotDisturbEnabled\": true,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"strategy\": \"insert\",\n \"partial\": false\n}"
response = http.request(request)
puts response.read_body{
"jobId": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}Creating Customers
This endpoint allows you to create customers.Request Body
The request body should contain acustomers array with the customer information you want to create. Each customer object in the array should include the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | No | The customer’s full name |
| phoneNumber | string | No | The customer’s phone number in E.164 format (e.g., +12345678901) |
| string | No | The customer’s email address | |
| identifier | string | Yes | A unique identifier for the customer in your system |
| metadata | object/string/number/boolean/null | No | Additional data about the customer that you want to store |
| priority | integer | No | Calling priority for the customer. Default: 5. Ascending order. |
priority to control how the customers are picked during campaign runs. It is calculated in ascending order. Lower the value, higher the priority. 0 is the highest priority.
In addition to the customers array, the request body can include the following top-level parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| strategy | string | No | The strategy to use when creating customers. Can be upsert or insert. Defaults to insert |
| partial | boolean | No | When set to true, allows partial batch processing. Only valid when strategy is set to insert. This ensures customers without errors are still inserted even if others in the batch fail. |
Response Structure
The response includes the job ID. You can use this job ID to check the status of the job.| Field | Type | Description |
|---|---|---|
| jobId | string | The unique identifier of the job |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Minimum string length:
1Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Body
application/json
Response
Successful response
⌘I