---
title: "Register a domain"
method: POST
path: "/domains/register"
tags: ["Domains"]
---

# Register a domain

`POST /domains/register`

## Request

- Base URL: `https://api.hypamoon.com/api/v1`
- URL: `https://api.hypamoon.com/api/v1/domains/register`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://app.hypamoon.com/oauth/authorize`, token URL `https://api.hypamoon.com/oauth/token`, scopes: `sites:write`)

Registers the domain in the user's name, with DNS and DNSSEC set up here, and whois privacy where the extension allows it. accept_registry_terms must be true: the user explicitly accepted the registry's terms (registry_terms_url from the check). max_price_eur is the total the user confirmed for all years; a higher price is refused. A name with a higher registry price (premium in the check) is bought for 1 year only, with accept_price_eur exactly the price the user confirmed, and only up to a ceiling; if the registry price changed just before the purchase, nothing is bought. Needs an Idempotency-Key; the same key returns the same domain, and a key whose attempt failed is never retried (use a new key). In live mode the price is deducted from the balance; in test mode nothing is bought. Real purchases in live mode are not open yet: until they are, a live key gets service_unavailable, and test mode works as described.

## Headers

- `Idempotency-Key` string, required

## Request body

- DomainRegisterInput
  - `domain` string, required: The domain, like example.com.
  - `years` integer: Registration period in years. Most extensions only allow 1.
  - `accept_registry_terms` boolean, required: Must be true: the user (the registrant) explicitly accepted the terms of the registry at registry_terms_url from check_domain.
  - `max_price_eur` number, required: The highest total the user agreed to pay for all years together, as shown by check_domain. Refused if the price is higher.
  - `accept_price_eur` number: Only for a name with a higher registry price (premium true in check_domain): the price_eur for the first year exactly as check_domain showed it and the user confirmed. Without it, or if the price changed, nothing is bought.
  - `site_id` string, uuid, nullable: Optional. A site of this project to serve on the domain once it is active.

## Response `201`

The registered domain.

## Other responses

- `400`: Bad Request: invalid_json, idempotency_key_missing, idempotency_key_invalid.
- `401`: Unauthorized: unauthorized, missing_api_key, invalid_api_key, api_key_revoked, project_deleted.
- `402`: Payment Required: payment_mandate_missing, billing_blocked, insufficient_balance.
- `403`: Forbidden: project_not_enabled, key_mode_mismatch, missing_scope, verification_required, forbidden, phone_verification_required.
- `404`: Not Found: not_found.
- `409`: Conflict: idempotency_key_reused, idempotency_request_in_progress, conflict.
- `422`: Unprocessable Content: validation_failed, company_details_missing, spend_cap_missing.
- `429`: Too Many Requests: rate_limited.
- `500`: Internal Server Error: internal_error.
- `502`: Bad Gateway: upstream_error.
- `503`: Service Unavailable: service_unavailable.

---

[API](https://skmtc.dev/hypamoon/apis/hypamoon-api.md) · [All operations](https://skmtc.dev/hypamoon/apis/hypamoon-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hypamoon/apis/hypamoon-api/revisions/9f0b90004c06?raw)
