---
title: Get all mailing IDs a coupon block is assigned to
slug: campaign/api/get-all-mailing-ids-a-coupon-block-is-assigned-to
docTags: 
createdAt: 2026-09-02T15:04:15.718Z
---

{
  "id": "adTmvTRFbCr4PEqYRUNwT",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://api.campaign.episerver.net/rest/{clientId}/couponblocks/{couponBlockId}/assignedmailings",
    "servers": [
      {
        "url": "https://api.campaign.episerver.net/rest/{clientId}/couponblocks/{couponBlockId}/assignedmailings"
      }
    ],
    "name": "Get all mailing IDs a coupon block is assigned to",
    "description": "Get all mailing IDs to which a specified coupon block is assigned.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "clientId",
          "type": "integer<int64>",
          "description": "Client ID",
          "format": "int64"
        },
        {
          "kind": "required",
          "name": "couponBlockId",
          "type": "integer<int64>",
          "description": "Coupon block ID",
          "format": "int64"
        }
      ],
      "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": [],
      "oAuthParameters": [
        {
          "id": "Authorization",
          "name": "Authorization",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "The mailing IDs were retrieved successfully.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "RestAssignedMailings",
            "schema": [
              {
                "name": "mailingIds",
                "kind": "optional",
                "type": "array",
                "description": "",
                "example": "",
                "itemType": "integer",
                "customType": "integer[]",
                "itemExample": "",
                "itemDefault": ""
              }
            ],
            "modelRef": "#/components/schemas/RestAssignedMailings",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "404",
        "description": "The coupon block could not be found. Ensure that the required parameters such as \"couponBlockId\" are correct and the coupon block exists.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "409",
        "description": "The coupon block is not assigned to the indicated client. Ensure that \"clientId\" and \"couponBlockId\" are correct and that the \"couponBlockId\" is assigned to the indicated client.",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "ISZJbo9VZRk5NkMURomSs",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url https://api.campaign.episerver.net/rest/{clientId}/couponblocks/{couponBlockId}/assignedmailings \\\n     --header 'accept: application/json'"
        },
        {
          "id": "vj86XTMqQOVivFBe8X05-",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.campaign.episerver.net/rest/{clientId}/couponblocks/{couponBlockId}/assignedmailings\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "6gQv7Xqbgr8tAms-9vjLD",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.campaign.episerver.net/rest/{clientId}/couponblocks/{couponBlockId}/assignedmailings\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "lvG3lW2lFsq55gIa-4zIc",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.campaign.episerver.net/rest/{clientId}/couponblocks/{couponBlockId}/assignedmailings\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "ISZJbo9VZRk5NkMURomSs"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// The mailing IDs were retrieved successfully.\n{\n  \"mailingIds\": [\n    0\n  ]\n}"
        },
        {
          "id": "response-1-404",
          "language": "404",
          "code": "// The coupon block could not be found. Ensure that the required parameters such as \"couponBlockId\" are correct and the coupon block exists.\n"
        },
        {
          "id": "response-2-409",
          "language": "409",
          "code": "// The coupon block is not assigned to the indicated client. Ensure that \"clientId\" and \"couponBlockId\" are correct and that the \"couponBlockId\" is assigned to the indicated client.\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}