---
title: "Export an experiment's assignments as CSV"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.evidential.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Export an experiment's assignments as CSV

Path: Evidential Experiments API › Assignments

`GET /v1/experiments/{experiment_id}/assignments/csv`

URL: `https://api.evidential.dev/v1/experiments/{experiment_id}/assignments/csv`

Returns a CSV stream with a header row.

Output columns:
- `participant_id`
- `cluster_key`, if the experiment design defines a cluster key
- `arm_id`
- `arm_name`
- `created_at`: the time the assignment was created, as a UTC ISO 8601 timestamp
- one column for each strata field defined on the experiment

## Authentication

- `DatasourceApiKey`, apiKey, in header, header `X-API-Key`

## Path parameters

- `experiment_id` (`get_experiment_assignments_as_csv.path.experiment_id`; string, required) — The ID of the experiment to fetch.

## Code samples

### cURL

```bash
curl --request GET \
  --url 'https://api.evidential.dev/v1/experiments/<experiment_id>/assignments/csv' \
  --header 'X-API-Key: <X-API-Key>'
```

### TypeScript

```typescript
const url = 'https://api.evidential.dev/v1/experiments/<experiment_id>/assignments/csv';
const options = {method: 'GET', headers: {'X-API-Key': '<X-API-Key>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.evidential.dev/v1/experiments/<experiment_id>/assignments/csv"

headers = {"X-API-Key": "<X-API-Key>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

Successful Response

#### Example

```text
string
```

#### Body (text/csv)

Type: `string`

### 400

The request is invalid. Check that the request body matches the required structure and that all required fields and headers are present.

#### Example

```text
{}
```

#### Body (text/csv)

### 403

You did not provide a valid API key, or your API key does not have permission for this operation.

Tip: Check that the API key in the `X-API-Key` header has access to the data source or experiment.

#### Example

```text
{}
```

#### Body (text/csv)

### 404

The resource was not found, or you do not have access to it.

Tip: Check that the API key in the `X-API-Key` header has access to the data source or experiment.

#### Example

```text
{}
```

#### Body (text/csv)

### 422

Validation Error

#### Example

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

- `detail` (`get_experiment_assignments_as_csv.response.422.detail`; array of object, optional)
  - `loc` (`get_experiment_assignments_as_csv.response.422.detail.loc`; array\<any of\>, required)
    - any of the following: `string`, `integer`
  - `msg` (`get_experiment_assignments_as_csv.response.422.detail.msg`; string, required)
  - `type` (`get_experiment_assignments_as_csv.response.422.detail.type`; string, required)
  - `input` (`get_experiment_assignments_as_csv.response.422.detail.input`; unknown, optional)
  - `ctx` (`get_experiment_assignments_as_csv.response.422.detail.ctx`; object, optional)


Source: https://docs.evidential.dev/api/assignments/export-csv/index.md
