Create a batch
Creates a batch of outbound calls using an agent: an API layer over
the same batch engine that powers the dashboard’s CSV upload flow (same
dispatcher, scheduling, retry, and concurrency behavior; this route only
adds a JSON recipients[] intake alongside the existing CSV one).
Sends immediately unless scheduled_at (ISO 8601) is provided. Provide a
webhook_url to receive a single POST when the batch reaches a terminal
state. Pass an Idempotency-Key header to safely retry this request.
curl --request POST \
--url https://app.eclatira.com/api/v1/batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"name": "<string>",
"recipients": [
{
"to_number": "<string>",
"variables": {},
"first_message": "<string>"
}
],
"provider": "<string>",
"scheduled_at": "<string>",
"webhook_url": "<string>"
}
'import requests
url = "https://app.eclatira.com/api/v1/batches"
payload = {
"agent_id": "<string>",
"name": "<string>",
"recipients": [
{
"to_number": "<string>",
"variables": {},
"first_message": "<string>"
}
],
"provider": "<string>",
"scheduled_at": "<string>",
"webhook_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '<string>',
name: '<string>',
recipients: [{to_number: '<string>', variables: {}, first_message: '<string>'}],
provider: '<string>',
scheduled_at: '<string>',
webhook_url: '<string>'
})
};
fetch('https://app.eclatira.com/api/v1/batches', 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://app.eclatira.com/api/v1/batches",
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([
'agent_id' => '<string>',
'name' => '<string>',
'recipients' => [
[
'to_number' => '<string>',
'variables' => [
],
'first_message' => '<string>'
]
],
'provider' => '<string>',
'scheduled_at' => '<string>',
'webhook_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.eclatira.com/api/v1/batches"
payload := strings.NewReader("{\n \"agent_id\": \"<string>\",\n \"name\": \"<string>\",\n \"recipients\": [\n {\n \"to_number\": \"<string>\",\n \"variables\": {},\n \"first_message\": \"<string>\"\n }\n ],\n \"provider\": \"<string>\",\n \"scheduled_at\": \"<string>\",\n \"webhook_url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://app.eclatira.com/api/v1/batches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"name\": \"<string>\",\n \"recipients\": [\n {\n \"to_number\": \"<string>\",\n \"variables\": {},\n \"first_message\": \"<string>\"\n }\n ],\n \"provider\": \"<string>\",\n \"scheduled_at\": \"<string>\",\n \"webhook_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.eclatira.com/api/v1/batches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"<string>\",\n \"name\": \"<string>\",\n \"recipients\": [\n {\n \"to_number\": \"<string>\",\n \"variables\": {},\n \"first_message\": \"<string>\"\n }\n ],\n \"provider\": \"<string>\",\n \"scheduled_at\": \"<string>\",\n \"webhook_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"batch_id": "<string>",
"agent_id": "<string>",
"name": "<string>",
"status": "<string>",
"total": 123,
"skipped": {},
"created_at": "2023-11-07T05:31:56Z",
"provider": "<string>",
"scheduled_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
A long-lived, privileged API key (ek_... prefix), minted once from the dashboard. Intended for trusted server-side use only; never expose it in client-side code. Send as Authorization: Bearer ek_.... Required by every Calls, Batches, Agents, Tools, MCP Servers, Documents, and Realtime route.
Body
curl --request POST \
--url https://app.eclatira.com/api/v1/batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"name": "<string>",
"recipients": [
{
"to_number": "<string>",
"variables": {},
"first_message": "<string>"
}
],
"provider": "<string>",
"scheduled_at": "<string>",
"webhook_url": "<string>"
}
'import requests
url = "https://app.eclatira.com/api/v1/batches"
payload = {
"agent_id": "<string>",
"name": "<string>",
"recipients": [
{
"to_number": "<string>",
"variables": {},
"first_message": "<string>"
}
],
"provider": "<string>",
"scheduled_at": "<string>",
"webhook_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '<string>',
name: '<string>',
recipients: [{to_number: '<string>', variables: {}, first_message: '<string>'}],
provider: '<string>',
scheduled_at: '<string>',
webhook_url: '<string>'
})
};
fetch('https://app.eclatira.com/api/v1/batches', 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://app.eclatira.com/api/v1/batches",
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([
'agent_id' => '<string>',
'name' => '<string>',
'recipients' => [
[
'to_number' => '<string>',
'variables' => [
],
'first_message' => '<string>'
]
],
'provider' => '<string>',
'scheduled_at' => '<string>',
'webhook_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.eclatira.com/api/v1/batches"
payload := strings.NewReader("{\n \"agent_id\": \"<string>\",\n \"name\": \"<string>\",\n \"recipients\": [\n {\n \"to_number\": \"<string>\",\n \"variables\": {},\n \"first_message\": \"<string>\"\n }\n ],\n \"provider\": \"<string>\",\n \"scheduled_at\": \"<string>\",\n \"webhook_url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://app.eclatira.com/api/v1/batches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"name\": \"<string>\",\n \"recipients\": [\n {\n \"to_number\": \"<string>\",\n \"variables\": {},\n \"first_message\": \"<string>\"\n }\n ],\n \"provider\": \"<string>\",\n \"scheduled_at\": \"<string>\",\n \"webhook_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.eclatira.com/api/v1/batches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"<string>\",\n \"name\": \"<string>\",\n \"recipients\": [\n {\n \"to_number\": \"<string>\",\n \"variables\": {},\n \"first_message\": \"<string>\"\n }\n ],\n \"provider\": \"<string>\",\n \"scheduled_at\": \"<string>\",\n \"webhook_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"batch_id": "<string>",
"agent_id": "<string>",
"name": "<string>",
"status": "<string>",
"total": 123,
"skipped": {},
"created_at": "2023-11-07T05:31:56Z",
"provider": "<string>",
"scheduled_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}