---
title: Get consent
slug: data-platform/api/get-consent
docTags: 
createdAt: 2026-09-02T14:41:00.110Z
---

{
  "id": "zsbOvB36W8UieslM8kQ9K",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://api.us1.odp.optimizely.com/v3/consent/{identifier_field_name}",
    "servers": [
      {
        "url": "https://api.us1.odp.optimizely.com/v3/consent/{identifier_field_name}",
        "description": "United States"
      },
      {
        "url": "https://api.eu1.odp.optimizely.com/v3/consent/{identifier_field_name}",
        "description": "Europe"
      },
      {
        "url": "https://api.au1.odp.optimizely.com/v3/consent/{identifier_field_name}",
        "description": "Asia-Pacific"
      }
    ],
    "name": "Get consent",
    "description": "Get marketing consent information for a customer.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "identifier_field_name",
          "type": "string",
          "example": "email",
          "description": "<p>the name of the field that this identifier falls under, such as email</p>"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [
        {
          "kind": "required",
          "name": "id",
          "type": "string",
          "example": "example@example.com",
          "description": "<p>the valid messaging identifier you are requesting, such as an email address</p>"
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "x-api-key",
          "name": "x-api-key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Consent information found",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "ConsentGetResponse",
            "schema": [
              {
                "name": "identifier_field_name",
                "kind": "required",
                "type": "string",
                "description": "<p>The name of the field that this identifier falls under, such as email</p>",
                "example": "email"
              },
              {
                "name": "identifier_value",
                "kind": "required",
                "type": "string",
                "description": "<p>The valid messaging identifier you are requesting, such as an email address</p>",
                "example": "example@example.com"
              },
              {
                "name": "consent",
                "kind": "required",
                "type": "boolean",
                "description": "<p>true/false indicator of whether a customer has provided consent to receive marketing messages on this identifier</p>",
                "example": true
              },
              {
                "name": "consent_update_reason",
                "kind": "optional",
                "type": "string",
                "description": "<p>(optional) a reason for updating consent; can be any text value, for audit purposes</p>"
              },
              {
                "name": "consent_update_ts",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "<p>(optional) a reason for updating consent; can be any text value, for audit purposes</p>",
                "format": "int64"
              },
              {
                "name": "zaius_id",
                "kind": "optional",
                "type": "integer<int64>",
                "readOnly": true,
                "description": "<p>(optional) a reason for updating consent; can be any text value, for audit purposes</p>",
                "format": "int64"
              }
            ],
            "modelRef": "#/components/schemas/ConsentGetResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "undefined",
            "example": "{\"title\":\"Bad Request\",\"status\":400,\"timestamp\":\"2018-09-10T21:07:10-05:00\",\"detail\":{\"invalids\":[{\"field\":\"delimiter\",\"reason\":\"Unrecognized delimiter, valid options are comma, tab or pipe\"}]}}",
            "description": "",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "Forbidden",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "undefined",
            "example": "{  \"message\": \"Forbidden\"}",
            "description": "",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "404",
        "description": "Not Found",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "undefined",
            "example": "{\"title\":\"Bad Request\",\"status\":404,\"timestamp\":\"2018-09-10T21:07:10-05:00\",\"detail\":{\"message\":\"Not found description\"}}",
            "description": "",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "Q5IMq-wXYtgZramrBaCsr",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url 'https://api.us1.odp.optimizely.com/v3/consent/{identifier_field_name}?id=example%40example.com' \\\n     --header 'accept: application/json'"
        },
        {
          "id": "ltkzRn5BwokZY-Xqg_qqr",
          "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.us1.odp.optimizely.com/v3/consent/{identifier_field_name}?id=example@example.com\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "zUV4bWDDyNPCo6V914d85",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.us1.odp.optimizely.com/v3/consent/{identifier_field_name}?id=example@example.com\")\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": "vGTtmw37R84xHIIa_CQ2j",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.us1.odp.optimizely.com/v3/consent/{identifier_field_name}?id=example@example.com\"\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": "Q5IMq-wXYtgZramrBaCsr"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Consent information found\n{\n  \"identifier_field_name\": \"email\",\n  \"identifier_value\": \"example@example.com\",\n  \"consent\": true,\n  \"consent_update_reason\": \"\",\n  \"consent_update_ts\": \"\",\n  \"zaius_id\": \"\"\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request\n\"{\\\"title\\\":\\\"Bad Request\\\",\\\"status\\\":400,\\\"timestamp\\\":\\\"2018-09-10T21:07:10-05:00\\\",\\\"detail\\\":{\\\"invalids\\\":[{\\\"field\\\":\\\"delimiter\\\",\\\"reason\\\":\\\"Unrecognized delimiter, valid options are comma, tab or pipe\\\"}]}}\""
        },
        {
          "id": "response-2-403",
          "language": "403",
          "code": "// Forbidden\n\"{  \\\"message\\\": \\\"Forbidden\\\"}\""
        },
        {
          "id": "response-3-404",
          "language": "404",
          "code": "// Not Found\n\"{\\\"title\\\":\\\"Bad Request\\\",\\\"status\\\":404,\\\"timestamp\\\":\\\"2018-09-10T21:07:10-05:00\\\",\\\"detail\\\":{\\\"message\\\":\\\"Not found description\\\"}}\""
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}