---
title: Get AWS credentials to access experimentation events export data.
slug: feature-experimentation/api/get-aws-credentials-to-access-experimentation-events-export-data
docTags: 
createdAt: 2026-10-01T19:58:02.336Z
---

{
  "id": "_puQxHz-erNlZOiPN-t6O",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://api.optimizely.com/v2/export/credentials",
    "servers": [
      {
        "url": "https://api.optimizely.com/v2/export/credentials"
      }
    ],
    "name": "Get AWS credentials to access experimentation events export data.",
    "description": "Get temporary credentials for experimentation events export data hosted on AWS.",
    "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": [
        {
          "kind": "optional",
          "name": "duration",
          "type": "string",
          "description": "<p>Duration of the AWS credentials token. Use [H,h] for hours or [M,m] for minutes. Minimum is 15m and Maximum is 1h. Usage 1h.</p>",
          "default": "1h"
        }
      ],
      "bodyDataParameters": [],
      "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": "200",
        "description": "Return AWS credentials",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "E3Credentials",
            "schema": [
              {
                "name": "credentials",
                "kind": "optional",
                "type": "object",
                "description": "Credentials item containing information on access key and secrets",
                "modelRef": "#/components/schemas/CredentialsItem",
                "customType": "CredentialsItem",
                "schema": [
                  {
                    "name": "accessKeyId",
                    "kind": "optional",
                    "type": "string",
                    "description": "AWS access key",
                    "example": "ASIA5QMPA3WZQJNOABC"
                  },
                  {
                    "name": "expiration",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "expiration time of the token in epoch time",
                    "example": 1591026407394,
                    "format": "int64"
                  },
                  {
                    "name": "secretAccessKey",
                    "kind": "optional",
                    "type": "string",
                    "description": "AWS secret access key",
                    "example": "1234567qzerHJDWdIDGixoTYfqC1dZp"
                  },
                  {
                    "name": "sessionToken",
                    "kind": "optional",
                    "type": "string",
                    "description": "AWS session token",
                    "example": "FwoGZXIvYXdzEOT//////////wEaDH6J"
                  }
                ]
              },
              {
                "name": "s3Path",
                "kind": "optional",
                "type": "string",
                "description": "s3 path of the enriched events dataset of the account",
                "example": "s3://optimizely-events-data/v1/account_id=123123123"
              }
            ],
            "modelRef": "#/components/schemas/E3Credentials",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "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": "<p>Invalid/Expired credentials</p>",
        "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": "RD726WCPsYSvzacHZDJ0x",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url 'https://api.optimizely.com/v2/export/credentials?duration=1h' \\\n     --header 'accept: application/json'"
        },
        {
          "id": "xrZ-qufIvd0E9QkAjTj24",
          "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.optimizely.com/v2/export/credentials?duration=1h\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "uXdg8f2a6XqdPKbhV1sdY",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.optimizely.com/v2/export/credentials?duration=1h\")\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": "Leh7h8RvG084zzousiNKP",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.optimizely.com/v2/export/credentials?duration=1h\"\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": "RD726WCPsYSvzacHZDJ0x"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Return AWS credentials\n{\n  \"credentials\": {\n    \"accessKeyId\": \"ASIA5QMPA3WZQJNOABC\",\n    \"expiration\": 1591026407394,\n    \"secretAccessKey\": \"1234567qzerHJDWdIDGixoTYfqC1dZp\",\n    \"sessionToken\": \"FwoGZXIvYXdzEOT//////////wEaDH6J\"\n  },\n  \"s3Path\": \"s3://optimizely-events-data/v1/account_id=123123123\"\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Invalid/Expired credentials\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-3-default",
          "language": "default",
          "code": "// Unexpected error\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}