---
title: Prepares new sending batch
slug: campaign/api/prepares-new-sending-batch
docTags: 
createdAt: 2026-09-02T15:04:15.718Z
---

{
  "id": "O6gVNPs9GTU0k4W9yqAKS",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.campaign.episerver.net/rest/{clientId}/sending/batches",
    "servers": [
      {
        "url": "https://api.campaign.episerver.net/rest/{clientId}/sending/batches"
      }
    ],
    "name": "Prepares new sending batch",
    "description": "Creates a new sending batch based on configured campaign parameters and the next available recipient list from the pool.",
    "contentType": "multipart/form-data",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "clientId",
          "type": "number",
          "description": "Client ID"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json",
            "application/vnd.optivo.broadmail.v1+json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [
        {
          "name": "campaign",
          "kind": "required",
          "type": "string",
          "description": "Campaign definition based on the value of campaignAction"
        },
        {
          "name": "campaignAction",
          "kind": "required",
          "type": "string<use | copy>",
          "description": "Campaign action",
          "enum": [
            "use",
            "copy"
          ]
        },
        {
          "name": "tag",
          "kind": "optional",
          "type": "string",
          "description": "Tag reference"
        }
      ],
      "oAuthParameters": [
        {
          "id": "Authorization",
          "name": "Authorization",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "The batch was prepared successfully.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "RestSendingBatch",
            "schema": [
              {
                "name": "id",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "Batch ID",
                "format": "int64"
              },
              {
                "name": "campaignId",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "Campaign ID",
                "format": "int64"
              },
              {
                "name": "recipientListId",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "Recipient list ID",
                "format": "int64"
              },
              {
                "name": "tag",
                "kind": "optional",
                "type": "string",
                "description": "Tag"
              },
              {
                "name": "chunks",
                "kind": "optional",
                "type": "array",
                "description": "Chunks",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "state",
                "kind": "optional",
                "type": "string<initiated | has_recipients | sent | invalid>",
                "description": "State",
                "enum": [
                  "initiated",
                  "has_recipients",
                  "sent",
                  "invalid"
                ]
              },
              {
                "name": "links",
                "kind": "optional",
                "type": "array",
                "description": "",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "schema": [
                  {
                    "name": "uriBuilder",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "example": "",
                    "schema": []
                  },
                  {
                    "name": "rels",
                    "kind": "optional",
                    "type": "array",
                    "description": "",
                    "example": "",
                    "itemType": "string",
                    "customType": "string[]",
                    "itemExample": "",
                    "itemDefault": ""
                  },
                  {
                    "name": "rel",
                    "kind": "optional",
                    "type": "string",
                    "description": ""
                  },
                  {
                    "name": "type",
                    "kind": "optional",
                    "type": "string",
                    "description": ""
                  },
                  {
                    "name": "params",
                    "kind": "optional",
                    "type": "map",
                    "description": "",
                    "example": "",
                    "customType": "map<string, string>",
                    "schema": []
                  },
                  {
                    "name": "title",
                    "kind": "optional",
                    "type": "string",
                    "description": ""
                  },
                  {
                    "name": "uri",
                    "kind": "optional",
                    "type": "string<uri>",
                    "description": "",
                    "format": "uri"
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/RestSendingBatch",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "409",
        "description": "",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "74bh_l_cdUNlScW4OfeDM",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.campaign.episerver.net/rest/{clientId}/sending/batches \\\n     --header 'accept: application/json' \\\n     --header 'content-type: multipart/form-data' \\\n     --form 'campaign=\"string\"' \\\n     --form 'campaignAction=\"use\"'"
        },
        {
          "id": "q3SHYWuzQsQSP2V9Nq1-q",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"multipart/form-data\");\n\nvar formdata = new FormData();\nformdata.append(\"campaign\", \"string\");\nformdata.append(\"campaignAction\", \"use\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: formdata,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.campaign.episerver.net/rest/{clientId}/sending/batches\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "ZxZN7lteJHl9StQdROAUE",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.campaign.episerver.net/rest/{clientId}/sending/batches\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"multipart/form-data\"\nform_data = [['campaign', File.open('undefined')],['campaignAction', File.open('undefined')]]\nrequest.set_form form_data, 'multipart/form-data'\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "zRA4NC5t0V5w1jL6Hcj6s",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"https://api.campaign.episerver.net/rest/{clientId}/sending/batches\"\n\npayload = {}\nfiles=[\n\n]\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'multipart/form-data'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload, files=files)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "74bh_l_cdUNlScW4OfeDM"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-201",
          "language": "201",
          "code": "// The batch was prepared successfully.\n{\n  \"id\": \"\",\n  \"campaignId\": \"\",\n  \"recipientListId\": \"\",\n  \"tag\": \"\",\n  \"chunks\": [\n    \"\"\n  ],\n  \"state\": \"\",\n  \"links\": [\n    {\n      \"uriBuilder\": {},\n      \"rels\": [\n        \"\"\n      ],\n      \"rel\": \"\",\n      \"type\": \"\",\n      \"params\": \"\",\n      \"title\": \"\",\n      \"uri\": \"\"\n    }\n  ]\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": ""
        },
        {
          "id": "response-2-409",
          "language": "409",
          "code": ""
        }
      ],
      "selectedLanguageId": "response-0-201"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}