Skip to content

Connect a domain

Try it

Connects a domain the client owns, e.g. maplestreetbakery.com (with_www also adds www.). It answers PENDING with the DNS records to add; nothing is served on it until check_domain finds them. Up to five per site; a domain already on another site is refused without saying which.

POST/api/v1/sites/{site_id}/domains

Authentication

An API key as Authorization: Bearer or x-api-key. It needs the domains:write scope — connect, check and remove domains.

domains:writeChanges the draft or a recordIdempotency-Key requiredMCP tool: add_domain

Parameters

Named placeholders go in the path; the rest in a JSON body.

site_idstringPath · required
The site's id.1 to 100 characters
hostnamestringBody · required
e.g. maplestreetbakery.com or www.maplestreetbakery.com3 to 253 characters
with_wwwbooleanBody · optional
For a bare domain, also connect www. (default true).Default true

Response

201 with JSON on success (schema on the right). Errors use the standard envelope; a retry with the same Idempotency-Key gets the first answer back (how retries work).

curl
curl -X POST 'https://websites.workflowcorp.com/api/v1/sites/SITE_ID/domains' \
  -H "Authorization: Bearer $WEBSITEBUDDY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"hostname":"maplestreetbakery.com","with_www":true}'
Example arguments
{
  "site_id": "SITE_ID",
  "hostname": "maplestreetbakery.com",
  "with_www": true
}
Response schema
{
  "type": "object",
  "properties": {
    "added": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "hostname": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "verified",
              "failed"
            ]
          },
          "primary": {
            "type": "boolean",
            "description": "The site's main address; the other domains send visitors here."
          },
          "verified_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_checked_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the last check found wrong, in plain words."
          },
          "https": {
            "type": "object",
            "properties": {
              "status": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "provisioning, active, failed — null while HTTPS isn't set up or the domain isn't verified."
              },
              "error": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "status",
              "error"
            ],
            "additionalProperties": false
          },
          "dns_records": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                },
                "why": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "name",
                "value",
                "why"
              ],
              "additionalProperties": false
            },
            "description": "What to add at the company the domain is registered with, then call check_domain."
          },
          "created_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "hostname",
          "status",
          "primary",
          "verified_at",
          "last_checked_at",
          "last_error",
          "https",
          "dns_records",
          "created_at"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "added",
    "data"
  ],
  "additionalProperties": false
}