URL: /code/apps/sites-and-content/publish-site · Id: `page:/code/apps/sites-and-content/publish-site`

# Site.publish

> Puts your Site’s current pages live on its Domain, under your Brand.

POST https://api.sb/&#123;your-domain&#125;/sites/&#123;site&#125;/publish

Puts your [Site](https://startupbuilder.dev/business/nouns/site)’s current [pages](https://startupbuilder.dev/business/nouns/page) live on its [Domain](https://startupbuilder.dev/business/nouns/domain), under your [Brand](https://startupbuilder.dev/business/nouns/brand).

- **Action class:** `publish`
- **Approval:** Publishes on its own
- **Emits:** `Site.published`
- **Price:** Free

```text title="Run it · Ask"
Put the site live with the new pricing page.
```

```ts title="Run it · SDK"
import { $ } from 'startup-builder'

const result = await $.try.Site.publish({ site: 'https://api.sb/leaseline.app/sites/site_Ll1sE4aP7e' })
```

```json title="Run it · Response"
{
  "api": "https://api.sb/leaseline.app",
  "site": {
    "$id": "https://api.sb/leaseline.app/sites/site_Ll1sE4aP7e",
    "$type": "Site",
    "hostname": "leaseline.app",
    "pages": 14
  },
  "action": {
    "operation": "Site.publish",
    "mode": "try",
    "status": "done"
  }
}
```

Its Inputs, Outputs, Effects and guards quote [the hub’s `Site.publish`](https://startupbuilder.dev/business/nouns/site/publish); this page adds what each Venue honors, its limits and a worked call. It is one of the [Verbs](https://startupbuilder.dev/business/nouns/verb) of [Sites and content](/code/apps/sites-and-content#verbs).

## Inputs
| Name | Type | Default | Meaning |
| --- | --- | --- | --- |
| `site` | `Site` | Required | The Site to publish. |

## Outputs
| Field | Type | What `null` means |
| --- | --- | --- |
| `site` | `Site` | Never null: the Site, now live. |

## Effects
**Action class**

`publish`: an approval rule on `publish` can make it wait for your OK

**Modes**

- `try`: Runs every check and returns what would go out, as it would go out; nothing is sent, posted or spent.
- `send`: Returns a pending Action at once; `Site.published` fires when it is done.
- `do`: Waits for the Action to finish and returns the record.

**Idempotency**

Only with a key: the same `Idempotency-Key` and input return the first Action, and the same key with other input returns `409`.

**Saved or shared**

Keeps the previous pages, so a `revert` restores them.

**Emits**

`Site.published` with `{ site }`

**Performed by**

Whichever seat calls it

**Price**

Free on your own account: the platform charges nothing for the call.

**Standing approval**

It goes out on its own, inside the Limits of your standing approval: a [`Mandate`](https://startupbuilder.dev/business/nouns/mandate) you grant once with [`Mandate.authorize`](/code/integrations/calls/authorize). One approval rule makes it wait for your OK.

## On each Venue
It acts on your own records and reaches no Venue, so every account answers the same way.

## What try does
Runs every check the call meets and returns the record as it would be; nothing is stored, sent or posted.

## Refuses when
| Guard | Refuses | Error |
| --- | --- | --- |
| `sibling-link-attribute` | It refuses a page with a followed link to a sibling Domain that no cited fact justifies. | `refused` |

## When it waits
Returns in one response; nothing waits.

## Example
In `send` mode the call returns its pending Action at once, and `Site.published` delivers the result.

**Ask**

```text
Put the site live with the new pricing page.
```

**API**

```bash
curl -X POST "https://api.sb/leaseline.app/sites/site_Ll1sE4aP7e/publish?mode=send" \
  -H "Authorization: Bearer $SB_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

**CLI**

```bash
npx startup-builder do Site.publish --send --data '{}'
```

`--send` returns the pending Action at once.

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "mode": "send",
    "code": "return await $.Site.publish({})"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const result = await $.send.Site.publish({
  site: 'https://api.sb/leaseline.app/sites/site_Ll1sE4aP7e',
})
```


```json title="Response, in send mode"
{
  "mode": "send",
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/action_Sd3kQ9vT2w",
    "operation": "Site.publish",
    "status": "pending",
    "reason": "running"
  }
}
```

To retry, send the same `Idempotency-Key`: the retry returns the first answer for $0. A new key reads again.

## Used by
- **Jobs:** [Get indexed](/capabilities/get-indexed) · [Publish and post](/capabilities/publish-and-post)

## Related
[`Content.draft`](/code/apps/sites-and-content/draft) · [`Page.publish`](/code/apps/sites-and-content/publish-page) · [`Content.publish`](/code/apps/sites-and-content/publish-content) · [`Page.create`](/code/apps/sites-and-content/create-page) · [`Page.update`](/code/apps/sites-and-content/update-page) · [`Content.create`](/code/apps/sites-and-content/create-content) · [`Content.update`](/code/apps/sites-and-content/update-content) · [`Domain.connect`](/code/apps/sites-and-content/connect)