Share a custom domain
curl --request POST \
--url https://api.blaxel.ai/v0/customdomains/{domainName}/share \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"targetWorkspace": "<string>"
}
'import requests
url = "https://api.blaxel.ai/v0/customdomains/{domainName}/share"
payload = { "targetWorkspace": "<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({targetWorkspace: '<string>'})
};
fetch('https://api.blaxel.ai/v0/customdomains/{domainName}/share', 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.blaxel.ai/v0/customdomains/{domainName}/share",
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([
'targetWorkspace' => '<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.blaxel.ai/v0/customdomains/{domainName}/share"
payload := strings.NewReader("{\n \"targetWorkspace\": \"<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.blaxel.ai/v0/customdomains/{domainName}/share")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"targetWorkspace\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blaxel.ai/v0/customdomains/{domainName}/share")
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 \"targetWorkspace\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"metadata": {
"createdAt": "<string>",
"updatedAt": "<string>",
"createdBy": "<string>",
"updatedBy": "<string>",
"displayName": "Preview Domain",
"labels": {},
"name": "preview.example.com",
"sharedFromWorkspace": "<string>",
"workspace": "<string>"
},
"spec": {
"cnameRecords": "<string>",
"domainType": "applications",
"fallbackPreviewId": "my-fallback-preview",
"lastVerifiedAt": "<string>",
"region": "us-pdx-1",
"status": "verified",
"subjectAlternativeNames": [
{}
],
"txtRecords": {},
"validationMethod": "dns",
"verificationError": "<string>"
}
}customdomains
Share a custom domain
Shares a verified custom domain with another workspace of the same account by copying the domain record; the ACM certificate and CloudFront tenant stay with the owner and are reused (not re-provisioned). Use targetWorkspace “account” to make the domain usable by every workspace of the account. Cross-account sharing is not supported.
POST
/
customdomains
/
{domainName}
/
share
Share a custom domain
curl --request POST \
--url https://api.blaxel.ai/v0/customdomains/{domainName}/share \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"targetWorkspace": "<string>"
}
'import requests
url = "https://api.blaxel.ai/v0/customdomains/{domainName}/share"
payload = { "targetWorkspace": "<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({targetWorkspace: '<string>'})
};
fetch('https://api.blaxel.ai/v0/customdomains/{domainName}/share', 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.blaxel.ai/v0/customdomains/{domainName}/share",
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([
'targetWorkspace' => '<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.blaxel.ai/v0/customdomains/{domainName}/share"
payload := strings.NewReader("{\n \"targetWorkspace\": \"<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.blaxel.ai/v0/customdomains/{domainName}/share")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"targetWorkspace\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blaxel.ai/v0/customdomains/{domainName}/share")
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 \"targetWorkspace\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"metadata": {
"createdAt": "<string>",
"updatedAt": "<string>",
"createdBy": "<string>",
"updatedBy": "<string>",
"displayName": "Preview Domain",
"labels": {},
"name": "preview.example.com",
"sharedFromWorkspace": "<string>",
"workspace": "<string>"
},
"spec": {
"cnameRecords": "<string>",
"domainType": "applications",
"fallbackPreviewId": "my-fallback-preview",
"lastVerifiedAt": "<string>",
"region": "us-pdx-1",
"status": "verified",
"subjectAlternativeNames": [
{}
],
"txtRecords": {},
"validationMethod": "dns",
"verificationError": "<string>"
}
}Authorizations
OAuth2ApiKeyAuth
Body
application/json
Response
successful operation
Custom domain for preview deployments The custom domain represents a base domain (e.g., example.com) that will be used to serve preview deployments. Each preview will be accessible at a subdomain: .preview. (e.g., abc123.preview.example.com)
Was this page helpful?