Cloud › Networking
Connect a custom domain
POST https://devapi.dispralabs.com/v1/cloud/domains/:dom/connect
When the domain's DNS provider supports Domain Connect: the address where you approve the records at your provider. The domain is then checked as usual.
Needs a key with full access.
- Authentication: Secret key (send it as
Authorization: Bearer <key>) - Idempotency: Safe to retry. Send an
Idempotency-Keyheader and repeated calls within 24 hours return the first result.
Parameters
domstring, required: The custom domain's id. Example:dom_01jdk5g7h9j1k3l5z7x9c1v3bnredirect_uristring, required: Where the provider sends you back. Example:https://acme.com/domains/done
Returns
- 200: url, width and height.
Errors
| Status | Code | When |
|---|---|---|
| 404 | not_found | No such object in the key's project (or environment). |
| 409 | domain_connect_unsupported | The provider doesn't support Domain Connect. |
Request samples
Dispra Cloud CLI
dcloud api POST /v1/cloud/domains/dom_01jdk5g7h9j1k3l5z7x9c1v3bn/connect --data '{"redirect_uri":"https://acme.com/domains/done"}'
cURL
curl -X POST "https://devapi.dispralabs.com/v1/cloud/domains/dom_01jdk5g7h9j1k3l5z7x9c1v3bn/connect" \
-H "Authorization: Bearer dsp_live_YOUR_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"redirect_uri":"https://acme.com/domains/done"}'
Node
const res = await fetch("https://devapi.dispralabs.com/v1/cloud/domains/dom_01jdk5g7h9j1k3l5z7x9c1v3bn/connect", {
method: "POST",
headers: { Authorization: "Bearer dsp_live_YOUR_KEY", "Idempotency-Key": crypto.randomUUID(), "Content-Type": "application/json" },
body: JSON.stringify({
"redirect_uri": "https://acme.com/domains/done"
}),
});
console.log(await res.json());
Python
import uuid, requests
res = requests.request("POST", "https://devapi.dispralabs.com/v1/cloud/domains/dom_01jdk5g7h9j1k3l5z7x9c1v3bn/connect", headers={"Authorization": "Bearer dsp_live_YOUR_KEY", "Idempotency-Key": str(uuid.uuid4())}, json={
"redirect_uri": "https://acme.com/domains/done"
})
print(res.json())
Go
body := strings.NewReader(`{"redirect_uri":"https://acme.com/domains/done"}`)
req, _ := http.NewRequest("POST", "https://devapi.dispralabs.com/v1/cloud/domains/dom_01jdk5g7h9j1k3l5z7x9c1v3bn/connect", body)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer dsp_live_YOUR_KEY")
req.Header.Set("Idempotency-Key", uuid.NewString())
res, _ := http.DefaultClient.Do(req)
Responses
200
{}
404 not_found
{
"error": {
"code": "not_found",
"message": "No such object in the key's project (or environment).",
"request_id": "req_7f3a9c21d84be056"
}
}
409 domain_connect_unsupported
{
"error": {
"code": "domain_connect_unsupported",
"message": "The provider doesn't support Domain Connect.",
"request_id": "req_7f3a9c21d84be056"
}
}