> ## Documentation Index
> Fetch the complete documentation index at: https://docs.promptingcompany.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Domains

> Connect a subdomain or a subpath that serves your TPC content, and check its status from the TPC CLI.

# Domains

Your published content is served on a domain you connect. Use `tpc domains` to add that domain, see what to change at your DNS provider or reverse proxy, and check when it works. Pass `--scope <org-slug>/<product-slug>` to select the product.

There are two kinds of domain:

* A **subdomain**, such as `docs.acme.com`, points at TPC with a DNS `CNAME` record.
* A **subpath**, such as `acme.com/aeo`, is mounted by your own reverse proxy. It needs no DNS change.

For the same steps in the web app, see [Set up custom domain](https://docs.promptingcompany.com/guides/create-content.md#set-up-custom-domain).

## List domains

```bash theme={null}
tpc domains list --scope acme/acme
tpc domains list --scope acme/acme --format json
```

Text output shows each domain, whether it is a subdomain or a subpath, whether it is active, whether it is the product's default, and its ID.

## Connect a subdomain

```bash theme={null}
tpc domains connect docs.acme.com --scope acme/acme
```

The command adds the domain and prints the DNS records to add, with the purpose of each:

```text theme={null}
✓ Added docs.acme.com to product acme

Domain:  docs.acme.com (subdomain)
Status:  pending
Waiting for DNS. Add the records below at the DNS provider for docs.acme.com, then check again. ...

DNS records:
TYPE   NAME                               VALUE           PURPOSE
CNAME  docs.acme.com                      web.tpcdns.com  Points the subdomain at TPC. Keep it DNS-only: ...
TXT    _cf-custom-hostname.docs.acme.com  ...             Proves you own the hostname.

Check again: tpc domains status docs.acme.com --scope acme/acme --wait
```

Keep the `CNAME` record DNS-only: turn off any CDN proxying on it.

## Connect a subpath

```bash theme={null}
tpc domains connect acme.com --path /aeo --scope acme/acme
tpc domains connect acme.com --path /aeo --stack vercel --scope acme/acme
```

The output lists the public URL, the upstream origin to forward requests to, the steps, and a config snippet for your stack. TPC may store the host your site redirects to, such as `www.acme.com` instead of `acme.com`.

| Flag | Description |
| - | - |
| `--path` | The subpath, such as `/aeo`. It starts with `/`, does not end with `/`, and cannot be `/`. Omit it for a subdomain. You can also write the path in the domain: `tpc domains connect acme.com/aeo`. |
| `--stack` | The stack that serves your site, used for the snippet: `nextjs`, `sveltekit`, `vercel`, `netlify`, `cloudflare`, `nginx`, `caddy`, or `cloudfront`. Defaults to `nginx`. |

Running `connect` again for a domain the product already has prints its instructions and does not add it twice.

## Check the status

```bash theme={null}
tpc domains status docs.acme.com --scope acme/acme
tpc domains status acme.com --path /aeo --scope acme/acme
tpc domains status docs.acme.com --wait --timeout 30m --scope acme/acme --format json
```

The status is `connected`, `pending`, or `inactive`, followed by a message that says what is still missing. A subpath can also show a `reason`, such as `not_pointed` or `bot_protection`.

`--wait` checks every 10 seconds until the domain is connected. It works without a terminal. If `--timeout` (default `10m`) passes first, the command prints the last status and exits with `1`. DNS changes can take from a few minutes to an hour. For a subpath, pass the same `--stack` you used with `connect` to get the same snippet.

## JSON output

With `--format json`, `connect` and `status` print the connection object:

| Field | Description |
| - | - |
| `id`, `domain`, `pathPrefix` | The domain row. `pathPrefix` is `null` for a subdomain. |
| `kind` | `subdomain` or `subpath`. |
| `publicUrl` | Where the content is served once connected. |
| `status`, `connected` | `connected`, `pending`, or `inactive`, and whether it is connected. |
| `message`, `reason` | What is still missing. `reason` is `null` when there is none. |
| `dns` | For a subdomain: `records` (each with `type`, `name`, `value`, and `purpose`), `hostnameStatus`, and `certificateStatus`. `null` for a subpath. |
| `proxy` | For a subpath: `origin`, `mountPath`, `technology`, `technologies`, `snippet`, and `instructions`. `null` for a subdomain. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.