Update campaign

It allows to update some parameters of a campaign.

API Description

Update

post

Update an existing campaign

Authorizations
AuthorizationstringRequired

API Key Authentication

Authentication is required in order to interact with Batch's APIs.

Batch implements authentication using API Keys, that we call the "REST API Key". You can find it on your dashboard.

Please make sure that you keep this key secret. You should never use it in client apps to call APIs from there as it would easily be extractable.

How to authenticate

In order to authenticate your requests, add your REST API Key in the Authorization header and prefix it by Bearer. Example: Authorization: Bearer bcd38d9rfb38ra28.

Header parameters
X-Batch-ProjectstringRequired

The unique project key, identifying a project on the Batch platform

Example: project_0664hxvwffvbpn278gxdyhsadddqgna6
Body
idstringRequired

Campaign id received from the create API

Responses
200

Request successful, campaign udpated

application/json
Responseobject
post
/campaigns/update
POST /2.8/campaigns/update HTTP/1.1 Host: api.batch.com Authorization: Bearer YOUR_SECRET_TOKEN X-Batch-Project: text Content-Type: application/json Accept: */* Content-Length: 471  {  "id": "orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q",  "campaign": {  "name": "The campaign name",  "state": "RUNNING",  "send_rate": 100000,  "when": {  "local_time": false,  "start_time": "2024-01-24T10:22:00Z"  },  "targeting": {  "languages": [  "fr"  ],  "regions": [  "FR"  ],  "query": {  "firstname": {  "$eq": "Jane"  }  }  },  "messages": [  {  "channel_type": "email",  "subject": "The campaign subject",  "sender_identity_id": "4012",  "reply_to": {  "email_address": "jane.doe@demobatch.com"  },  "html": "The campaign HTML content"  }  ]  } }
{}

Request structure

The Campaign API exposes a POST endpoint that allows to update a campaign:

/campaigns/update

Headers and authentication

See Overview → Using Project APIs.

Post data

The body of the request must contain a valid JSON payload describing the campaign.

Exemple of a request body:

 {  "id": "orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q",  "campaign": {  "name": "The campaign name",  "state": "RUNNING",  "when": {  "local_time": false,  "start_time": "2024-01-24T10:22:00Z"  },  "targeting": {  "languages": [  "fr"  ],  "regions": [  "FR"  ],  "query": {  "firstname": {  "$eq": "Jane"  }  }  },  "messages": [  {  "channel_type": "email",  "subject": "The campaign subject",  "sender_identity_id": "4012",  "reply_to": {  "email_address": "jane.doe@demobatch.com"  },  "html": "The campaign HTML content"  }  ]  }  }

identifier block

"id": "orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q"

Campaign identifier is received in the API Campaign create response.

Campaign block

See API Campaigns create for details about parameters.

Responses

Success

If the POST to the API endpoint is successfull you will receive an HTTP 200 confirmation.

Failure

If the POST data does not meet the API requirements you will receive an actionable error message. Contact us at support@batch.com if you need further support.

  • AUTHENTICATION_INVALID (Http status code: 401, Error code: 10)

  • API_MISUSE (Http status code: 403, Error code: 12)

  • ROUTE_NOT_FOUND (Http status code: 404, Error code: 20)

  • MISSING_PARAMETER (Http status code: 400, Error code: 30)

  • MALFORMED_PARAMETER (Http status code: 400, Error code: 31)

  • MALFORMED_JSON_BODY (Http status code: 400, Error code: 32)

  • SERVER_ERROR (Http status code: 500, Error code: 1)

  • MAINTENANCE_ERROR (Http status code: 503, Error code: 2)

  • TOO_MANY_REQUESTS (Http status code: 429, Error code: 60) If you get a "too many requests" response, please wait for at least 5 seconds before trying again. Further requests might still return this error.

Last updated