POST - Update campaign

It allows to update some parameters of a campaign.

API Description

This API schema is available in the OpenAPI 3.1 format: View it online.

Request structure

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

https://api.batch.com/2.1/campaigns/update

Headers and authentification

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)
  • 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.