# Add a custom domain

`POST /service/@id/builder/sites/@site/domains` · TinoPage Builder, service owner's sign-in token

Adds a domain to the website: HTTP 201, the domain is `pending` with the DNS records the customer must set (`dns`). For an apex domain, `dns` also has a CNAME for `www`. An unpublished website answers 409 `SITE_NOT_PUBLISHED`; no domains left: 409 `LIMIT_EXCEEDED` (`details.key: domains_per_site`); domain in use by another website: 409 `DOMAIN_TAKEN`; not a domain: 422 `VALIDATION_FAILED`.

## HTTP request

| Item | Value |
| --- | --- |
| URL | `https://api.tino.vn/service/@id/builder/sites/@site/domains` |
| Method | `POST` |
| Authentication | the TinoPage Builder service owner's sign-in token (`Authorization: Bearer <token>`); the `/v1` gateway does not expose TinoPage Builder yet |
| Content-Type | `application/json` |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | int | yes | TinoPage Builder service ID |
| `site` | path | string | yes | Website ID (UUID, `id` in the website list) |
| `hostname` | body | string | yes | Domain to add (1–253 characters), e.g. `example.vn` or `banhang.example.vn`; TinoPage Builder strips `https://`, paths and upper case |
| `idempotency_key` | body | string | no | 8–64 characters `A-Za-z0-9._:-`: resending the same key and content returns the earlier result instead of running again |

## Example request

```bash
curl -X POST "https://api.tino.vn/service/100003/builder/sites/5b1e2c3d-4f5a-4b6c-8d7e-9f0a1b2c3d4e/domains" \
  -H "Authorization: Bearer $TINO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "hostname": "banhang.example.vn",
  "idempotency_key": "them-ten-mien-0001"
}'
```

`$TINO_TOKEN` is the TinoPage Builder service owner's sign-in token. Path parameters in the example are sample values.

SDK ([SDK & examples](/en/docs/sdk)): no dedicated function yet, use `client.request("POST", "/service/@id/builder/sites/@site/domains")`.

## Example response

```json
{
 "data": {
  "hostname": "banhang.example.vn",
  "status": "pending",
  "ssl_status": "pending",
  "txt_ok": false,
  "cname_ok": false,
  "dns": [
   {
    "type": "CNAME",
    "name": "banhang",
    "value": "dns.tino.page"
   },
   {
    "type": "TXT",
    "name": "_tino-verify.banhang",
    "value": "tino-site-verify=4b6d0e2a7c914f3e8a5b1c2d9e0f7a6b"
   }
  ],
  "error": "",
  "checked_at": "0001-01-01T00:00:00Z",
  "url": "https://banhang.example.vn",
  "owner_verified": false,
  "check_count": 0
 }
}
```

Sample built from the TinoPage Builder API (Tino relays the answer as is inside `data`); values are examples.
