Add a domain for a partner principal - Spacefast Docs
Add a domain for a partner principal
Creates a custom domain owned by the Space’s external principal, assigns it to that Space, and starts DNS verification. Counts against the principal’s custom domain quota. Returns the domain and the runtime operation.
POST /v1/spaces/{spaceId}/domains
Authorization
Authorization Bearer token · header required
Authorization: Bearer <token> with an API key (sfa_ prefix), an OAuth access token, a session token, or a Space machine credential (sfm_ prefix).
or
Authorization OAuth2 access token · header required
OAuth 2.0 with Spacefast scopes. People use the authorization code flow; machines use client credentials.
Scopes: domains:write
Path parameters
spaceIdstring required
Request body
required
application/jsonnamestring required
Apex or hostname to add and assign. The server canonicalizes it to lowercase ASCII before storing it.- min length 1 · max length 253
primaryboolean
Whether the Space moves its primary URL to this hostname. Defaults to false.- default: false
Responses
201 Response for status 201
$schemastringCanonical JSON Schema URL for this response body. The server also sends it in the
Link: rel="describedby"response header.dataobject required
Show properties
Hide propertiesidstring required
Domain inventory record ID (dom_prefix).namestring required
Canonical hostname in lowercase ASCII A-labels, punycoded per IDNA2008, with no trailing dot and no wildcard label.unicodeNamestring Unicode U-label form ofname. Absent when the two are identical.kindstring requiredapexwhennameequalsderivedGroup,hostnameotherwise. Server-derived; never accepted as input.
Allowed:hostname,apexwildcardEnabledboolean required
Whether wildcard hostnames may be derived under this record.spaceIdstring | any required
Space this hostname serves (spc_prefix). Null while the record is inventory only. One Space per hostname; a Space may hold many.
Any of:
string
any
primaryboolean required
Whether the Space points itsliveUrlat this hostname.redirectobject
Whole-host redirect this hostname answers with instead of serving. Absent when it serves.
Show properties
Hide properties
- `to` object required
Where the hostname redirects: an absolute URL, or a Space with an optional path.
Show properties
Hide properties
- Any of:
- object
- `url` string <uri> required
Absolute URL the hostname redirects to.
- object
- `spaceId` string required
Space the hostname redirects to (`spc_` prefix).
- min length 1
- `path` string
Path to land on at the target Space. Omit to redirect to its root.
- max length 255
- `status` string required
Allowed: `301`, `302`, `307`, `308`
derivedGroupstring required
Registrable domain ofnameunder the Public Suffix List. Server-computed; never accepted as input.registrarobject
Registration state. Present only on apex records.
Show properties
Hide properties
providerstring Registrar the registration lives with, for examplewpcom. Absent whilemodeisexternal.statusstring
Where the registration sits in its lifecycle.expiringis derived fromexpiresAtrather than stored, andexpiredkeeps serving intact untilredemptionEndsAtpasses. Allowed:active,pending_purchase,pending_transfer_in,expiring,expired,lockedexpiresAtstringISO 8601 timestamp when the registration lapses. Absent until the registrar reports one. matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:.\d+)?)?(?:Z))$ redemptionEndsAtstringISO 8601 timestamp when the registrar closes the redemption window opened by expiry. Serving stays intact until then. matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:.\d+)?)?(?:Z))$ autoRenewboolean
Whether the registrar renews the domain before it expires. Absent when no registration record exists yet.transferLockboolean
Whether the registrar refuses outbound transfers. Absent when no registration record exists yet.dnsobject
DNS hosting state. Present only on records that own their zone cut: the apex, or a hostname whose own nameservers are observed in public DNS.
Show properties
Hide properties
managementKindstring
Who actually holds the zone:unmanaged_externalwith no credential or delegation,connected_providerthrough a linked provider account,registrar_dnson the Spacefast registrar,stattic_nameserversonce delegation lands on Spacefast nameservers. Allowed:unmanaged_external,connected_provider,registrar_dns,stattic_nameserversdnsModestringauthoritativewhen Spacefast answers for the zone,adapterwhen records are written to or observed on another DNS host. Derived frommanagementKind. Allowed:authoritative,adapterproviderstring
DNS host that answers for the zone, for exampleroute53orcloudflare. Absent on an external zone with no provider connection attached.assignedNameserversstring[]
Nameservers the registrar delegation has to point at. Present only whilemodeisstattic.observedNameserversstring[]
Nameservers seen in public DNS at the last poll, in either mode. Absent until a poll observes any.snapshotobject
Freshness of the cached record read from the connected provider. Present only once a provider zone is attached.
Show properties
Hide properties
freshnessstring required
Allowed:fresh,stale,refresh_running,refresh_failed,never_fetchedlastFetchedAtstring| any required
Show properties
Hide properties
Any of:
- stringversion string | any required
Show properties
Hide properties
Any of: - string - string - any - any
lastOperationobject
Newest DNS operation on this zone. Absent until one runs.
Show properties
Hide properties
idstring requiredkindstring requiredstatusstring required Allowed:queued,running,observing,succeeded,failed,canceledupdatedAtstringrequired matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:.\d+)?)?(?:Z))$ verificationobject required
Proof-of-DNS-control state for this hostname.
Show properties
Hide properties
statusstring required
Current proof of DNS control:not_requiredwhile the domain serves no Space,pendingonce it selects one,verifiedon a positive DNS signal,failedafter a check stops proving control. Afailedstatus never tears down serving on its own. Allowed:not_required,pending,verified,failedrequiredRecordsobject[]
Records the caller still has to create to prove control and route traffic. Absent once the hostname serves, and while the domain serves no Space.
Array of object
- type string required
Allowed: A, AAAA, CNAME, TXT, ALIAS
- name string required
Record name, relative to the zone.
- value string required
Exact value to set on the record.
- ttl integer
min -9007199254740991 · max 9007199254740991
- purpose string required
Why the record is needed: verification proves ownership, routing sends traffic to the Space, ssl allows certificate issuance.
Allowed: verification, routing, ssl
- lastCheckedAt string
Show properties
Hide properties
Any of:
- stringlastVerifiedAt string
Show properties
Hide properties
Any of:
- stringdiagnostics object[]
Stable-coded observations about verification, delegation, and registration state. Absent when there are none.
Show properties
Hide properties
Array of object
- code string required
Stable snake_case code for this diagnostic.
- severity string required
How serious the diagnostic is.
Allowed: info, warning, error
- message string required
What happened, in a sentence a person can act on.
- path string | any
File or artifact path the diagnostic refers to, with a line number when known, for example _headers:12. Absent when it applies to the whole resource.
Show properties
Hide properties
Any of:
- string
- string
- any
- any
- provider string | any
Upstream system that raised the diagnostic. Absent when Spacefast raised it.
Show properties
Hide properties
Any of:
- string
- string
- any
- any
- details object | any
Machine-readable context keyed by the diagnostic code.
Show properties
Hide properties
Any of:
- object
- object
- any
- any
- fix string | any
What to change to clear the diagnostic. Absent when there is no known fix.
Show properties
Hide properties
Any of:
- string
- string
- any
- any
- retryable boolean | any
True when repeating the same operation unchanged can clear the diagnostic.
Show properties
Hide properties
Any of:
- boolean
- boolean
- any
- any
- hints object[]
Recovery guidance derived from the newest failed DNS operation. Absent when the last operation did not fail.
Show properties
Hide properties
Array of object
- id string required
- code string required
Stable snake_case code naming the condition this hint was raised for.
- severity string required
Allowed: info, warning, error
- painLevel string required
Allowed: info, needs_attention, blocked, broken, dangerous
- subjectFacet string required
Allowed: dns_zone, registrar, hosting_binding, email, forwarding, provider_connection
- subjectRef object required
Show properties
Hide properties
domainIdstring required
-zoneIdstring -bindingIdstring -connectionIdstring -ownerstring required Who has to move next.statticis Spacefast itself,waitingmeans nobody acts until a timer or an external system settles. Allowed:stattic,user,registrar,provider,support,waiting-statusstring required Allowed:active,waiting,running,resolved,dismissed-summarystring required -descriptionstring required -impactstring required -evidenceobject[] required
Show properties
Hide properties
Array of object
- label string required
- value string required
- observedAt string source string required
Allowed: provider_api, public_dns, registrar, stattic_db, operation, user_input
- suggestions object[] required
Show properties
Hide properties
Array of object
- label string required
- description string required
- action object required
Show properties
Hide properties
One of:
- object
- type string required
- actionId string required
- object
- type string required
- object
- type string required
- connectionId string required
- object
- type string required
- url string type string required
- retryAfter string
- `primary` boolean
- `destructive` boolean
- `docsUrl` string <uri>
- `operationId` string
- `requestId` string
- `providerRequestId` string
- `expiresAt` string <date-time>
ISO 8601 timestamp after which this hint stops applying. Absent when it has no deadline.
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
- `createdAt` string <date-time> required
ISO 8601 timestamp when the record was added to inventory.
- `updatedAt` string <date-time> required
ISO 8601 timestamp when the record last changed.
Example Response
{
"$schema": "http://example.com",
"data": {
"id": "string",
"name": "string",
"unicodeName": "string",
"kind": "hostname",
"wildcardEnabled": true,
"spaceId": "string",
"primary": true,
"redirect": {
"to": {
"url": "http://example.com"
},
"status": 301
},
"derivedGroup": "string",
"registrar": {
"provider": "string",
"status": "active",
"expiresAt": "2019-08-24T14:15:22Z",
"redemptionEndsAt": "2019-08-24T14:15:22Z",
"autoRenew": true,
"transferLock": true
},
"dns": {
"managementKind": "unmanaged_external",
"dnsMode": "authoritative",
"provider": "string",
"assignedNameservers": [
"string"
],
"observedNameservers": [
"string"
],
"snapshot": {
"freshness": "fresh",
"lastFetchedAt": "2019-08-24T14:15:22Z",
"version": "string"
},
"lastOperation": {
"id": "string",
"kind": "string",
"status": "queued",
"updatedAt": "2019-08-24T14:15:22Z"
}
},
"verification": {
"status": "not_required",
"requiredRecords": [
{
"type": "A",
"name": "string",
"value": "string",
"ttl": -9007199254740991,
"purpose": "verification"
}
],
"lastCheckedAt": "2019-08-24T14:15:22Z",
"lastVerifiedAt": "2019-08-24T14:15:22Z",
"diagnostics": [
{
"code": "string",
"severity": "info",
"message": "string",
"path": "string",
"provider": "infra",
"details": {
"property1": null,
"property2": null
},
"fix": "string",
"retryable": true
}
]
},
"hints": [
{
"id": "string",
"code": "string",
"severity": "info",
"painLevel": "info",
"subjectFacet": "dns_zone",
"subjectRef": {
"domainId": "string",
"zoneId": "string",
"bindingId": "string",
"connectionId": "string"
},
"owner": "stattic",
"status": "active",
"summary": "string",
"description": "string",
"impact": "string",
"evidence": [
{
"label": "string",
"value": "string",
"observedAt": "2019-08-24T14:15:22Z",
"source": "provider_api"
}
],
"suggestions": [
{
"label": "string",
"description": "string",
"action": {
"type": "open_pending_action",
"actionId": "string"
},
"primary": true,
"destructive": true
}
],
"docsUrl": "http://example.com",
"operationId": "string",
"requestId": "string",
"providerRequestId": "string",
"expiresAt": "2019-08-24T14:15:22Z"
}
],
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
},
"operation": {
"id": "string",
"kind": "string",
"status": "queued",
"resources": [
{
"type": "string",
"id": "string"
}
],
"progress": {
"total": 9007199254740991,
"completed": 9007199254740991,
"failed": 9007199254740991
},
"diagnostics": [
{
"code": "string",
"severity": "info",
"message": "string",
"path": "string",
"provider": "infra",
"details": {
"property1": null,
"property2": null
},
"fix": "string",
"retryable": true
}
],
"createdAt": "2019-08-24T14:15:22Z",
"finishedAt": "2019-08-24T14:15:22Z"
}
}