# Audiences

> List and read audiences, and build new ones: from a description, as a sub-group, or from your own files.

Source: https://imario.ai/docs/api/reference/audiences

Base URL `https://api.imario.ai/v1`. Each call needs a key that holds the scope shown and acts with at least the role shown ([Authentication](https://imario.ai/docs/api/authentication)). Errors are described in [API errors](https://imario.ai/docs/api/errors).

## List audiences

`GET /v1/audiences`

**Scope** `audiences:read` · **Role** any member

Newest first. `scope`: `workspace` (built in this workspace, including sub-groups and audiences from files), `official` (iMario's catalogue), `market` (the measured population of each market this workspace holds) or `all`. `q` searches names and descriptions. A test key also sees its sandbox audiences.

**Parameters**

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `scope` | query | `string` | No | Default `"all"`. |
| `q` | query | `string` | No | Search names and descriptions. Up to 200 characters. |
| `country` | query | `string` | No | Only this country's audiences. Up to 80 characters. |
| `limit` | query | `integer` | No | How many objects to return (1-100). Default `20`. |
| `cursor` | query | `string` | No | The `next_cursor` of the previous page. Up to 200 characters. |

**Example**

```bash
curl "https://api.imario.ai/v1/audiences?scope=workspace&limit=20" \
  -H "Authorization: Bearer $IMARIO_API_KEY"
```

**Response**

**The audience object**

- `id`, `object: "audience"`, `livemode`, `created_at`, `updated_at`
- `name`, `description`
- `kind`: `workspace` (built here from a description), `uploaded` (from your files or a summary table), `subgroup` (cut out of another audience), `market` (a market's measured population), `official` (iMario's curated catalogue)
- `status`: `building` (its people are being found; a study on it waits for them), `ready`, `failed`, `draft` (an unfinished create session in the web app), `needs_review` (built from files, the defaults could not build it: finish it at `web_url`)
- `size`: how many people it stands for (null while a screened audience is still measuring its pass rate, and for a locked audience); `size_basis`: `population` | `respondents` | `people`; `size_estimated`: true when part of the definition is estimated (screening questions)
- `country`, `markets`, `language`
- `definition`: `{criteria: [plain words], layers: [{kind, label, tier, items}], unsupported: [...]}`
- `source`: `{evidence: "imario" | "yours", label, files: [{name, kind, records}]}` (files only for audiences built from your data)
- `provenance`: `verified` | `anchored` | `calibrated` | `model_est`
- `parent_id`: the audience a sub-group was cut from (when this workspace can see it)
- `usable`: may this workspace run studies on it now; `locked` and `unlock` (`{usd, contact_sales}`) for an official audience not bought yet; `unavailable_reason` (`locked`, `market_not_held`, or `not_ready` while an audience is being built from your files or rebuilt: a study waits for other audiences still `building`, but refuses one of these until it is `ready`)
- `people_count`: people this workspace can seat from it now
- `rebuilt_from`: the audience a rebuild started from
- `failure`: `{code, message}` when `failed` or `needs_review`
- `web_url`: the audience in the web app

Returns a list: `{"object": "list", "data": [...], "has_more": false, "next_cursor": null}`. See [Pagination](https://imario.ai/docs/api/pagination).

## Create an audience from a description

`POST /v1/audiences`

**Scope** `audiences:write` · **Role** editor or above

Reads the brief into a definition, sizes it on the market's measured population and creates the audience; people who need screening questions are found in the background (`status: building`, then the `audience.ready` or `audience.failed` webhook). Free. With `dry_run: true` nothing is created and an `audience_preview` comes back (name, country, size, definition). Needs the editor role.

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `brief` | `string` | Yes | Who the people are, in plain words ("women 25-44 in Germany who buy organic food"). Criteria the census cannot hold become screening questions asked of each person found. Up to 2,000 characters. |
| `country` | `string` | No | The country, when the brief does not name it. Must be one of this workspace's markets. Up to 80 characters. |
| `size` | `integer` | No | How many people to find for an audience built in the background (default 400; a study that needs more asks for them). From 10 to 10,000. |
| `dry_run` | `boolean` | No | Read and size the brief without creating anything. Default `false`. |

**Example**

```bash
curl https://api.imario.ai/v1/audiences \
  -H "Authorization: Bearer $IMARIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "brief": "Women 25-44 in Germany who buy organic food at least once a week",
    "size": 400
  }'
```

**Response**

Returns the object described under [List audiences](https://imario.ai/docs/api/reference/audiences#list-audiences).

## Retrieve an audience

`GET /v1/audiences/{id}`

**Scope** `audiences:read` · **Role** any member

One audience, with `subgroup_options`: the values a sub-group can be cut on (`[{dim, label, options: [{code, label}]}]`, the `filters` of POST /audiences/\{id\}/subgroups).

**Example**

```bash
curl https://api.imario.ai/v1/audiences/AUDIENCE_ID \
  -H "Authorization: Bearer $IMARIO_API_KEY"
```

**Response**

Returns the object described under [List audiences](https://imario.ai/docs/api/reference/audiences#list-audiences).

## Create a sub-group of an audience

`POST /v1/audiences/{id}/subgroups`

**Scope** `audiences:write` · **Role** editor or above

A narrower audience cut out of this one, by `filters` (values from `subgroup_options`; no model call) or by a `brief` (read like POST /audiences, against what the audience already holds: a request for people outside it is refused with `conflicts_with_parent` and the clashes). The sub-group keeps what makes its parent the audience it is and can be cut again. Free; needs the editor role.

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | `string` | No | The sub-group's name. Up to 255 characters. |
| `brief` | `string` | No | What narrows the audience, in plain words ("only those who commute by bike"). A request for people outside the audience is refused (`conflicts_with_parent`). 2 to 2,000 characters. |
| `filters` | `object` | No | Values to keep, `{dim: [code, ...]}` from the audience's `subgroup_options`. |
| `size` | `integer` | No | How many people to find when they are found in the background. From 10 to 10,000. |

**Example**

```bash
curl https://api.imario.ai/v1/audiences/AUDIENCE_ID/subgroups \
  -H "Authorization: Bearer $IMARIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Bike commuters",
    "brief": "Only those who commute by bike"
  }'
```

**Response**

Returns the object described under [List audiences](https://imario.ai/docs/api/reference/audiences#list-audiences).

## Build an audience from your files

`POST /v1/audiences/from-data`

**Scope** `audiences:write` · **Role** editor or above

Every row of a people table becomes a person (their answers and own words stay with them); surveys and transcripts join them. Runs in the background: the files are read (the upload check), then the audience is built with the choices the web app's review page pre-fills. Returns at once with `status: building`; `audience.ready` follows, or `audience.failed` with `status: needs_review` when the files need a person's choice (finish at `web_url`). Free; needs the editor role.

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `file_ids` | `string[]` | Yes | Files uploaded with POST /files (or Library files): tables of people one per row (CSV, Excel, SPSS, Stata...), survey exports, interview transcripts. Up to 20 items. |
| `name` | `string` | No | The audience's name. Up to 255 characters. |
| `country` | `string` | No | The country of rows that carry none (default United States). Up to 80 characters. |

**Example**

```bash
curl https://api.imario.ai/v1/audiences/from-data \
  -H "Authorization: Bearer $IMARIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file_ids": ["FILE_ID"],
    "name": "Survey customers 2026",
    "country": "United States"
  }'
```

**Response**

Returns the object described under [List audiences](https://imario.ai/docs/api/reference/audiences#list-audiences).

## Rebuild an audience from its connected records

`POST /v1/audiences/{id}/rebuild`

**Scope** `audiences:write` · **Role** editor or above

An audience built from your data, rebuilt from its connected customer records (HubSpot, Salesforce) as they are now plus everything else it was built from. The result is a NEW audience (`rebuilt_from` names this one; this one and every study on it stay as they are); later syncs land in the new one. Runs in the background (`status: building`, then `audience.ready`). Free; needs the editor role.

**Example**

```bash
curl -X POST https://api.imario.ai/v1/audiences/AUDIENCE_ID/rebuild \
  -H "Authorization: Bearer $IMARIO_API_KEY"
```

**Response**

Returns the object described under [List audiences](https://imario.ai/docs/api/reference/audiences#list-audiences).
