Skip to main content
POST
/
org
/
{org}
/
domain
Create a domain
curl --request POST \
  --url https://api.cpln.io/org/{org}/domain \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "description": "<string>",
  "tags": {},
  "name": "<string>",
  "spec": {
    "gvcLink": "<string>",
    "workloadLink": "<string>",
    "acceptAllHosts": true,
    "acceptAllSubdomains": true,
    "ports": [
      {
        "number": 123,
        "protocol": "http2",
        "routes": [
          {
            "replacePrefix": "<string>",
            "regex": "<string>",
            "prefix": "<string>",
            "workloadLink": "<string>",
            "port": 123,
            "hostPrefix": "<string>",
            "hostRegex": "<string>",
            "headers": {
              "request": {
                "set": {}
              }
            },
            "replica": 123,
            "mirror": [
              {
                "workloadLink": "<string>",
                "port": 123,
                "percent": 123
              }
            ],
            "canaries": [
              {
                "workloadLink": "<string>",
                "port": 123,
                "weight": 123
              }
            ]
          }
        ],
        "cors": {
          "allowOrigins": [
            {
              "exact": "<string>",
              "regex": "<string>"
            }
          ],
          "allowMethods": [
            "<string>"
          ],
          "allowHeaders": [
            "<string>"
          ],
          "exposeHeaders": [
            "<string>"
          ],
          "maxAge": "<string>",
          "allowCredentials": true
        },
        "tls": {
          "minProtocolVersion": "TLSV1_2",
          "cipherSuites": [
            [
              "ECDHE-ECDSA-AES256-GCM-SHA384",
              "ECDHE-ECDSA-CHACHA20-POLY1305",
              "ECDHE-ECDSA-AES128-GCM-SHA256",
              "ECDHE-RSA-AES256-GCM-SHA384",
              "ECDHE-RSA-CHACHA20-POLY1305",
              "ECDHE-RSA-AES128-GCM-SHA256",
              "AES256-GCM-SHA384",
              "AES128-GCM-SHA256"
            ]
          ],
          "clientCertificate": {
            "secretLink": "<string>"
          },
          "serverCertificate": {
            "secretLink": "<string>"
          }
        }
      }
    ]
  }
}
'
import requests

url = "https://api.cpln.io/org/{org}/domain"

