---
title: "Attach a custom domain"
method: POST
path: "/client/services/{id}/domains"
tags: ["Apps"]
---

# Attach a custom domain

`POST /client/services/{id}/domains`

## Request

- Base URL: `https://api.roar-ai.com`
- URL: `https://api.roar-ai.com/client/services/{id}/domains`
- Auth: HTTP bearer

Adds one of your own hostnames. You point DNS at us; the certificate is issued automatically once it resolves. Every record we ask for is a **CNAME** onto the app’s own Roar address, including at a zone apex — so the domain follows the app if it ever moves and you never have to edit it again. Your DNS provider must be able to put a CNAME at the root of a domain (Cloudflare, DNSimple, Namecheap and bunny.net can); if yours cannot, use `www.` as your address and forward the bare root to it at your registrar.

Body: `{ "domain": "shop.example.com" }`. For a root domain you may also send `preferWww: true`, which makes `www.example.com` the address we present as yours — the other name redirects to it. Sending `www.example.com` itself does the same: it attaches `example.com` with `www` as the address. `id` is a SERVICE id — take it from `services[].id` on `GET /client/apps/{appId}`, not the app id itself. Requires `apps:deploy`.

## Path parameters

- `id` string, uuid, required

## Response `200`

Attached

## Other responses

- `403`: Key lacks apps:deploy
- `404`: No such app service

---

[API](https://skmtc.dev/roar-ai/apis/roar-ai-api.md) · [All operations](https://skmtc.dev/roar-ai/apis/roar-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/roar-ai/apis/roar-ai-api/revisions/37e4d0d5a7fe?raw)
