Add Custom Domain
curl --request POST \
--url https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/custom-domains \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"domain": "app.example.com"
}
'import requests
url = "https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/custom-domains"
payload = { "domain": "app.example.com" }
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({domain: 'app.example.com'})
};
fetch('https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/custom-domains', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/custom-domains"
payload := strings.NewReader("{\n \"domain\": \"app.example.com\"\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))
}{
"message": "success",
"data": {
"custom_domain": {
"id": "d41f5b60-0000-0000-0000-000000000000",
"account_id": "6c1d0f7a-0000-0000-0000-000000000000",
"private_instance_id": "9a3b2c10-0000-0000-0000-000000000000",
"service_id": "b1f0a9c2-0000-0000-0000-000000000000",
"prov_custom_domain_id": "cd-77aa",
"domain": "app.example.com",
"origin": "https://app.example.com",
"state": "unverified",
"dns_records": [
{
"purpose": "verify_acm",
"record_name": "_x1.app.example.com",
"record_type": "CNAME",
"record_value": "_y2.acm-validations.aws",
"created_at": "2026-08-10T09:31:00Z"
},
{
"purpose": "route_app_traffic",
"record_name": "app.example.com",
"record_type": "CNAME",
"record_value": "k8s-ingress.elb.amazonaws.com",
"created_at": "2026-08-10T09:31:00Z"
}
],
"created_at": "2026-08-10T09:31:00Z",
"updated_at": "2026-08-10T09:31:00Z"
}
}
}
Custom Domains
Add Custom Domain
Register a custom domain for a service and get back the DNS records to create. Create the returned records in your DNS provider, then verify the domain.
POST
/
v1
/
environments
/
{envId}
/
services
/
{serviceId}
/
custom-domains
Add Custom Domain
curl --request POST \
--url https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/custom-domains \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"domain": "app.example.com"
}
'import requests
url = "https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/custom-domains"
payload = { "domain": "app.example.com" }
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({domain: 'app.example.com'})
};
fetch('https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/custom-domains', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/custom-domains"
payload := strings.NewReader("{\n \"domain\": \"app.example.com\"\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))
}{
"message": "success",
"data": {
"custom_domain": {
"id": "d41f5b60-0000-0000-0000-000000000000",
"account_id": "6c1d0f7a-0000-0000-0000-000000000000",
"private_instance_id": "9a3b2c10-0000-0000-0000-000000000000",
"service_id": "b1f0a9c2-0000-0000-0000-000000000000",
"prov_custom_domain_id": "cd-77aa",
"domain": "app.example.com",
"origin": "https://app.example.com",
"state": "unverified",
"dns_records": [
{
"purpose": "verify_acm",
"record_name": "_x1.app.example.com",
"record_type": "CNAME",
"record_value": "_y2.acm-validations.aws",
"created_at": "2026-08-10T09:31:00Z"
},
{
"purpose": "route_app_traffic",
"record_name": "app.example.com",
"record_type": "CNAME",
"record_value": "k8s-ingress.elb.amazonaws.com",
"created_at": "2026-08-10T09:31:00Z"
}
],
"created_at": "2026-08-10T09:31:00Z",
"updated_at": "2026-08-10T09:31:00Z"
}
}
}
Authorizations
Your account API token, sent as Authorization: Bearer <api_token>. Owners and admins can read the token from the LocalOps console.
Path Parameters
The unique identifier of the environment
The unique identifier of the service
Body
application/json
The fully qualified domain name to attach to this service
Was this page helpful?
⌘I