---
title: Create a Subject Access Request
slug: feature-experimentation/api/create-a-subject-access-request
docTags: 
createdAt: 2026-10-01T19:58:02.336Z
---

{
  "id": "q16DiB-rKqUkVtzKAFUgI",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.optimizely.com/v2/subject-access-requests",
    "servers": [
      {
        "url": "https://api.optimizely.com/v2/subject-access-requests"
      }
    ],
    "name": "Create a Subject Access Request",
    "description": "Create a Subject Access Request",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "A JSON string containing the fields needed to create a subject access request.",
          "customType": "SubjectAccessRequest",
          "schema": [
            {
              "name": "data_type",
              "kind": "required",
              "type": "string<user | visitor>",
              "description": "",
              "example": "user",
              "enum": [
                "user",
                "visitor"
              ]
            },
            {
              "name": "identifier",
              "kind": "required",
              "type": "string",
              "description": "<p>The identifier value that you would like us to use when searching. If user was selected in the previous step, the identifier will be the email address for the User.</p>",
              "example": "test@optimizely.com",
              "maxLength": 355
            },
            {
              "name": "identifier_type",
              "kind": "required",
              "type": "string<email | optimizely_end_user_id | dcp_id | fullstack_id | other>",
              "description": "",
              "example": "email",
              "enum": [
                "email",
                "optimizely_end_user_id",
                "dcp_id",
                "fullstack_id",
                "other"
              ]
            },
            {
              "name": "request_type",
              "kind": "required",
              "type": "string<access | delete>",
              "description": "<p>delete - Removes all data within an account that is associated to the identifier defined in the identifier field.\n\n\naccess - Finds all data stored in Optimizely systems associated to the identifier defined in the identifier field and exports it to an AWS S3 bucket for you to access.</p>",
              "example": "access",
              "enum": [
                "access",
                "delete"
              ]
            }
          ],
          "modelRef": "#/components/schemas/SubjectAccessRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "apiKey",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        },
        {
          "id": "OAuth2",
          "name": "OAuth2",
          "kind": "optional",
          "type": "oauth2",
          "description": "<p>Write applications that authenticate with the REST API via OAuth 2.0. Or, to authenticate using a personal token, see <a href=\"https://docs.developers.optimizely.com/web/docs/personal-token\" target=\"_blank\">https://docs.developers.optimizely.com/web/docs/personal-token</a></p>",
          "oauth2Flows": {
            "authorizationCode": {
              "authorizationUrl": "https://app.optimizely.com/oauth2/authorize",
              "tokenUrl": "https://app.optimizely.com/oauth2/token",
              "scopes": {
                "all": "Full access to your account"
              }
            }
          },
          "requiredScopes": [
            "read",
            "write"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Return the created SubjectAccessRequest",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "SubjectAccessRequest",
            "schema": [
              {
                "name": "account_id",
                "kind": "optional",
                "type": "integer<int64>",
                "readOnly": true,
                "description": "The Account ID for the account the Subject Access Request will be executed.",
                "example": 12345,
                "format": "int64"
              },
              {
                "name": "completed_at_time",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "nullable": true,
                "description": "The time when the request was completed.",
                "format": "date-time"
              },
              {
                "name": "data_type",
                "kind": "required",
                "type": "string<user | visitor>",
                "description": "",
                "example": "user",
                "enum": [
                  "user",
                  "visitor"
                ]
              },
              {
                "name": "expired_at_time",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "<p>Time when the url expires (7 days from the completed_at_time)</p>",
                "format": "date-time"
              },
              {
                "name": "export_location",
                "kind": "optional",
                "type": "string",
                "readOnly": true,
                "description": "The location to which the data will be exported. The data will be made accessible in a AWS S3 bucket.",
                "example": "https://s3-us-west-2.amazonaws.com/optimizely-sar-prod/{account-id}-{request_id}.zip"
              },
              {
                "name": "id",
                "kind": "optional",
                "type": "integer<int64>",
                "readOnly": true,
                "description": "The Subject Access Request ID.",
                "example": 12345,
                "format": "int64"
              },
              {
                "name": "identifier",
                "kind": "required",
                "type": "string",
                "description": "<p>The identifier value that you would like us to use when searching. If user was selected in the previous step, the identifier will be the email address for the User.</p>",
                "example": "test@optimizely.com",
                "maxLength": 355
              },
              {
                "name": "identifier_type",
                "kind": "required",
                "type": "string<email | optimizely_end_user_id | dcp_id | fullstack_id | other>",
                "description": "",
                "example": "email",
                "enum": [
                  "email",
                  "optimizely_end_user_id",
                  "dcp_id",
                  "fullstack_id",
                  "other"
                ]
              },
              {
                "name": "processing_started_time",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "nullable": true,
                "description": "The time when the processing of the Subject Access Request started.",
                "format": "date-time"
              },
              {
                "name": "request_type",
                "kind": "required",
                "type": "string<access | delete>",
                "description": "<p>delete - Removes all data within an account that is associated to the identifier defined in the identifier field.\n\n\naccess - Finds all data stored in Optimizely systems associated to the identifier defined in the identifier field and exports it to an AWS S3 bucket for you to access.</p>",
                "example": "access",
                "enum": [
                  "access",
                  "delete"
                ]
              },
              {
                "name": "requested_at_time",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "The time when the Subject Access Request was submitted.",
                "format": "date-time"
              },
              {
                "name": "sla_deadline_time",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "nullable": true,
                "description": "The time by which the Subject Access Request must be completed.",
                "format": "date-time"
              },
              {
                "name": "status",
                "kind": "optional",
                "type": "string<pending | processing | completed | failure>",
                "readOnly": true,
                "description": "The status of the Subject Access Request.",
                "example": "pending",
                "enum": [
                  "pending",
                  "processing",
                  "completed",
                  "failure"
                ]
              }
            ],
            "modelRef": "#/components/schemas/SubjectAccessRequest",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Invalid request body content",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Invalid credentials",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "You do not have permission to create a Subject Access Request for the specified account",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "default",
        "description": "Unexpected error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "BsBm2bPOofzD8R_QBB6AS",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.optimizely.com/v2/subject-access-requests \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data-raw '{\n     \"data_type\": \"user\",\n     \"identifier\": \"test@optimizely.com\",\n     \"identifier_type\": \"email\",\n     \"request_type\": \"access\"\n     }'"
        },
        {
          "id": "FvbK5vAfd5S8ZSiuJ_HJr",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"data_type\": \"user\",\n   \"identifier\": \"test@optimizely.com\",\n   \"identifier_type\": \"email\",\n   \"request_type\": \"access\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.optimizely.com/v2/subject-access-requests\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "XVaXrIkqQb_l2fsiHBHoB",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.optimizely.com/v2/subject-access-requests\")\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\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"data_type\": \"user\",\n   \"identifier\": \"test@optimizely.com\",\n   \"identifier_type\": \"email\",\n   \"request_type\": \"access\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "x8MHq5vjiGrrbCldJ54rH",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.optimizely.com/v2/subject-access-requests\"\n\npayload = json.dumps({\n   \"data_type\": \"user\",\n   \"identifier\": \"test@optimizely.com\",\n   \"identifier_type\": \"email\",\n   \"request_type\": \"access\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "BsBm2bPOofzD8R_QBB6AS"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-201",
          "language": "201",
          "code": "// Return the created SubjectAccessRequest\n{\n  \"account_id\": 12345,\n  \"completed_at_time\": \"\",\n  \"data_type\": \"user\",\n  \"expired_at_time\": \"\",\n  \"export_location\": \"https://s3-us-west-2.amazonaws.com/optimizely-sar-prod/{account-id}-{request_id}.zip\",\n  \"id\": 12345,\n  \"identifier\": \"test@optimizely.com\",\n  \"identifier_type\": \"email\",\n  \"processing_started_time\": \"\",\n  \"request_type\": \"access\",\n  \"requested_at_time\": \"\",\n  \"sla_deadline_time\": \"\",\n  \"status\": \"pending\"\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Invalid request body content\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Invalid credentials\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// You do not have permission to create a Subject Access Request for the specified account\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-4-default",
          "language": "default",
          "code": "// Unexpected error\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-201"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}