payload = {
"description": "<string>",
"tags": {},
"name": "<string>",
"spec": {
"gvcLink": "<string>",
"workloadLink": "<string>",
"acceptAllHosts": True,
"acceptAllSubdomains": True,
"ports": [
{
"number": 123,
"protocol": "http2",
"routes": [
{
"replacePrefix": "<string>",
"regex": "<string>",
"prefix": "<string>",
"workloadLink": "<string>",
"port": 123,
"hostPrefix": "<string>",
"hostRegex": "<string>",
"headers": { "request": { "set": {} } },
"replica": 123,
"mirror": [
{
"workloadLink": "<string>",
"port": 123,
"percent": 123
}
],
"canaries": [
{
"workloadLink": "<string>",
"port": 123,
"weight": 123
}
]
}
],
"cors": {
"allowOrigins": [
{
"exact": "<string>",
"regex": "<string>"
}
],
"allowMethods": ["<string>"],
"allowHeaders": ["<string>"],
"exposeHeaders": ["<string>"],
"maxAge": "<string>",
"allowCredentials": True
},
"tls": {
"minProtocolVersion": "TLSV1_2",
"cipherSuites": [["ECDHE-ECDSA-AES256-GCM-SHA384", "ECDHE-ECDSA-CHACHA20-POLY1305", "ECDHE-ECDSA-AES128-GCM-SHA256", "ECDHE-RSA-AES256-GCM-SHA384", "ECDHE-RSA-CHACHA20-POLY1305", "ECDHE-RSA-AES128-GCM-SHA256", "AES256-GCM-SHA384", "AES128-GCM-SHA256"]],
"clientCertificate": { "secretLink": "<string>" },
"serverCertificate": { "secretLink": "<string>" }
}
}
]
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: '<string>',
tags: {},
name: '<string>',
spec: {
gvcLink: '<string>',
workloadLink: '<string>',
acceptAllHosts: true,
acceptAllSubdomains: true,
ports: [
{
number: 123,
protocol: 'http2',
routes: [
{
replacePrefix: '<string>',
regex: '<string>',
prefix: '<string>',
workloadLink: '<string>',
port: 123,
hostPrefix: '<string>',
hostRegex: '<string>',
headers: {request: {set: {}}},
replica: 123,
mirror: [{workloadLink: '<string>', port: 123, percent: 123}],
canaries: [{workloadLink: '<string>', port: 123, weight: 123}]
}
],
cors: {
allowOrigins: [{exact: '<string>', regex: '<string>'}],
allowMethods: ['<string>'],
allowHeaders: ['<string>'],
exposeHeaders: ['<string>'],
maxAge: '<string>',
allowCredentials: true
},
tls: {
minProtocolVersion: 'TLSV1_2',
cipherSuites: [
[
'ECDHE-ECDSA-AES256-GCM-SHA384',
'ECDHE-ECDSA-CHACHA20-POLY1305',
'ECDHE-ECDSA-AES128-GCM-SHA256',
'ECDHE-RSA-AES256-GCM-SHA384',
'ECDHE-RSA-CHACHA20-POLY1305',
'ECDHE-RSA-AES128-GCM-SHA256',
'AES256-GCM-SHA384',
'AES128-GCM-SHA256'
]
],
clientCertificate: {secretLink: '<string>'},
serverCertificate: {secretLink: '<string>'}
}
}
]
}
})
};

