---
title: "Show a publication on this hostname"
method: PUT
path: "/api/domains/{hostname}/attachment"
tags: ["Custom Domains"]
---

# Show a publication on this hostname

`PUT /api/domains/{hostname}/attachment`

## Request

- Base URL: `https://brewpage.app`
- URL: `https://brewpage.app/api/domains/{hostname}/attachment`
- Auth: API key in header `X-Owner-Token`

Shows an HTML page or site of yours on this hostname; body `{type, ns, id}`. The hostname is added to the profile when it is not there yet (201) or moved from its current publication (200). The publication must be in this profile (its owner token added to the profile). Same rules and next steps as PUT /api/publications/{type}/{ns}/{id}/domain.

## Path parameters

- `hostname` string, required

## Headers

- `X-Owner-Token` unknown, required

## Request body

- AttachDomainRequest: Publication to show on a profile hostname.
  - `type` 'html' | 'site', required: html or site
  - `ns` string, required: Namespace of the publication
  - `id` string, required: Id of the publication

## Response `200`

Moved here or already shown; same body as 201

- DomainItem: A custom domain of a profile and what to do next (`nextStep`): create the `records[]` in DNS, call the check route once, then read the domain until `status` is `active`.
  - `hostname` string, required: Hostname in ASCII (A-label), lowercase, e.g. www.example.com
  - `displayHostname` string, required: Unicode form for display
  - `apex` boolean, required: true when the hostname is the registered domain itself (example.com): routing uses an A or ALIAS record instead of CNAME
  - `status` 'pending_dns' | 'verifying' | 'active' | 'lost', required: pending_dns (create the records), verifying (DNS found, certificate being issued), active (serving) or lost (records broke after activation; still served until graceEndsAt, then disconnected: restore the records and check again)
  - `suspended` boolean, required: true when BrewPage suspended this domain: it does not serve and cannot be checked, moved or removed; write to info@brewpage.app
  - `problem` string: What blocks progress now, absent when nothing does: DOMAIN_NOT_REGISTERED (the domain does not exist yet; register it with a domain registrar, then create the records), TXT_MISSING, TXT_WRONG, ROUTING_MISSING, ROUTING_WRONG, FOREIGN_AAAA, CAA_BLOCKS (fix the matching row of records[]), DOMAIN_TAKEN (this hostname is not available: use another hostname or write to info@brewpage.app), QUEUE_FULL (DNS is right, verification waits its turn; retried automatically), CERT_PENDING (certificate on its way), CERT_FAILED (certificate could not be issued; check DNS, then check again), DNS_LOST (records stayed broken past graceEndsAt, so the domain was disconnected; restore them and check again), CHECK_PAUSED (older rows only; the next automatic check replaces it), RESOLVER_UNAVAILABLE (DNS did not answer; retried), PUBLICATION_GONE (attach another publication), NOT_ELIGIBLE_<reason> (the publication cannot take a custom domain; reasons as ErrorResponse.reason)
  - `nextStep` string, required: What to do next, in plain English (one to three sentences) with the exact routes of this domain, e.g. create the records[] at the DNS provider, then POST the check route once and GET this domain until `status` is `active`. Follow it and relay it to the user; always present
  - `records` DomainRecord[], required: DNS records to create, in order: TXT for ownership, then CNAME (subdomain) or A plus optional ALIAS (apex)
    - `type` 'TXT' | 'CNAME' | 'A' | 'ALIAS' | 'AAAA' | 'CAA', required: TXT (ownership), CNAME, A or ALIAS (routing), AAAA (delete it) or CAA (add it where your existing CAA records are)
    - `name` string, required: Full DNS name, e.g. _brewpage.www.example.com
    - `host` string, required: Name as DNS panels ask for it, relative to the registered domain: www, _brewpage.www or @
    - `value` string: Value to publish (AAAA: the record found, to delete). The apex A value is absent for a few minutes while BrewPage resolves its address: create the optional ALIAS row instead, or read the domain again later
    - `state` 'ok' | 'missing' | 'wrong' | 'foreign' | 'blocked' | 'unknown', required: From the last check: ok, missing, wrong (another value found), foreign (AAAA record pointing elsewhere: delete it), blocked (CAA record forbids the certificate: add this one) or unknown (not checked yet, or DNS did not answer)
    - `optional` boolean: true on the ALIAS (flattened CNAME) alternative to the apex A record: create one of the two
  - `provider` string: DNS provider once known: cloudflare, godaddy, namecheap, porkbun, squarespace, ionos, hostinger, ovh, route53, dnspod, other
  - `attachedTo` DomainAttachedTo: Publication a custom domain shows.
    - `type` string, required: html or site
    - `namespace` string, required
    - `id` string, required
    - `link` string, required: BrewPage link of the publication; keeps working next to the custom domain
    - `title` string
  - `serving` boolean, required: true when visitors see the publication on this hostname now
  - `url` string: https://<hostname>/ while serving
  - `checkedAt` string, date-time: Last DNS check
  - `nextCheckAt` string, date-time: Next automatic DNS check
  - `graceEndsAt` string, date-time: While lost: served until this time, then disconnected unless the records are restored
  - `createdAt` string, date-time, required
  - `deliveryModeChanged` boolean: Set answers only: true when the publication moved from its BrewPage path address to its own subdomain (required for a custom domain)
  - `detached` string: Set answers only: hostname that was on this publication before; it stays in the profile, unattached

