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

# Domain.connect

> Attaches a domain you already hold and verifies you own it through DNS.

POST https://api.sb/&#123;your-domain&#125;/domains/connect

Attaches a domain you already hold and verifies you own it through DNS.

- **Action class:** None
- **Approval:** Runs on its own
- **Emits:** `Domain.connected`
- **Venues:** Bing, Google Search Console
- **Price:** Free

```text title="Run it · Ask"
Connect tryleaseline.app, which I bought last week.
```

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

const result = await $.try.Domain.connect({ hostname: 'tryleaseline.app', startup: 'https://api.sb/leaseline.app/startups/startup_Leaseline' })
```

```json title="Run it · Response"
{
  "api": "https://api.sb/leaseline.app",
  "domain": {
    "$id": "https://api.sb/leaseline.app/domains/domain_Tl5rY2aP8p",
    "$type": "Domain",
    "hostname": "tryleaseline.app",
    "status": "verifying"
  },
  "action": {
    "operation": "Domain.connect",
    "mode": "try",
    "status": "done"
  }
}
```

Its Inputs, Outputs, Effects and guards quote [the hub’s `Domain.connect`](https://startupbuilder.dev/business/nouns/domain/connect); 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 |
| --- | --- | --- | --- |
| `hostname` | `string` | Required | The hostname to attach. |
| `startup` | `Startup` | Required | The startup it serves. |
| `tenant` | `Tenant` | None. | The Tenant it serves, when a customer connects its own name. Optional. |

## Outputs
| Field | Type | What `null` means |
| --- | --- | --- |
| `domain` | `Domain` | Never null: the connected Domain. |

## Effects
**Action class**

None: no approval rule names it, so it runs within its seat’s Permissions and Limits

**Modes**

- `try`: Runs every check and returns the record as it would be; nothing is stored.
- `send`: Returns a pending Action at once; `Domain.connected` 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**

Issues a certificate once the DNS record verifies. Asks for a TXT ownership proof and a CNAME that delegates certificate validation; refuses to reach `live` without the CNAME. Refuses a wildcard name for a Tenant, and past the Tenant’s name count follows its Entitlement’s `atBound`. Registers the Domain with Stripe as a payment method domain on the startup’s account.

**Emits**

`Domain.connected` with `{ domain }`

**Performed by**

Whichever seat calls it

**Price**

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

## On each Venue
| Venue | Formats |
| --- | --- |
| [Bing](/code/integrations/bing-webmaster#limits) | Responsive search ad |
| [Google Search Console](/code/integrations/google-search-console#limits) | None. |

Each Venue’s caps, review and rate limits are on its integration page, linked from its row. A field marked Not sent is one that Venue has no place for; the call never fails on it.

## What try does
| Account | What try does |
| --- | --- |
| [Bing Webmaster](/code/integrations/bing-webmaster#try) | Returns the URLs IndexNow would receive and the key file it would check; nothing is pushed. |
| [Google Search Console](/code/integrations/google-search-console#try) | Reads run for real, because a read changes nothing in Search Console; `try` stores no rows and submits no sitemap. |

## Refuses when
The hub sets no guard of its own on this call: it refuses only on the shared checks every write meets (a missing record, a Permission the seat lacks).

Through a connected account it can also meet [the shared account refusals](/code/refusals#accounts).

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

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

**Ask**

```text
Connect tryleaseline.app, which I bought last week.
```

**API**

```bash
curl -X POST "https://api.sb/leaseline.app/domains/connect?mode=send" \
  -H "Authorization: Bearer $SB_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "hostname": "tryleaseline.app",
  "startup": "https://api.sb/leaseline.app/startups/startup_Leaseline"
}'
```

**CLI**

```bash
npx startup-builder do Domain.connect --send --data '{
  "hostname": "tryleaseline.app",
  "startup": "https://api.sb/leaseline.app/startups/startup_Leaseline"
}'
```

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

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "mode": "send",
    "code": "return await $.Domain.connect({ hostname: 'tryleaseline.app', startup: 'https://api.sb/leaseline.app/startups/startup_Leaseline' })"
  }
}
```

**SDK**

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

const result = await $.send.Domain.connect({
  hostname: 'tryleaseline.app',
  startup: 'https://api.sb/leaseline.app/startups/startup_Leaseline',
})
```


```json title="Response, in send mode"
{
  "mode": "send",
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/action_Sd3kQ9vT2w",
    "operation": "Domain.connect",
    "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
- **Workflows:** [Index the site](/capabilities/get-indexed/index-the-site)
- **Jobs:** [Get indexed](/capabilities/get-indexed)
- **Integrations:** [Bing Webmaster](/code/integrations/bing-webmaster) · [Google Search Console](/code/integrations/google-search-console)

## 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) · [`Site.publish`](/code/apps/sites-and-content/publish-site) · [`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)