Skip to navigation

Create batch

View as Markdown

Creates a new batch with contacts. Each contact must have contact_name and contact_phone. Additional fields are stored in agent_args and can be used during calls. Customer ID is automatically determined from the API key. To add contacts to an existing batch, use POST /api/batch/{id}/contacts.

Authentication

X-API-Keystring

API key for authentication. Example: raya_ABCD1234567890abcdef

Request

This endpoint expects an object.
agent_idstringRequiredformat: "uuid"
The UUID of the agent to use for this batch
batch_namestringRequired>=1 character
Name for the batch
contactslist of objectsRequired

Array of contact objects. Each contact must have contact_name and contact_phone. Additional fields are allowed.

Response

Batch created successfully
statusenumOptional
Status of the batch creation
Allowed values:
messagestringOptional

Human-readable message about the result

totalRowsintegerOptional
Total number of contacts in the request
validRowsintegerOptional
Number of valid contacts that were processed
invalidRowsintegerOptional
Number of invalid contacts that were rejected
batchIdintegerOptional
ID of the created or updated batch
contactsInsertedintegerOptional
Number of contacts successfully added to the batch
datalist of maps from strings to anyOptional
Array of valid contact data that was processed
errorslist of objectsOptional

Array of validation errors (only present if status is error)

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error