List the workspace's custom domains
method
GET
host
strait.
version
/v1
resource
/
GET /v1/domains
Auth: secret key as Authorization: Bearer. Server-side only.
Coming soon: custom domains aren't switched on yet. Until they are, this endpoint answers enabled: false (the list) or 503 domains_not_enabled.
Request
Every custom domain with its live status and the DNS records to add. Any member may read. A domain turns verified here, on the first read after Cloudflare reports it live and its ownership TXT record is in DNS. Limited to 20 reads, then 1 every 2 s, per workspace (429 with Retry-After).
Parameters
tenantIdstring query- The workspace. Required with a dashboard session; with a secret key it is the key's workspace (another id is 404).
Response
- 200 The domains, and whether custom domains are switched on for this workspace
- 400 tenantId missing (dashboard session)
- 401 Missing or invalid secret key or session
- 404 Not a member of this workspace
- 429 Too many status reads
curl -X GET https://strait.link/v1/domains \
-H "Authorization: Bearer $SECRET_KEY"const res = await fetch('https://strait.link/v1/domains', {
headers: { Authorization: `Bearer ${process.env.SECRET_KEY}` },
});
const data = await res.json();
console.log(res.status, data);import os
import requests
res = requests.get(
"https://strait.link/v1/domains",
headers={"Authorization": f"Bearer {os.environ['SECRET_KEY']}"},
)
print(res.status_code, res.json())<?php
// Plain PHP with ext-curl, no packages. In Laravel, Http::withToken($secretKey)->get($url) sends the same request.
$ch = curl_init('https://strait.link/v1/domains');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SECRET_KEY'),
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status, PHP_EOL;
print_r(json_decode($response, true));import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
// Java 17+, java.net.http only (no dependencies).
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder(URI.create("https://strait.link/v1/domains"))
.header("Authorization", "Bearer " + System.getenv("SECRET_KEY"))
.GET()
.build();
HttpResponse<String> res = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(res.statusCode() + " " + res.body());
}
}package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest(http.MethodGet, "https://strait.link/v1/domains", nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("SECRET_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(res.StatusCode, string(data))
}The response, printed
{
"enabled": true,
"writes": true,
"allowed": true,
"cnameTarget": "fallback.strait.link",
"max": 5,
"domains": [
{
"hostname": "links.hilltop.example",
"verified": true,
"status": "live",
"records": [
{
"type": "CNAME",
"name": "links.hilltop.example",
"value": "fallback.strait.link",
"purpose": "Sends your links to Strait"
},
{
"type": "TXT",
"name": "_cf-custom-hostname.links.hilltop.example",
"value": "5cc07c04-ea62-4a5a-95f0-419334a875a4",
"purpose": "Proves you own the domain"
},
{
"type": "TXT",
"name": "_acme-challenge.links.hilltop.example",
"value": "ca3-574923932a82475cb8592200f1a2a23d",
"purpose": "Lets us issue its HTTPS certificate"
}
]
}
]
}