Dispra Docs

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-Key header and repeated calls within 24 hours return the first result.

Parameters

  • dom string, required: The custom domain's id. Example: dom_01jdk5g7h9j1k3l5z7x9c1v3bn
  • redirect_uri string, required: Where the provider sends you back. Example: https://acme.com/domains/done

Returns

  • 200: url, width and height.

Errors

StatusCodeWhen
404not_foundNo such object in the key's project (or environment).
409domain_connect_unsupportedThe 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"
  }
}