---
title: Get the content of an uploaded attachment
slug: campaign/api/get-the-content-of-an-uploaded-attachment
docTags: 
createdAt: 2026-09-02T15:04:15.718Z
---

{
  "id": "x2yr478t8sYYHIi4ZbskQ",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://api.campaign.episerver.net/rest/{clientId}/attachments/{attachmentId}/content",
    "servers": [
      {
        "url": "https://api.campaign.episerver.net/rest/{clientId}/attachments/{attachmentId}/content"
      }
    ],
    "name": "Get the content of an uploaded attachment",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "clientId",
          "type": "string",
          "description": "Client ID"
        },
        {
          "kind": "required",
          "name": "attachmentId",
          "type": "integer<int64>",
          "description": "Attachment ID",
          "format": "int64"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/octet-stream",
            "application/vnd.optivo.broadmail.v1+json"
          ],
          "default": "application/octet-stream"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "Authorization",
          "name": "Authorization",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "The uploaded content attachment was downloaded successfully.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "The attachment could not be found. Ensure that the required parameters such as \"attachmentId\" are correct and the attachment exists.",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "lkGHrQpjlDlrkEUywvaEK",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url https://api.campaign.episerver.net/rest/{clientId}/attachments/{attachmentId}/content \\\n     --header 'accept: application/octet-stream'"
        },
        {
          "id": "WTAHYr_lzpqL1StmEi30N",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/octet-stream\");\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}/attachments/{attachmentId}/content\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "9h24eBhCLWQFGyqmWfL1G",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.campaign.episerver.net/rest/{clientId}/attachments/{attachmentId}/content\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/octet-stream\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "6ga9b7DSKFD2Kp1PpmJ5u",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.campaign.episerver.net/rest/{clientId}/attachments/{attachmentId}/content\"\n\npayload = {}\nheaders = {\n   'accept': 'application/octet-stream',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "lkGHrQpjlDlrkEUywvaEK"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// The uploaded content attachment was downloaded successfully.\n"
        },
        {
          "id": "response-1-404",
          "language": "404",
          "code": "// The attachment could not be found. Ensure that the required parameters such as \"attachmentId\" are correct and the attachment exists.\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}