## Other responses

- `201`: Added to the profile and shown on this publication
- `400`: Missing type, ns or id; INVALID_HOSTNAME: not a valid hostname; DOMAIN_NOT_ALLOWED: this hostname cannot be used; DOMAIN_NOT_REGISTERED: the domain is not registered yet; register it with a domain registrar first
- `403`: Missing token, or ADMIN_TOKEN_REQUIRED: not an admin token of a profile; DOMAIN_NEEDS_ACCOUNT: the token is in no profile: sign in at https://account.brewpage.app/tokens, press Add existing token and paste it, then repeat; OWNER_TOKEN_REVOKED or OWNER_TOKEN_EXPIRED; OWNER_AUTHORIZATION_FAILED: wrong token; OWNER_TOKEN_REVOKED or OWNER_TOKEN_EXPIRED; ACCOUNT_RESTRICTED or ACCOUNT_BLOCKED: this profile cannot add domains now
- `404`: PUBLICATION_UNAVAILABLE: missing or expired publication (outside public also for a wrong token); FEATURE_DISABLED: custom domains are not available right now
- `409`: NOT_ELIGIBLE: the publication cannot take a custom domain (`reason`); DOMAIN_LIMIT: the profile already holds all its custom domains (`limit`, `used`); remove or move one; DOMAIN_SUSPENDED: BrewPage suspended this domain; write to info@brewpage.app
- `429`: Rate limited: wait Retry-After (= retryAfterSeconds)
- `503`: DOMAIN_INTAKE_PAUSED: adding custom domains is paused; try again later; HOSTING_CREATION_PAUSED: address changes are briefly unavailable; retry after Retry-After

## Changes

- **2026-11-21** `19a6c5561e70`: 6 info
  - added the optional property `level` to the response with the `400` status
  - added the optional property `level` to the response with the `403` status
  - added the optional property `level` to the response with the `404` status
  - added the optional property `level` to the response with the `409` status
  - …2 more
- **2026-11-15** `e8871eeaeb55`: 2 info
  - added the required property `nextStep` to the response with the `200` status
  - added the required property `nextStep` to the response with the `201` status
- **2026-11-13** `75a4ce75d376`: 4 breaking, 24 warning, 2 info
  - request property `type` was restricted to a list of enum values
  - the request property `id` became not nullable
  - the request property `ns` became not nullable
  - the request property `type` became not nullable
  - …26 more
- **2026-11-11** `957711dab4b5`: 12 info
  - added the optional property `challengeUrl` to the response with the `400` status
  - added the optional property `challengeUrl` to the response with the `403` status
  - added the optional property `challengeUrl` to the response with the `404` status
  - added the optional property `challengeUrl` to the response with the `409` status
  - …8 more
- **2026-11-10** `e34e8877bb89`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/brewpage/apis/brewpage-api/changes/api/domains/:hostname/attachment/put.md)

---

[API](https://skmtc.dev/brewpage/apis/brewpage-api.md) - [All operations](https://skmtc.dev/brewpage/apis/brewpage-api/llms.txt) - [OpenAPI document](https://skmtc.dev/brewpage/apis/brewpage-api/revisions/78d2720a18a9?raw)
