---
title: Get Holdout results as a CSV
slug: web-experimentation/api/get-holdout-results-as-a-csv
docTags: 
createdAt: 2026-10-02T13:15:18.296Z
---

{
  "id": "zP4LBnbqFEuzyGPrLAvJH",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://api.optimizely.com/v2/export/projects/{project_id}/holdouts/{holdout_id}/results/csv",
    "servers": [
      {
        "url": "https://api.optimizely.com/v2/export/projects/{project_id}/holdouts/{holdout_id}/results/csv"
      }
    ],
    "name": "Get Holdout results as a CSV",
    "description": "Get results for a Holdout as a CSV",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "project_id",
          "type": "integer<int64>",
          "description": "The ID for the Project where the Holdout is located",
          "format": "int64"
        },
        {
          "kind": "required",
          "name": "holdout_id",
          "type": "integer<int64>",
          "description": "The ID for the Holdout you want results for",
          "format": "int64"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "text/csv"
          ],
          "default": "text/csv"
        }
      ],
      "queryParameters": [
        {
          "kind": "optional",
          "name": "browser",
          "type": "string",
          "description": "<p>Browser to segment results by. This parameter must not be sent with any other segmentation parameters, i.e. any parameters in [device, source, attribute_id, attribute_value].</p>",
          "enum": [
            "firefox",
            "chrome",
            "internet_explorer",
            "opera",
            "safari"
          ]
        },
        {
          "kind": "optional",
          "name": "device",
          "type": "string",
          "description": "<p>Device to segment results by. This parameter must not be sent with any other segmentation parameters, i.e. any parameters in [browser, source, attribute_id, attribute_value].</p>",
          "enum": [
            "desktop",
            "ipad",
            "iphone",
            "mobile",
            "tablet"
          ]
        },
        {
          "kind": "optional",
          "name": "source",
          "type": "string",
          "description": "<p>Source to segment results by. This parameter must not be sent with any other segmentation parameters, i.e. any parameters in [browser, device, attribute_id, attribute_value].\nCampaign: Contains users that arrive on a URL containing a 'utm_campaign,' 'utm_source,' 'gclid,' or 'otm_source' query parameter. If the URL contains one of these parameters, the visitor will count as \"Campaign\" traffic even if they arrived through search.\nDirect:  Includes all users who do not have any external referrer in their URL.\nReferral: Includes all users that come from another URL that doesn't count as Campaign.</p>",
          "enum": [
            "campaign",
            "direct",
            "referral",
            "search"
          ]
        },
        {
          "kind": "optional",
          "name": "attribute_id",
          "type": "integer<int64>",
          "description": "<p>ID of the attribute to segment results by. Requests containing attribute_id will return the results for all visitors that have attribute_value for the attribute represented by attribute_id. If present, the attribute_value parameter must also be present, and it cannot be sent with any other segmentation parameters, i.e. any parameters in [browser, device, source].</p>",
          "format": "int64"
        },
        {
          "kind": "optional",
          "name": "attribute_value",
          "type": "string",
          "description": "<p>UTF-8 encoded value correlating to attribute_id. If present, the attribute_id parameter must also be present. This parameter also requires attribute_id to be set, and cannot be sent with any other segmentation parameters, i.e. any parameters in [browser, device, source].</p>"
        },
        {
          "kind": "optional",
          "name": "segment_conditions",
          "type": "string",
          "description": "<p>(BETA) A string representation of a JSON Segment Conditions Expression. This parameter can be either URL-escaped stringified JSON or Base64-encoded stringified JSON using URL-safe alphabet (preferred).\nSegment Conditions Expressions consist of Logical Expressions and Match Expressions.\nLogical Expressions are represented as an array of the format [, ...], where the supported operators are \"and\", \"or\" and \"not\".\nMatch Expressions are represented as an object of the format {\"attribute_id\": &#x3C;attribute_id>, \"attribute_value\": [, \"match_type\": &#x3C;match_type>]}, where supported values for match_type are \"exact\" match type will match only an exact string match between \"value\" string and the attribute value. \"substring\" match type will match if \"value\" is a substring of the attribute value. \"prefix\" match type will match if \"value\" is a string prefix of the attribute value. \"regex\" match type will match if \"value\" is a regular expression match for the attribute value. The default match_type is \"exact\".</p>"
        }
      ],
      "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 Holdout results in CSV format",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "202",
        "description": "The results request has been received but has not yet finished processing. Wait a bit and try again.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "204",
        "description": "There are no results data for this Holdout yet.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "default",
        "description": "Unexpected error",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "3LdOOFFwUBNQLB_EfSV6U",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url https://api.optimizely.com/v2/export/projects/{project_id}/holdouts/{holdout_id}/results/csv \\\n     --header 'accept: text/csv'"
        },
        {
          "id": "N47gdO8QIWj7a_b7g5VEO",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"text/csv\");\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/projects/{project_id}/holdouts/{holdout_id}/results/csv\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "ag8vg9iW0GTBDP_wPZQ17",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.optimizely.com/v2/export/projects/{project_id}/holdouts/{holdout_id}/results/csv\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"text/csv\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "tEP7SvIr9nnYUXxmNvdAB",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.optimizely.com/v2/export/projects/{project_id}/holdouts/{holdout_id}/results/csv\"\n\npayload = {}\nheaders = {\n   'accept': 'text/csv',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "3LdOOFFwUBNQLB_EfSV6U"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Return Holdout results in CSV format\n"
        },
        {
          "id": "response-1-202",
          "language": "202",
          "code": "// The results request has been received but has not yet finished processing. Wait a bit and try again.\n"
        },
        {
          "id": "response-2-204",
          "language": "204",
          "code": "// There are no results data for this Holdout yet.\n"
        },
        {
          "id": "response-3-default",
          "language": "default",
          "code": "// Unexpected error\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}