---
title: "Remove a custom domain"
method: DELETE
path: "/v2/pens/{id}/domains/{host}"
tags: ["Domains"]
---

# Remove a custom domain

`DELETE /v2/pens/{id}/domains/{host}`

## Request

- Base URL: `https://api.codepen.io`
- URL: `https://api.codepen.io/v2/pens/{id}/domains/{host}`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Removes a custom domain from the deployment. The answer lists the domains that remain.

## Response `200`

The deployment's custom domains.

- PenDomain[]
  - `a_record` string, required: What the last lookup found for the A record, such as `None`, `Valid`, `Legacy` or `Invalid`.
  - `cname_record` string, required: What the last lookup found for the CNAME record, such as `None`, `Valid`, `Legacy` or `Invalid`.
  - `created_at` string, date-time, required
  - `dns` DnsRecord[], required: The records to create for the host to verify.
    - `name` string, required
    - `type` string, required
    - `value` string, required
  - `host` string, required
  - `id` string, required
  - `status` 'Pending' | 'Verified' | 'Misconfigured', required

## Other responses

- `401`: `UNAUTHENTICATED`: a missing or invalid key, a deleted owner, or a Team key for a Team that is not PRO.
- `403`: `FORBIDDEN`: a write to a Pen made in the classic editor, or a plan limit (non-Public access, a Private Collection, file size, storage, collaborators). The message names the limit and, when a bigger plan would lift it, where to upgrade.
- `404`: `NOT_FOUND`: no such item, or one that is not the key owner's, public or not. A path that is not an endpoint at all answers `404` with the v1 body `{ "error": "not found" }` instead.
- `429`: `RATE_LIMITED`: the owner exceeded the plan's requests in an hour, its reads today, or today's allowance of Pen or Collection creates. No `Retry-After` or rate-limit headers are sent; the body carries `retry_after_seconds`, `limit` and `reset_at`.
- `500`: `INTERNAL`: unexpected, and reported; the message is generic.

---

[API](https://skmtc.dev/codepen/apis/codepen-api.md) - [All operations](https://skmtc.dev/codepen/apis/codepen-api/llms.txt) - [OpenAPI document](https://skmtc.dev/codepen/apis/codepen-api/revisions/108fe91e3ef5?raw)
