Easymailing
Batch operations

Create a batch operation

POST /batch_operations

POST/batch_operations

Queues up to 500 API calls to be run one after another in the background, in the order given. It returns the batch at once; the calls run later. A call that fails does not stop the others.

Each call has method (POST, PUT, GET or DELETE), path (an endpoint of this API, for example /audiences/{audienceUuid}/members), an optional body (a JSON string), optional params (query parameters) and an optional external_identifier of yours to match results.

Each call is checked with the permissions of the token that created the batch, as if you sent it yourself: a call the token is not allowed to make is not run and shows a 403 in the results. The batch can therefore do anything those permissions allow, including deleting or sending.

The batch belongs to the user of the credential that creates it: only that user and an account administrator can read or delete it afterwards.

When to use: To load or change many records in one go, for example adding thousands of members or moving many members to groups, without waiting for each call.

When not to use: For one call, use the operation directly. To act on all members of a segment or group, use the asynchronous operations of Segments and Groups.

Side effects: Every call runs and takes effect in the background, with all the side effects of that operation (emails, automations, webhooks). A call that answers with a server error (500) is attempted up to 3 times. The calls run later with the credential that created the batch: if its user is deactivated before they run, the calls still pending fail with 401.

Permissions: No specific permission.

Authorization

X-Auth-Token<token>

Value for the X-Auth-Token header parameter.

In: header

Request Body

The new BatchOperation resource

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://api.easymailing.com/batch_operations" \  -H "X-Auth-Token: YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "operations": [      {        "method": "POST",        "body": "string",        "path": "string",        "params": {          "property1": "string",          "property2": "string"        },        "external_identifier": "string"      }    ]  }'
{  "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",  "id": 0,  "status": "pending",  "total": 0,  "finished": 0,  "errored": 0,  "finished_at": "string",  "response_body_url": "http://example.com"}