Update Application Domain
curl --request PATCH \
--url https://api.vertracloud.app/v1/apps/{id}/domains/{domain_id} \
--header 'Content-Type: application/json' \
--data '
{
"port": 123,
"path_prefix": {},
"redirect_to": {},
"redirect_status": 123,
"primary": true
}
'import requests
url = "https://api.vertracloud.app/v1/apps/{id}/domains/{domain_id}"
payload = {
"port": 123,
"path_prefix": {},
"redirect_to": {},
"redirect_status": 123,
"primary": True
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
port: 123,
path_prefix: {},
redirect_to: {},
redirect_status: 123,
primary: true
})
};
fetch('https://api.vertracloud.app/v1/apps/{id}/domains/{domain_id}', 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.vertracloud.app/v1/apps/{id}/domains/{domain_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'port' => 123,
'path_prefix' => [
],
'redirect_to' => [
],
'redirect_status' => 123,
'primary' => true
]),
CURLOPT_HTTPHEADER => [
"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.vertracloud.app/v1/apps/{id}/domains/{domain_id}"
payload := strings.NewReader("{\n \"port\": 123,\n \"path_prefix\": {},\n \"redirect_to\": {},\n \"redirect_status\": 123,\n \"primary\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://api.vertracloud.app/v1/apps/{id}/domains/{domain_id}")
.header("Content-Type", "application/json")
.body("{\n \"port\": 123,\n \"path_prefix\": {},\n \"redirect_to\": {},\n \"redirect_status\": 123,\n \"primary\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vertracloud.app/v1/apps/{id}/domains/{domain_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"port\": 123,\n \"path_prefix\": {},\n \"redirect_to\": {},\n \"redirect_status\": 123,\n \"primary\": true\n}"
response = http.request(request)
puts response.read_body{
"response": [
{
"id": "7b8f5e0a-3c1d-4e52-9a47-0d6e2c1f9b34",
"hostname": "api.example.com",
"apex": false,
"companion_of": null,
"redirect_to": null,
"redirect_status": 308,
"path_prefix": "/api",
"port": 3000,
"status": "active",
"ssl_status": "active",
"created_at": "2026-10-21T14:02:11.000Z"
}
]
}
Domains
Update Application Domain
Changes the port, path prefix or redirect of a custom domain, or makes it the main domain, without restarting the application.
PATCH
/
v1
/
apps
/
{id}
/
domains
/
{domain_id}
Update Application Domain
curl --request PATCH \
--url https://api.vertracloud.app/v1/apps/{id}/domains/{domain_id} \
--header 'Content-Type: application/json' \
--data '
{
"port": 123,
"path_prefix": {},
"redirect_to": {},
"redirect_status": 123,
"primary": true
}
'import requests
url = "https://api.vertracloud.app/v1/apps/{id}/domains/{domain_id}"
payload = {
"port": 123,
"path_prefix": {},
"redirect_to": {},
"redirect_status": 123,
"primary": True
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
port: 123,
path_prefix: {},
redirect_to: {},
redirect_status: 123,
primary: true
})
};
fetch('https://api.vertracloud.app/v1/apps/{id}/domains/{domain_id}', 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.vertracloud.app/v1/apps/{id}/domains/{domain_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'port' => 123,
'path_prefix' => [
],
'redirect_to' => [
],
'redirect_status' => 123,
'primary' => true
]),
CURLOPT_HTTPHEADER => [
"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.vertracloud.app/v1/apps/{id}/domains/{domain_id}"
payload := strings.NewReader("{\n \"port\": 123,\n \"path_prefix\": {},\n \"redirect_to\": {},\n \"redirect_status\": 123,\n \"primary\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://api.vertracloud.app/v1/apps/{id}/domains/{domain_id}")
.header("Content-Type", "application/json")
.body("{\n \"port\": 123,\n \"path_prefix\": {},\n \"redirect_to\": {},\n \"redirect_status\": 123,\n \"primary\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vertracloud.app/v1/apps/{id}/domains/{domain_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"port\": 123,\n \"path_prefix\": {},\n \"redirect_to\": {},\n \"redirect_status\": 123,\n \"primary\": true\n}"
response = http.request(request)
puts response.read_body{
"response": [
{
"id": "7b8f5e0a-3c1d-4e52-9a47-0d6e2c1f9b34",
"hostname": "api.example.com",
"apex": false,
"companion_of": null,
"redirect_to": null,
"redirect_status": 308,
"path_prefix": "/api",
"port": 3000,
"status": "active",
"ssl_status": "active",
"created_at": "2026-10-21T14:02:11.000Z"
}
]
}
Changes how a domain is served. Send only the fields you want to change; the application is not restarted or
redeployed. Requires the
apps:write scope when called with an API key.
string
required
The application ID.
string
required
The domain ID, from List Application Domains.
string
If the application belongs to a workspace, the workspace’s ID. Required for workspace members acting on an application they don’t own.
integer
The port of the application that serves this domain, an integer from
1 to 65535. An application can serve its
domains on up to 5 different ports besides 80.string | null
A literal path added in front of every request, in the same format as in
Add Application Domain (
/api). Send null to remove it.string | null
The ID of another domain of the same application to redirect to. Send
null to stop redirecting: the domain serves
the application again and redirect_status goes back to 308. The target must not redirect itself.integer
The HTTP status of the redirect:
301, 302, 307 or 308. Applies only while the domain redirects. When you set
redirect_to without it, the status is 308 for a domain that was serving, and unchanged for one that already redirected.boolean
Send
true on an automatic companion to make it the main domain: it starts serving the application, taking over the
port and path prefix, and the former main domain redirects to it. It has no effect on the domain that is already the main one,
and any other domain answers VALIDATION_ERROR.Response
APIApplicationDomain[]
The domain you changed and every other domain whose role changed with it (for example, the former main domain after
primary). Each item has the fields described in
List Application Domains.{
"response": [
{
"id": "7b8f5e0a-3c1d-4e52-9a47-0d6e2c1f9b34",
"hostname": "api.example.com",
"apex": false,
"companion_of": null,
"redirect_to": null,
"redirect_status": 308,
"path_prefix": "/api",
"port": 3000,
"status": "active",
"ssl_status": "active",
"created_at": "2026-10-21T14:02:11.000Z"
}
]
}
Error Responses
string
The error code indicating the reason for the failure. Possible values:
VALIDATION_ERROR: The path parameters or the body failed validation, for example an unknown field, orprimaryon a domain that cannot be swapped (400). The response also carriesmessageandpath.INVALID_DOMAIN_PORT:portis not an integer from 1 to 65535 (400).INVALID_PATH_PREFIX:path_prefixdoes not follow the format of Add Application Domain (400).INVALID_REDIRECT_TARGET:redirect_tois not another domain of this application, is notactive, is the domain itself, or would chain two redirects (400).UNAUTHORIZED: The request is not authenticated (401).USER_NOT_FOUND: The authenticated user could not be resolved (401).ACCESS_DENIED: The user does not have permission to act on the application (403).API_KEY_SCOPE_DENIED: The API key does not have theapps:writescope (403).DOMAIN_PORT_LIMIT_REACHED: The change would make the application serve domains on more than 5 ports besides80(403).details.limitcarries the limit.APP_NOT_FOUND: The specified application does not exist (404).DOMAIN_NOT_FOUND: The application has no domain with that ID (404).RATE_LIMIT_EXCEEDED: The route’s budget was reached (429).INTERNAL_SERVER_ERROR: Unexpected failure (500).
{
"code": "INVALID_REDIRECT_TARGET"
}
{
"code": "DOMAIN_NOT_FOUND"
}
This route has its own budget of 20 requests per minute. See Rate Limiting.