fetch('https://api.cpln.io/org/{org}/domain', 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.cpln.io/org/{org}/domain",
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([
'description' => '<string>',
'tags' => [

],
'name' => '<string>',
'spec' => [
'gvcLink' => '<string>',
'workloadLink' => '<string>',
'acceptAllHosts' => true,
'acceptAllSubdomains' => true,
'ports' => [
[
'number' => 123,
'protocol' => 'http2',
'routes' => [
[
'replacePrefix' => '<string>',
'regex' => '<string>',
'prefix' => '<string>',
'workloadLink' => '<string>',
'port' => 123,
'hostPrefix' => '<string>',
'hostRegex' => '<string>',
'headers' => [
'request' => [
'set' => [

]
]
],
'replica' => 123,
'mirror' => [
[
'workloadLink' => '<string>',
'port' => 123,
'percent' => 123
]
],
'canaries' => [
[
'workloadLink' => '<string>',
'port' => 123,
'weight' => 123
]
]
]
],
'cors' => [
'allowOrigins' => [
[
'exact' => '<string>',
'regex' => '<string>'
]
],
'allowMethods' => [
'<string>'
],
'allowHeaders' => [
'<string>'
],
'exposeHeaders' => [
'<string>'
],
'maxAge' => '<string>',
'allowCredentials' => true
],
'tls' => [
'minProtocolVersion' => 'TLSV1_2',
'cipherSuites' => [
[
'ECDHE-ECDSA-AES256-GCM-SHA384',
'ECDHE-ECDSA-CHACHA20-POLY1305',
'ECDHE-ECDSA-AES128-GCM-SHA256',
'ECDHE-RSA-AES256-GCM-SHA384',
'ECDHE-RSA-CHACHA20-POLY1305',
'ECDHE-RSA-AES128-GCM-SHA256',
'AES256-GCM-SHA384',
'AES128-GCM-SHA256'
]
],
'clientCertificate' => [
'secretLink' => '<string>'
],
'serverCertificate' => [
'secretLink' => '<string>'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.cpln.io/org/{org}/domain"

payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"tags\": {},\n \"name\": \"<string>\",\n \"spec\": {\n \"gvcLink\": \"<string>\",\n \"workloadLink\": \"<string>\",\n \"acceptAllHosts\": true,\n \"acceptAllSubdomains\": true,\n \"ports\": [\n {\n \"number\": 123,\n \"protocol\": \"http2\",\n \"routes\": [\n {\n \"replacePrefix\": \"<string>\",\n \"regex\": \"<string>\",\n \"prefix\": \"<string>\",\n \"workloadLink\": \"<string>\",\n \"port\": 123,\n \"hostPrefix\": \"<string>\",\n \"hostRegex\": \"<string>\",\n \"headers\": {\n \"request\": {\n \"set\": {}\n }\n },\n \"replica\": 123,\n \"mirror\": [\n {\n \"workloadLink\": \"<string>\",\n \"port\": 123,\n \"percent\": 123\n }\n ],\n \"canaries\": [\n {\n \"workloadLink\": \"<string>\",\n \"port\": 123,\n \"weight\": 123\n }\n ]\n }\n ],\n \"cors\": {\n \"allowOrigins\": [\n {\n \"exact\": \"<string>\",\n \"regex\": \"<string>\"\n }\n ],\n \"allowMethods\": [\n \"<string>\"\n ],\n \"allowHeaders\": [\n \"<string>\"\n ],\n \"exposeHeaders\": [\n \"<string>\"\n ],\n \"maxAge\": \"<string>\",\n \"allowCredentials\": true\n },\n \"tls\": {\n \"minProtocolVersion\": \"TLSV1_2\",\n \"cipherSuites\": [\n [\n \"ECDHE-ECDSA-AES256-GCM-SHA384\",\n \"ECDHE-ECDSA-CHACHA20-POLY1305\",\n \"ECDHE-ECDSA-AES128-GCM-SHA256\",\n \"ECDHE-RSA-AES256-GCM-SHA384\",\n \"ECDHE-RSA-CHACHA20-POLY1305\",\n \"ECDHE-RSA-AES128-GCM-SHA256\",\n \"AES256-GCM-SHA384\",\n \"AES128-GCM-SHA256\"\n ]\n ],\n \"clientCertificate\": {\n \"secretLink\": \"<string>\"\n },\n \"serverCertificate\": {\n \"secretLink\": \"<string>\"\n }\n }\n }\n ]\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "<api-key>")
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.cpln.io/org/{org}/domain")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"tags\": {},\n \"name\": \"<string>\",\n \"spec\": {\n \"gvcLink\": \"<string>\",\n \"workloadLink\": \"<string>\",\n \"acceptAllHosts\": true,\n \"acceptAllSubdomains\": true,\n \"ports\": [\n {\n \"number\": 123,\n \"protocol\": \"http2\",\n \"routes\": [\n {\n \"replacePrefix\": \"<string>\",\n \"regex\": \"<string>\",\n \"prefix\": \"<string>\",\n \"workloadLink\": \"<string>\",\n \"port\": 123,\n \"hostPrefix\": \"<string>\",\n \"hostRegex\": \"<string>\",\n \"headers\": {\n \"request\": {\n \"set\": {}\n }\n },\n \"replica\": 123,\n \"mirror\": [\n {\n \"workloadLink\": \"<string>\",\n \"port\": 123,\n \"percent\": 123\n }\n ],\n \"canaries\": [\n {\n \"workloadLink\": \"<string>\",\n \"port\": 123,\n \"weight\": 123\n }\n ]\n }\n ],\n \"cors\": {\n \"allowOrigins\": [\n {\n \"exact\": \"<string>\",\n \"regex\": \"<string>\"\n }\n ],\n \"allowMethods\": [\n \"<string>\"\n ],\n \"allowHeaders\": [\n \"<string>\"\n ],\n \"exposeHeaders\": [\n \"<string>\"\n ],\n \"maxAge\": \"<string>\",\n \"allowCredentials\": true\n },\n \"tls\": {\n \"minProtocolVersion\": \"TLSV1_2\",\n \"cipherSuites\": [\n [\n \"ECDHE-ECDSA-AES256-GCM-SHA384\",\n \"ECDHE-ECDSA-CHACHA20-POLY1305\",\n \"ECDHE-ECDSA-AES128-GCM-SHA256\",\n \"ECDHE-RSA-AES256-GCM-SHA384\",\n \"ECDHE-RSA-CHACHA20-POLY1305\",\n \"ECDHE-RSA-AES128-GCM-SHA256\",\n \"AES256-GCM-SHA384\",\n \"AES128-GCM-SHA256\"\n ]\n ],\n \"clientCertificate\": {\n \"secretLink\": \"<string>\"\n },\n \"serverCertificate\": {\n \"secretLink\": \"<string>\"\n }\n }\n }\n ]\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.cpln.io/org/{org}/domain")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"<string>\",\n \"tags\": {},\n \"name\": \"<string>\",\n \"spec\": {\n \"gvcLink\": \"<string>\",\n \"workloadLink\": \"<string>\",\n \"acceptAllHosts\": true,\n \"acceptAllSubdomains\": true,\n \"ports\": [\n {\n \"number\": 123,\n \"protocol\": \"http2\",\n \"routes\": [\n {\n \"replacePrefix\": \"<string>\",\n \"regex\": \"<string>\",\n \"prefix\": \"<string>\",\n \"workloadLink\": \"<string>\",\n \"port\": 123,\n \"hostPrefix\": \"<string>\",\n \"hostRegex\": \"<string>\",\n \"headers\": {\n \"request\": {\n \"set\": {}\n }\n },\n \"replica\": 123,\n \"mirror\": [\n {\n \"workloadLink\": \"<string>\",\n \"port\": 123,\n \"percent\": 123\n }\n ],\n \"canaries\": [\n {\n \"workloadLink\": \"<string>\",\n \"port\": 123,\n \"weight\": 123\n }\n ]\n }\n ],\n \"cors\": {\n \"allowOrigins\": [\n {\n \"exact\": \"<string>\",\n \"regex\": \"<string>\"\n }\n ],\n \"allowMethods\": [\n \"<string>\"\n ],\n \"allowHeaders\": [\n \"<string>\"\n ],\n \"exposeHeaders\": [\n \"<string>\"\n ],\n \"maxAge\": \"<string>\",\n \"allowCredentials\": true\n },\n \"tls\": {\n \"minProtocolVersion\": \"TLSV1_2\",\n \"cipherSuites\": [\n [\n \"ECDHE-ECDSA-AES256-GCM-SHA384\",\n \"ECDHE-ECDSA-CHACHA20-POLY1305\",\n \"ECDHE-ECDSA-AES128-GCM-SHA256\",\n \"ECDHE-RSA-AES256-GCM-SHA384\",\n \"ECDHE-RSA-CHACHA20-POLY1305\",\n \"ECDHE-RSA-AES128-GCM-SHA256\",\n \"AES256-GCM-SHA384\",\n \"AES128-GCM-SHA256\"\n ]\n ],\n \"clientCertificate\": {\n \"secretLink\": \"<string>\"\n },\n \"serverCertificate\": {\n \"secretLink\": \"<string>\"\n }\n }\n }\n ]\n }\n}"

response = http.request(request)
puts response.read_body
{
  "status": 123,
  "message": "<string>",
  "code": "<string>",
  "details": {},
  "id": "<string>"
}
{
"status": 123,
"message": "<string>",
"code": "<string>",
"details": {},
"id": "<string>"
}

Authorizations

Authorization
string
header
required

Service account key can be used as API keys

Path Parameters

org
string
required

Body

application/json
description
string
Maximum string length: 250
tags
object
name
string
Maximum string length: 253
spec
object

Response

Domain was created successfully