# List live previews.

> A private preview's `url` carries the host's access token and is given to the dashboard session only: for an API key it is `null`, and `origin` is the address without the token.
> https://koi.dog/docs/api/previews/list-previews/

`GET /api/v1/previews` · Scope: `read`

A public preview has no token, so its `url` is given to both. No path parameters.

## Query parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `crewId` | `string` | no | Only those of this crew. At least 5 characters. |
| `taskId` | `string` | no | Only those of this task. At least 5 characters. |
| `state` | `array` | no | One or more states, comma-separated. Any of `pending_approval`, `starting`, `up`, `stopping`, `stopped`, `failed`. At least 1 item. |
| `limit` | `1–200` | no | How many items to return, 1 to 200. Default 50. |
| `cursor` | `string` | no | The `nextCursor` of the previous page. Only valid with the same filters and order. At least 1 character. |
| `order` | `enum` | no | `desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id. One of `asc`, `desc`. Default `desc`. |

## Response.

One page of a list: `data` holds the items (each a `Preview`); `nextCursor` and `hasMore` lead to the next page. The example has placeholder values.

## Request.

```sh
curl https://app.koi.dog/api/v1/previews \
    -H "Authorization: Bearer $KOIDOG_API_KEY"
```

```js
const res = await fetch("https://app.koi.dog/api/v1/previews", {
  headers: {
    Authorization: `Bearer ${process.env.KOIDOG_API_KEY}`,
  },
});
console.log(await res.json());
```

```python
import os

import requests

r = requests.get(
    "https://app.koi.dog/api/v1/previews",
    headers={
        "Authorization": f"Bearer {os.environ['KOIDOG_API_KEY']}",
    },
)
r.raise_for_status()
print(r.json())
```

## Response example.

```json
{
  "data": [],
  "nextCursor": "string",
  "hasMore": false
}
```
