# Attach Custom Domain to Hosted Site

> Attach Custom Domain to Hosted Site is a paid API for AI agents from site.withzero.ai, paid per call via MPP, metered — billed by usage, status unknown (last checked 2026-10-02).

Attaches a pre-purchased custom domain to a hosted site slug, registering it as a Cloudflare Worker Custom Domain with automatic SSL provisioning.

## Facts

- Endpoint: POST https://site.withzero.ai/sites/:slug/domains?utm_source=zero.xyz
- Price: metered — billed by usage
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-02
- Activations on Zero: 0
- Provider: site.withzero.ai
- Website: https://site.withzero.ai
- Canonical page: https://www.zero.xyz/c/site-withzero-ai-attach-custom-domain-to-hosted-site-6b0df014
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_zSOlX3xg5BG5ulLkcEKHZ

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability site-withzero-ai-attach-custom-domain-to-hosted-site-6b0df014 -d '<json body>'
```

Example prompt: Attach my custom domain myblog.com to my site slug 'my-portfolio-site' on withzero — I already bought the domain through their domain-buy service.

## When to prefer this

Use this endpoint when you have already purchased a domain via the domain-buy service and want to map it to a specific hosted site slug on withzero.ai, getting automatic SSL/HTTPS via Cloudflare. Prefer this over manual DNS configuration when hosting on withzero's platform.

## Known failure modes

- Domain not purchased via domain-buy service — returns error if caller doesn't own the domain
- Caller does not own the target slug — returns authorization error
- Domain already attached to another slug — returns conflict error
- Invalid domain format — returns 400 if domain doesn't match required pattern
- Cloudflare registration failure — upstream error from Cloudflare hostname registration API
- Slug does not exist — returns 404 not found

## How this service works

Attach a custom domain (bought via domain-buy) to this slug. Caller must own both. Calls Cloudflare to register the hostname as a Worker Custom Domain on this worker (SSL auto-provisioned).

## Output

A confirmation object indicating the custom domain has been attached to the slug and registered as a Cloudflare Worker Custom Domain, with SSL automatically provisioned for HTTPS access.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "domain"
 ],
 "properties": {
  "domain": {
   "type": "string",
   "pattern": "^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\\.[a-zA-Z]{2,})+$",
   "maxLength": 253,
   "minLength": 3
  }
 },
 "additionalProperties": false
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/site-withzero-ai-attach-custom-domain-to-hosted-site-6b0df014/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from site.withzero.ai](https://www.zero.xyz/host/site.withzero.ai/llms.txt)
