# Cohorts


## Get Cohorts {#get-apiv2analysesreferencecohortsget-cohorts}

`GET /api/v2/analyses/reference/cohorts/get-cohorts`

Completed cohorts owned by your company. Flat list of `{ value, text }` pairs
where `value` is the cohort id, most recent first. Scoped strictly to your
company, so no other company's cohorts are returned. To create a cohort from a
file in your own cloud storage - and to poll one that is still processing - use
the [Cohorts]({{< relref "/api/v2/cohorts" >}}) surface.

**Auth:** bearer token + `Accept: application/json`. Rate limit: read bucket (120
requests/min).

### Query parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `search` | string | No | Optional free-text filter on the cohort name (case-insensitive contains). |

{{< tabs >}}

  {{< tab name="cURL" >}}
  ```bash
  curl "https://console.intuizi.com/api/v2/analyses/reference/cohorts/get-cohorts" \
    -H "Authorization: Bearer <YOUR_TOKEN>" \
    -H "Accept: application/json"
  ```
  {{< /tab >}}

  {{< tab name="Python" >}}
  ```python
  import requests

  res = requests.get(
      "https://console.intuizi.com/api/v2/analyses/reference/cohorts/get-cohorts",
      headers={"Authorization": "Bearer <YOUR_TOKEN>", "Accept": "application/json"},
  )
  cohorts = res.json()["data"]
  ```
  {{< /tab >}}

  {{< tab name="JavaScript" >}}
  ```javascript
  const res = await fetch(
    "https://console.intuizi.com/api/v2/analyses/reference/cohorts/get-cohorts",
    { headers: { Authorization: "Bearer <YOUR_TOKEN>", Accept: "application/json" } }
  );
  const cohorts = (await res.json()).data;
  ```
  {{< /tab >}}

  {{< tab name="PHP" >}}
  ```php
  $res = Http::withToken('<YOUR_TOKEN>')->acceptJson()
      ->get('https://console.intuizi.com/api/v2/analyses/reference/cohorts/get-cohorts');
  $cohorts = $res->json('data');
  ```
  {{< /tab >}}

{{< /tabs >}}

### Response

```json
{
  "status": "success",
  "code": 200,
  "message": "Resources fetched successfully.",
  "data": [
    { "value": 51, "text": "Q1 Loyalty Cohort" }
  ]
}
```

Failed requests use the shared error envelope - see [Errors](/concepts/errors).

Pass a cohort `value` as the `cohort_id` in the
[Audiences]({{< relref "/api/v2/audiences#post-apiv2analysesaudiencescreate" >}}) `Cohorts` dataset
create body.
