# Publish a site

`POST https://api.vidmoat.com/v1/interactive-sites/{id}/publish`

- Scope: `render.write`
- Cost: Free

Make the draft what the site's address shows to anyone, or take the site down.

> **Note.** Public: call it only when the person asked to publish. `publish: false` takes the site down at once and is always allowed.

### Path parameters

- `id` (string, required): The site id.

### Body

- `publish` (boolean, optional, default `true`): `false` takes it down; the published copy is kept.

## Response

Returns `200`.

### Response fields

- `published` (boolean): Whether the site is live now.
- `url` (string): With `publish: true`: the site's address.
- `note` (string): When published but not shown yet (the plan or a restriction), why.

## Errors

Besides the errors any request can get ([authentication](https://developer.vidmoat.com/developer/docs/authentication#when-a-request-is-refused), [rate limits](https://developer.vidmoat.com/developer/docs/rate-limits)):

| Status | Code | When |
| --- | --- | --- |
| 404 | [`not_found`](https://developer.vidmoat.com/developer/docs/errors#not_found) | No such project, or it is not yours. The two are indistinguishable on purpose. |
| 402 | [`plan_required`](https://developer.vidmoat.com/developer/docs/errors#plan_required) | Not on this plan, publishing is paused on the account, or the site was taken offline by Vidmoat. |
| 409 | [`conflict`](https://developer.vidmoat.com/developer/docs/errors#conflict) | A page is empty, or a video or picture is not the account's own published one (`problems` lists them). |

## Request examples

```bash curl
curl -X POST https://api.vidmoat.com/v1/interactive-sites/$SITE_ID/publish \
  -H "Authorization: Bearer $VIDMOAT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"publish":true}'
```

```js Node
const SITE_ID = 'REPLACE_ME';

const res = await fetch(`https://api.vidmoat.com/v1/interactive-sites/${SITE_ID}/publish`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.VIDMOAT_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    publish: true,
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? `HTTP ${res.status}`);
console.log(data);
```

```python Python
import os
import requests

SITE_ID = "REPLACE_ME"

res = requests.post(
    f"https://api.vidmoat.com/v1/interactive-sites/{SITE_ID}/publish",
    headers={"Authorization": f"Bearer {os.environ['VIDMOAT_KEY']}"},
    json={
      "publish": True,
    },
    timeout=60,
)
res.raise_for_status()
print(res.json())
```

## Example response

```json
{
  "published": true,
  "url": "https://river-films.interactive.vidmoat.com"
}
```

---

Source: https://developer.vidmoat.com/developer/docs/api/interactive-sites/publish-interactive-site
Previous: [Edit a site](https://developer.vidmoat.com/developer/docs/api/interactive-sites/edit-interactive-site.md)
Next: [List media](https://developer.vidmoat.com/developer/docs/api/media/list-media.md)
All documentation: https://developer.vidmoat.com/llms-full.txt
