Attach custom domain
curl --request POST \
--url https://api.getcargo.io/v1/hosting/custom-domains \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"kind": "<string>",
"appUuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"hostname": "<string>"
}
'import requests
url = "https://api.getcargo.io/v1/hosting/custom-domains"
payload = {
"kind": "<string>",
"appUuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"hostname": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
kind: '<string>',
appUuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
hostname: '<string>'
})
};
fetch('https://api.getcargo.io/v1/hosting/custom-domains', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getcargo.io/v1/hosting/custom-domains",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'kind' => '<string>',
'appUuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'hostname' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getcargo.io/v1/hosting/custom-domains"
payload := strings.NewReader("{\n \"kind\": \"<string>\",\n \"appUuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"hostname\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.getcargo.io/v1/hosting/custom-domains")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"kind\": \"<string>\",\n \"appUuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"hostname\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getcargo.io/v1/hosting/custom-domains")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"kind\": \"<string>\",\n \"appUuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"hostname\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"customDomain": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspaceUuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"hostname": "<string>",
"verifiedAt": "<string>",
"verification": [
{
"name": "<string>",
"value": "<string>"
}
],
"cnameTarget": "<string>",
"chargedUntil": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"kind": "<string>",
"appUuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Hosting - Custom Domains
Attach custom domain
Attach a custom domain to an app or worker
POST
/
hosting
/
custom-domains
Attach custom domain
curl --request POST \
--url https://api.getcargo.io/v1/hosting/custom-domains \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"kind": "<string>",
"appUuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"hostname": "<string>"
}
'import requests
url = "https://api.getcargo.io/v1/hosting/custom-domains"
payload = {
"kind": "<string>",
"appUuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"hostname": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
kind: '<string>',
appUuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
hostname: '<string>'
})
};
fetch('https://api.getcargo.io/v1/hosting/custom-domains', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getcargo.io/v1/hosting/custom-domains",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'kind' => '<string>',
'appUuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'hostname' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getcargo.io/v1/hosting/custom-domains"
payload := strings.NewReader("{\n \"kind\": \"<string>\",\n \"appUuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"hostname\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.getcargo.io/v1/hosting/custom-domains")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"kind\": \"<string>\",\n \"appUuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"hostname\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getcargo.io/v1/hosting/custom-domains")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"kind\": \"<string>\",\n \"appUuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"hostname\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"customDomain": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspaceUuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"hostname": "<string>",
"verifiedAt": "<string>",
"verification": [
{
"name": "<string>",
"value": "<string>"
}
],
"cnameTarget": "<string>",
"chargedUntil": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"kind": "<string>",
"appUuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
- Request body
- Request body
Request body schema.
Allowed value:
"app"Identifier of the app this custom domain attaches to.
Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$Customer-controlled subdomain to attach (e.g. app.example.com). Must be a valid FQDN with at least three DNS labels, must not include a protocol or path, and must not be under a Cargo-owned domain. Normalised to lowercase.
Required string length:
4 - 253Response
Successful response
Newly attached custom domain.
- Custom domain
- Custom domain
Show child attributes
Show child attributes
Was this page helpful?
⌘I

