Domains

Add a custom domain

Adds a custom domain to the Pen's deployment. The answer lists every custom domain, with the DNS records to create so the new one verifies.

post/v2/pens/{id}/domains

Request

  • Base URL
    https://api.codepen.io
  • Auth
    • HTTP bearer
    • or API key in header X-API-Key

Request body

hoststring required

Example request

{
  "host": "www.example.com"
}

Response

The deployment's custom domains.

a_recordstring required

What the last lookup found for the A record, such as None, Valid, Legacy or Invalid.

cname_recordstring required

What the last lookup found for the CNAME record, such as None, Valid, Legacy or Invalid.

created_atstring date-time required
hoststring required
idstring required
status'Pending' | 'Verified' | 'Misconfigured' required

Example response

[
  {
    "dns": [
      {
        "name": "www",
        "type": "CNAME",
        "value": "custom.codepen.app"
      }
    ]
  }
]

Changes

No recorded changes to this operation across all 1 revision of this API.