Update a domain - Spacefast Docs
Update a domain
Assigns the domain to a Space, unassigns it, sets its whole-host redirect, or sets wildcardEnabled. A request carries exactly one of those four shapes. Returns the updated domain and the runtime operation the change queued. DNS hosting mode changes through POST /v1/domains/{domainId}/dns and registration through POST /v1/domains/{domainId}/registration.
PATCH /v1/domains/{domainId}
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).
orAuthorization 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
domainId string required
Request body
required application/json
Any of:
- object
wildcardEnabledboolean required
Whether wildcard hostnames may be derived under this record.
- object
spaceIdstring required
Space this hostname should serve (spc_prefix).primaryboolean required
Whether the Space moves its primary URL to this hostname. A redirecting domain cannot be primary.redirectobject | any
Whole-host redirect to answer with instead of serving. Null clears it.
Show properties Hide properties
Any of:
- object
toobject required
Where the hostname redirects: an absolute URL, or a Space with an optional path.
Show properties Hide properties
Any of:
- object
urlstringrequired
Absolute URL the hostname redirects to.spaceIdstring required
Space the hostname redirects to (spc_prefix).pathstring
Path to land on at the target Space. Omit to redirect to its root.statusnumber required
HTTP status the redirect answers with. Reads report308when no other code is stored.
Responses
200 Response for status 200
{
"$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"
}
}
Error Response
{
"$schema": "http://example.com",
"type": "string",
"title": "string",
"status": -9007199254740991,
"detail": "string",
"code": "string",
"pointer": "string",
"details": {
"property1": null,
"property2": null
},
"suggestions": [
"string"
],
"next": [
"string"
],
"requestId": "string"
}
Try it
Server
Base URL https://api.spacefast.com
Custom base URL Overrides the selected server when set.
Authorization
Bearer token Remember on this device Include my values in samples
Parameters
domainId path *
Body application/json
Request body
Send
Request
cURL
curl -X PATCH "https://api.spacefast.com/v1/domains/string" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"wildcardEnabled": true
}'
JavaScript
const response = await fetch("https://api.spacefast.com/v1/domains/string", {
method: "PATCH",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: "{\n \"wildcardEnabled\": true\n}"
});
Python
import requests
response = requests.patch(
"https://api.spacefast.com/v1/domains/string",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
data="{\n \"wildcardEnabled\": true\n}",
)