# Read a preview.

> `state` is `up` only after a real readiness check through its URL.
> https://koi.dog/docs/api/previews/get-preview/

`GET /api/v1/previews/{id}` · Scope: `read`

`cleanup` says whether the process and the URL were seen gone. No query parameters.

## Path parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The preview's id. |

## Response.

200 OK: a `Preview`. The example has placeholder values.

## Request.

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

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

```python
import os

import requests

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

## Response example.

```json
{
  "id": "string",
  "crewId": "string",
  "projectId": "string",
  "branch": "string",
  "sha": "string",
  "where": "boat",
  "access": "private",
  "state": "pending_approval",
  "stateReason": "string",
  "stage": "string",
  "url": "string",
  "origin": "string",
  "vmId": "string",
  "port": 0,
  …
}
```
