---
title: "Remove a custom domain"
method: DELETE
path: "/v1/spaces/{spaceId}/domains/{domainId}"
tags: ["Domains"]
---

# Remove a custom domain

`DELETE /v1/spaces/{spaceId}/domains/{domainId}`

## Request

- Base URL: `https://api.spacefast.com`
- URL: `https://api.spacefast.com/v1/spaces/{spaceId}/domains/{domainId}`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://api.spacefast.com/v1/auth/oauth2/authorize`, token URL `https://api.spacefast.com/v1/auth/oauth2/token`; client credentials, token URL `https://api.spacefast.com/v1/auth/oauth2/token`, scopes: `domains:write`)

Remove the attachment. Returns the operation that removes provider aliases and releases the hostname.

## Path parameters

- `spaceId` string, required
- `domainId` string, required

## Response `200`

Response for status 200

- object
  - `$schema` string, uri: Canonical JSON Schema URL for this response body. The server also sends it in the `Link: rel="describedby"` response header.
  - `data` object, required
    - `tenantId` string: Tenant that owns this record (`ten_...`).
    - `principal` object: Tenant-local principal that owns this domain: a team in the main tenant, an external customer in partner integrations.
      - `tenantId` string, required
      - `principalType` 'team' | 'external', required
      - `principalId` string, required
    - `wildcardEnabled` boolean: Whether wildcard hostnames can be derived from this record.
    - `redirect` object: Whole-host redirect target; present only on redirecting domains.
      - `to` union, required: Redirect destination: an absolute URL, or a space (optionally with a path).
        - object
          - `url` string, uri, required: Absolute URL to redirect to.
        - object
          - `spaceId` string, required: Space to redirect to (`spc_...`).
          - `path` string: Path on the target space.
      - `status` string, required
    - `registrar` object: Registration facet; present only on apex records.
      - `mode` 'spacefast' | 'external', required: Whether Spacefast manages this registration or an external registrar holds it.
      - `provider` string: Registrar provider key for a Spacefast-managed registration, for example `wpcom`.
      - `status` 'active' | 'pending_purchase' | 'pending_transfer_in' | 'expiring' | 'expired' | 'locked': Registration lifecycle status; `expiring` is derived from the expiry date.
      - `expiresAt` string, date-time: Instant when the registration expires.
      - `redemptionEndsAt` string, date-time: Instant when the provider grace or redemption window ends after expiry.
      - `autoRenew` boolean: Whether the registration renews automatically.
      - `transferLock` boolean: Whether outbound transfers are locked at the registrar.
    - `dns` object: DNS hosting facet; present only on zone-cut-owning records.
      - `mode` 'spacefast' | 'external', required: Whether Spacefast hosts the authoritative zone or an external DNS provider does.
      - `managementKind` 'unmanaged_external' | 'connected_provider' | 'spacefast_nameservers': Derived DNS management state. This field is additive. `mode` remains the v1 compatibility field.
      - `dnsMode` 'authoritative' | 'adapter': Hybrid DNS mode derived from `managementKind`: authoritative when Spacefast hosts the zone, or adapter when records are managed or observed on the user's existing host. This field is an additive read-model label.
      - `provider` string: DNS provider key for a Spacefast-hosted zone, for example `spacefast` or `wpcom`.
      - `assignedNameservers` string[]: Nameservers the registrar should use when Spacefast hosts the zone.
      - `observedNameservers` string[]: Nameservers currently observed in public DNS; polled in both modes.
      - `ownershipProof` object, nullable: The TXT record Spacefast DNS waits for before serving this zone. Add it at the DNS provider that answers for the domain now and keep the current nameservers until Spacefast sees it; Spacefast checks public DNS automatically. Present for Spacefast-hosted DNS; `null` when no proof is needed.
        - `type` 'A' | 'AAAA' | 'CNAME' | 'TXT' | 'ALIAS', required
        - `name` string, required: Record name to create, relative to the zone.
        - `value` string, required: Exact record value to set.
        - `ttl` integer
        - `purpose` 'verification' | 'routing' | 'ssl', required: Why this record is needed.
      - `snapshot` object: Connected-provider record snapshot freshness for portfolio lists.
        - `freshness` 'fresh' | 'stale' | 'refresh_running' | 'refresh_failed' | 'never_fetched', required
        - `lastFetchedAt` string, date-time, nullable, required
        - `version` string, nullable, required
      - `lastOperation` object: Latest DNS operation summary for portfolio and recovery surfaces.
        - `id` string, required
        - `kind` string, required
        - `status` 'queued' | 'running' | 'observing' | 'succeeded' | 'failed' | 'canceled', required
        - `updatedAt` string, date-time, required
    - `hints` object[]: Projected domain hints derived from diagnostics, actions, observations, and operations.
      - `id` string, required
      - `code` string, required
      - `severity` 'info' | 'warning' | 'error', required
      - `painLevel` 'info' | 'needs_attention' | 'blocked' | 'broken' | 'dangerous', required
      - `subjectFacet` 'dns_zone' | 'registrar' | 'hosting_binding' | 'email' | 'forwarding' | 'provider_connection', required
      - `subjectRef` object, required
        - `domainId` string, required
        - `zoneId` string
        - `bindingId` string
        - `connectionId` string
      - `owner` 'spacefast' | 'user' | 'registrar' | 'provider' | 'support' | 'waiting', required
      - `status` 'active' | 'waiting' | 'running' | 'resolved' | 'dismissed', required
      - `summary` string, required
      - `description` string, required
      - `impact` string, required
      - `evidence` object[], required
        - `label` string, required
        - `value` string, required
        - `observedAt` string, date-time
        - `source` 'provider_api' | 'public_dns' | 'registrar' | 'spacefast_db' | 'operation' | 'user_input', required
      - `suggestions` object[], required
        - `label` string, required
        - `description` string, required
        - `action` union, required
          - object
            - `type` 'open_pending_action', required
            - `actionId` string, required
          - object
            - `type` 'run_action', required
            - `actionKind` string, required
          - object
            - `type` 'copy_records', required
            - `records` object[], required
              - …
          - object
            - `type` 'refresh', required
            - `target` string, required
          - object
            - `type` 'reconnect_provider', required
            - `connectionId` string, required
          - object
            - `type` 'open_external', required
            - `url` string, uri, required
          - object
            - `type` 'wait', required
            - `retryAfter` string, date-time, required
        - `primary` boolean
        - `destructive` boolean
      - `docsUrl` string, uri
      - `operationId` string
      - `requestId` string
      - `providerRequestId` string
      - `expiresAt` string, date-time
    - `id` string, required: Domain attachment ID.
    - `spaceId` string, required: Space that serves this hostname.
    - `name` string, required: Canonical lowercase ASCII hostname without a trailing dot.
    - `unicodeName` string: Unicode hostname, when different from name.
    - `kind` 'hostname' | 'apex', required
    - `derivedGroup` string, required: Registrable domain for this hostname.
    - `primary` boolean, required: Whether this hostname is the Space's primary URL.
    - `verification` object, required: Provider status and required DNS records.
      - `status` 'not_required' | 'pending' | 'verified' | 'failed', required: Current proof of DNS control. `failed` alone never tears down compiled serving state.
      - `requiredRecords` object[]: DNS records the caller must create to prove control and route traffic.
        - `type` 'A' | 'AAAA' | 'CNAME' | 'TXT' | 'ALIAS', required
        - `name` string, required: Record name to create, relative to the zone.
        - `value` string, required: Exact record value to set.
        - `ttl` integer
        - `purpose` 'verification' | 'routing' | 'ssl', required: Why this record is needed.
      - `lastCheckedAt` string, date-time, nullable: Instant when observed DNS was last polled.
      - `lastVerifiedAt` string, date-time, nullable: Instant when this domain last proved DNS control.
      - `diagnostics` object[]: Structured verification diagnostics with stable codes.
        - `code` string, required: Stable snake_case diagnostic code naming the public contract that produced it.
        - `severity` 'info' | 'warning' | 'error', required: How actionable the diagnostic is.
        - `message` string, required: Human-readable explanation with enough detail to act on.
        - `path` string, nullable: Artifact path the diagnostic points at, for example "_headers:12", when one exists.
        - `provider` 'infra' | 'dns' | 'registrar' | 'runtime', nullable: Upstream system the diagnostic originated from, when not Spacefast itself.
        - `details` object, nullable: Machine-readable context for the diagnostic code.
        - `fix` string, nullable: Concrete, agent-actionable remediation hint, when one can be derived.
        - `retryable` boolean, nullable: Whether retrying the same operation can resolve this diagnostic without the caller changing anything.
    - `servingRecords` object: Present when Spacefast DNS holds this domain's zone. Then `verification.requiredRecords` is empty, because the team adds no records by hand.
      - `source` 'spacefast_dns', required: Spacefast DNS holds this domain's zone.
      - `zone` object, required
        - `hostname` string, required: Zone that holds this domain's records.
        - `status` 'served' | 'awaiting_proof' | 'not_published', required: `served`: Spacefast DNS answers for the zone. `awaiting_proof`: Spacefast DNS answers after the team proves it controls the zone. `not_published`: Spacefast stores the zone's records but does not answer for the zone yet.
      - `names` object[], required: One entry for each hostname that this domain serves.
        - `name` string, required: Hostname that this domain serves.
        - `state` 'served' | 'satisfied' | 'blocked' | 'pending' | 'unknown', required: `served`: Spacefast's records answer at this name. `satisfied`: the team's own records already point at the Space. `blocked`: the team's records point somewhere else, so Spacefast writes nothing here. `pending`: the next domain check writes Spacefast's records here. `unknown`: Spacefast does not know the Space's addresses yet, so it changes nothing here.
        - `records` object[], required: Records that Spacefast keeps at this name. Empty while the name is blocked.
          - `type` 'A' | 'AAAA' | 'CNAME' | 'TXT' | 'ALIAS', required
          - `name` string, required: Record name to create, relative to the zone.
          - `value` string, required: Exact record value to set.
          - `ttl` integer
          - `purpose` 'verification' | 'routing' | 'ssl', required: Why this record is needed.
        - `blocking` object[], required: The team's records that block this name. Replace deletes A, AAAA, CNAME and ALIAS records. It never deletes an NS delegation: the team removes that record itself.
          - `id` string, required: DNS record id (`rec_...`).
          - `type` 'A' | 'AAAA' | 'ALIAS' | 'CAA' | 'CNAME' | 'MX' | 'NS' | 'SRV' | 'TXT', required: DNS record type.
          - `name` string, required: Record name relative to the zone. "@" is the zone apex.
          - `value` string, required: Record value.
    - `ownership` object: Present while this Space claims a hostname attached elsewhere.
      - `status` 'verification_required' | 'moving', required
      - `expiresAt` string, date-time, required
      - `moveAvailable` boolean, required
    - `source` 'custom', required: Custom hostname attached to this Space.
    - `managed` false, required
    - `deletable` true, required
    - `assignable` boolean, required
    - `createdAt` string, date-time, required
    - `updatedAt` string, date-time, required
  - `operation` object, nullable, required: Background operation handle when asynchronous work remains after this mutation; null when it completed synchronously.
    - `id` string, required
    - `kind` string, required
    - `status` 'queued' | 'running' | 'succeeded' | 'failed' | 'canceled', required
    - `resources` object[], required
      - `type` string, required
      - `id` string, required
    - `progress` object
      - `total` integer, required
      - `completed` integer, required
      - `failed` integer, required
    - `diagnostics` object[]
      - `code` string, required: Stable snake_case diagnostic code naming the public contract that produced it.
      - `severity` 'info' | 'warning' | 'error', required: How actionable the diagnostic is.
      - `message` string, required: Human-readable explanation with enough detail to act on.
      - `path` string, nullable: Artifact path the diagnostic points at, for example "_headers:12", when one exists.
      - `provider` 'infra' | 'dns' | 'registrar' | 'runtime', nullable: Upstream system the diagnostic originated from, when not Spacefast itself.
      - `details` object, nullable: Machine-readable context for the diagnostic code.
      - `fix` string, nullable: Concrete, agent-actionable remediation hint, when one can be derived.
      - `retryable` boolean, nullable: Whether retrying the same operation can resolve this diagnostic without the caller changing anything.
    - `createdAt` string, date-time, required
    - `finishedAt` string, date-time

## Other responses

- `default`: Problem details (RFC 9457). Any 4xx/5xx response is one `application/problem+json` document.

---

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