Getting started
Back to home
Getting started

Add a domain

Add a custom hostname to the project. Hostname validation and the current plan's domain restrictions apply.

POST/api/customer/v1/projects/{projectId}/domains

Path parameters

NameValue
projectIdRequired resource ID from an earlier API response.

Request body

Send JSON with Content-Type: application/json. Nested fields and accepted values are listed in the schema.

FieldTypeRequired
hostnamestringYes
Full request schema
{
  "type": "object",
  "properties": {
    "hostname": {
      "type": "string",
      "minLength": 1
    }
  },
  "required": [
    "hostname"
  ],
  "additionalProperties": false
}

Example request

Set HCODE_BASE_URL and HCODE_API_KEY as shown in Getting started. Replace resource variables with your own IDs.

curl --request POST "$HCODE_BASE_URL/api/customer/v1/projects/${PROJECT_ID}/domains" \
  --header "Authorization: Bearer $HCODE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "hostname": "app.example.com"
}'

Response

The JSON shape is defined in the response schema.

Response schema
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "domainId": {
      "type": "string"
    },
    "dnsStatus": {
      "type": "string"
    },
    "sslStatus": {
      "type": "string"
    },
    "dnsError": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "activationStatus": {
      "type": "string"
    },
    "message": {
      "type": "string"
    },
    "expectedDnsRecord": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "value": {
              "type": "string"
            }
          },
          "required": [
            "type",
            "name",
            "value"
          ],
          "additionalProperties": true
        },
        {
          "type": "null"
        }
      ]
    },
    "ownershipVerification": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "pending",
                "verified",
                "not_required"
              ]
            },
            "record": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "name",
                    "value"
                  ],
                  "additionalProperties": true
                },
                {
                  "type": "null"
                }
              ]
            },
            "claimExpiresAt": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "status"
          ],
          "additionalProperties": true
        },
        {
          "type": "null"
        }
      ]
    },
    "operationId": {
      "type": "string"
    },
    "operations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "href": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "href"
        ]
      }
    }
  },
  "required": [
    "success",
    "domainId"
  ],
  "additionalProperties": true
}

See errors and retries for failure responses.