---
title: "Create a new domain"
method: POST
path: "/domains"
tags: ["Domains"]
---

# Create a new domain

`POST /domains`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/domains`
- Auth: HTTP bearer

Creates a new domain and automatically requests a Let's Encrypt challenge.
You can specify the challenge type (HTTP-01 or DNS-01) in the request.

- **HTTP-01**: Validates domain ownership by placing a file on your web server at `/.well-known/acme-challenge/`
- **DNS-01**: Validates domain ownership by adding a TXT record to your DNS (required for wildcard domains)

## Request body

- CreateDomainRequest
  - `challenge_type` string: Challenge type for Let's Encrypt validation. Options: "http-01" (default) or "dns-01"
  - `domain` string, required

## Response `201`

Domain created successfully

- DomainResponse
  - `certificate` string, nullable: The PEM-encoded certificate chain (can be displayed in browser or downloaded)
  - `created_at` string, date-time, required
  - `dns_challenge_token` string, nullable
  - `dns_challenge_value` string, nullable
  - `domain` string, required
  - `expiration_time` string, date-time, nullable
  - `failure_cause` 'dns_lookup' | 'unreachable' | 'upstream_answered' | 'dns_record_mismatch' | 'caa_forbids' | 'rate_limited' | 'ca_transient' | 'config' | 'unknown', nullable: Why the last certificate attempt for a domain failed.
  - `id` integer, required
  - `is_wildcard` boolean, required
  - `last_error` string, nullable
  - `last_error_type` string, nullable
  - `last_renewed` string, date-time, nullable
  - `on_demand_backoff_until` string, date-time, nullable: On-demand TLS negative-cache deadline (ISO 8601, UTC), when this hostname's on-demand HTTP-01 issuance is in backoff after a failure (ADR-018 §4). `None` means no active backoff.
  - `status` string, required
  - `updated_at` string, date-time, required
  - `verification_method` string, required

## Other responses

- `400`: Invalid input
- `401`: Unauthorized
- `500`: Internal server error

## Changes

- **2026-11-26** `e1864d950604`: 5 breaking
  - the `created_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `201`
  - the `expiration_time` response's property type changed from `integer, null` to `string, null`, and format from `int64` to `date-time` for status `201`
  - the `last_renewed` response's property type changed from `integer, null` to `string, null`, and format from `int64` to `date-time` for status `201`
  - the `on_demand_backoff_until` response's property type changed from `integer, null` to `string, null`, and format from `int64` to `date-time` for status `201`
  - …1 more
- **2026-11-20** `e9e929961b13`: 1 info
  - added the optional property `failure_cause` to the response with the `201` status
- **2026-11-20** `f71460bccb8d`: 1 warning
  - removed the optional property `failure_cause` from the response with the `201` status
- **2026-11-19** `3be7f6c6c717`: 1 info
  - added the optional property `failure_cause` to the response with the `201` status
- **2026-07-01** `d83dcb738585`: 1 info
  - added the optional property `on_demand_backoff_until` to the response with the `201` status

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/domains/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
