curl --request PUT \
--url https://api2.endstate.io/v1/settings/cors-origins \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cors_origins": [
"https://brand.example",
"https://*.brand.example"
]
}
'import requests
url = "https://api2.endstate.io/v1/settings/cors-origins"
payload = { "cors_origins": ["https://brand.example", "https://*.brand.example"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({cors_origins: ['https://brand.example', 'https://*.brand.example']})
};
fetch('https://api2.endstate.io/v1/settings/cors-origins', 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://api2.endstate.io/v1/settings/cors-origins",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cors_origins' => [
'https://brand.example',
'https://*.brand.example'
]
]),
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://api2.endstate.io/v1/settings/cors-origins"
payload := strings.NewReader("{\n \"cors_origins\": [\n \"https://brand.example\",\n \"https://*.brand.example\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api2.endstate.io/v1/settings/cors-origins")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cors_origins\": [\n \"https://brand.example\",\n \"https://*.brand.example\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api2.endstate.io/v1/settings/cors-origins")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cors_origins\": [\n \"https://brand.example\",\n \"https://*.brand.example\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"cors_origins": [
"https://brand.example",
"https://*.brand.example"
]
}{
"error": {
"code": "validation.failed",
"message": "The request failed schema validation. See `error.details` for per-field issues.",
"request_id": "req_8e1a7f50-90ab-4cde-f012-3456789abcde",
"doc_url": "https://docs.endstate.io/errors/validation-failed"
}
}{
"error": {
"code": "auth.unauthorized",
"message": "Credential is missing or malformed.",
"request_id": "req_8e1a7f50-90ab-4cde-f012-3456789abcde",
"doc_url": "https://docs.endstate.io/errors/auth-unauthorized"
}
}{
"error": {
"code": "auth.forbidden",
"message": "Credential is valid but does not have access to the requested resource or action.",
"request_id": "req_8e1a7f50-90ab-4cde-f012-3456789abcde",
"doc_url": "https://docs.endstate.io/errors/auth-forbidden"
}
}{
"error": {
"code": "internal.error",
"message": "An unexpected server error occurred. Retry with exponential backoff and include `request_id` in any support request.",
"request_id": "req_8e1a7f50-90ab-4cde-f012-3456789abcde",
"doc_url": "https://docs.endstate.io/errors/internal-error"
}
}Replace CORS origins
Replaces the full list of origins allowed to call the API from a browser. Each entry is an exact origin, a subdomain wildcard like https://*.brand.example, or a port wildcard like http://localhost:*; entries are stored in canonical form and returned as saved. Send an empty array to remove all origins. Changes take effect within about a minute. Every origin on this list can call the API from a browser, so remove development origins such as http://localhost:* before you go live.
curl --request PUT \
--url https://api2.endstate.io/v1/settings/cors-origins \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cors_origins": [
"https://brand.example",
"https://*.brand.example"
]
}
'import requests
url = "https://api2.endstate.io/v1/settings/cors-origins"
payload = { "cors_origins": ["https://brand.example", "https://*.brand.example"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({cors_origins: ['https://brand.example', 'https://*.brand.example']})
};
fetch('https://api2.endstate.io/v1/settings/cors-origins', 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://api2.endstate.io/v1/settings/cors-origins",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cors_origins' => [
'https://brand.example',
'https://*.brand.example'
]
]),
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://api2.endstate.io/v1/settings/cors-origins"
payload := strings.NewReader("{\n \"cors_origins\": [\n \"https://brand.example\",\n \"https://*.brand.example\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api2.endstate.io/v1/settings/cors-origins")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cors_origins\": [\n \"https://brand.example\",\n \"https://*.brand.example\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api2.endstate.io/v1/settings/cors-origins")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cors_origins\": [\n \"https://brand.example\",\n \"https://*.brand.example\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"cors_origins": [
"https://brand.example",
"https://*.brand.example"
]
}{
"error": {
"code": "validation.failed",
"message": "The request failed schema validation. See `error.details` for per-field issues.",
"request_id": "req_8e1a7f50-90ab-4cde-f012-3456789abcde",
"doc_url": "https://docs.endstate.io/errors/validation-failed"
}
}{
"error": {
"code": "auth.unauthorized",
"message": "Credential is missing or malformed.",
"request_id": "req_8e1a7f50-90ab-4cde-f012-3456789abcde",
"doc_url": "https://docs.endstate.io/errors/auth-unauthorized"
}
}{
"error": {
"code": "auth.forbidden",
"message": "Credential is valid but does not have access to the requested resource or action.",
"request_id": "req_8e1a7f50-90ab-4cde-f012-3456789abcde",
"doc_url": "https://docs.endstate.io/errors/auth-forbidden"
}
}{
"error": {
"code": "internal.error",
"message": "An unexpected server error occurred. Retry with exponential backoff and include `request_id` in any support request.",
"request_id": "req_8e1a7f50-90ab-4cde-f012-3456789abcde",
"doc_url": "https://docs.endstate.io/errors/internal-error"
}
}Authorizations
Use Authorization: Bearer end_sk_* for partner API keys (e.g. end_sk_AbCd_example_api_key).
Body
The complete allow-list. Replaces the previous list; send an empty array to remove all origins.
50An exact origin (https://brand.example), a subdomain wildcard (https://*.brand.example, matching any subdomain depth), or a port wildcard (http://localhost:*, matching any port on that host). One wildcard per entry. Port wildcards are intended for local development; remove them before going live.
1 - 255Response
The saved allowed origins.
Origins allowed to call the API from a browser, in canonical form.
[
"https://brand.example",
"https://*.brand.example"
]

