curl --request POST \
--url https://api.cwsandbox.com/v1/networkConfigs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"spec": {
"ingress": [
{
"any": true,
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
]
}
],
"egress": [
{
"httpsHostname": "<string>",
"any": true,
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
],
"httpsHostnameExcept": [
"<string>"
]
}
],
"denyEgress": true,
"denyIngress": true
},
"networkConfigId": "<string>",
"etag": "<string>"
}
'import requests
url = "https://api.cwsandbox.com/v1/networkConfigs"
payload = {
"spec": {
"ingress": [
{
"any": True,
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
]
}
],
"egress": [
{
"httpsHostname": "<string>",
"any": True,
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
],
"httpsHostnameExcept": ["<string>"]
}
],
"denyEgress": True,
"denyIngress": True
},
"networkConfigId": "<string>",
"etag": "<string>"
}
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({
spec: {
ingress: [{any: true, ports: [{port: 123, protocol: '<string>', endPort: 123}]}],
egress: [
{
httpsHostname: '<string>',
any: true,
ports: [{port: 123, protocol: '<string>', endPort: 123}],
httpsHostnameExcept: ['<string>']
}
],
denyEgress: true,
denyIngress: true
},
networkConfigId: '<string>',
etag: '<string>'
})
};
fetch('https://api.cwsandbox.com/v1/networkConfigs', 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.cwsandbox.com/v1/networkConfigs",
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([
'spec' => [
'ingress' => [
[
'any' => true,
'ports' => [
[
'port' => 123,
'protocol' => '<string>',
'endPort' => 123
]
]
]
],
'egress' => [
[
'httpsHostname' => '<string>',
'any' => true,
'ports' => [
[
'port' => 123,
'protocol' => '<string>',
'endPort' => 123
]
],
'httpsHostnameExcept' => [
'<string>'
]
]
],
'denyEgress' => true,
'denyIngress' => true
],
'networkConfigId' => '<string>',
'etag' => '<string>'
]),
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://api.cwsandbox.com/v1/networkConfigs"
payload := strings.NewReader("{\n \"spec\": {\n \"ingress\": [\n {\n \"any\": true,\n \"ports\": [\n {\n \"port\": 123,\n \"protocol\": \"<string>\",\n \"endPort\": 123\n }\n ]\n }\n ],\n \"egress\": [\n {\n \"httpsHostname\": \"<string>\",\n \"any\": true,\n \"ports\": [\n {\n \"port\": 123,\n \"protocol\": \"<string>\",\n \"endPort\": 123\n }\n ],\n \"httpsHostnameExcept\": [\n \"<string>\"\n ]\n }\n ],\n \"denyEgress\": true,\n \"denyIngress\": true\n },\n \"networkConfigId\": \"<string>\",\n \"etag\": \"<string>\"\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))
}HttpResponse<String> response = Unirest.post("https://api.cwsandbox.com/v1/networkConfigs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"spec\": {\n \"ingress\": [\n {\n \"any\": true,\n \"ports\": [\n {\n \"port\": 123,\n \"protocol\": \"<string>\",\n \"endPort\": 123\n }\n ]\n }\n ],\n \"egress\": [\n {\n \"httpsHostname\": \"<string>\",\n \"any\": true,\n \"ports\": [\n {\n \"port\": 123,\n \"protocol\": \"<string>\",\n \"endPort\": 123\n }\n ],\n \"httpsHostnameExcept\": [\n \"<string>\"\n ]\n }\n ],\n \"denyEgress\": true,\n \"denyIngress\": true\n },\n \"networkConfigId\": \"<string>\",\n \"etag\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cwsandbox.com/v1/networkConfigs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"spec\": {\n \"ingress\": [\n {\n \"any\": true,\n \"ports\": [\n {\n \"port\": 123,\n \"protocol\": \"<string>\",\n \"endPort\": 123\n }\n ]\n }\n ],\n \"egress\": [\n {\n \"httpsHostname\": \"<string>\",\n \"any\": true,\n \"ports\": [\n {\n \"port\": 123,\n \"protocol\": \"<string>\",\n \"endPort\": 123\n }\n ],\n \"httpsHostnameExcept\": [\n \"<string>\"\n ]\n }\n ],\n \"denyEgress\": true,\n \"denyIngress\": true\n },\n \"networkConfigId\": \"<string>\",\n \"etag\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"spec": {
"ingress": [
{
"cidr": {
"cidr": "<string>",
"except": [
"<string>"
]
},
"tenant": "TENANT_SCOPE_UNSPECIFIED",
"any": true,
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
]
}
],
"egress": [
{
"cidr": {
"cidr": "<string>",
"except": [
"<string>"
]
},
"httpsHostname": "<string>",
"tenant": "TENANT_SCOPE_UNSPECIFIED",
"any": true,
"selector": {
"podLabels": {},
"namespaceLabels": {}
},
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
],
"httpsHostnameExcept": [
"<string>"
]
}
],
"denyEgress": true,
"denyIngress": true,
"dnsEgress": "DNS_EGRESS_MODE_UNSPECIFIED"
},
"networkConfigId": "<string>",
"status": {
"sandboxId": "<string>",
"platformManaged": true,
"createTime": "2023-11-07T05:31:56Z",
"updateTime": "2023-11-07T05:31:56Z"
},
"etag": "<string>"
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Create network configuration
Register desired network rules for a sandbox.
curl --request POST \
--url https://api.cwsandbox.com/v1/networkConfigs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"spec": {
"ingress": [
{
"any": true,
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
]
}
],
"egress": [
{
"httpsHostname": "<string>",
"any": true,
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
],
"httpsHostnameExcept": [
"<string>"
]
}
],
"denyEgress": true,
"denyIngress": true
},
"networkConfigId": "<string>",
"etag": "<string>"
}
'import requests
url = "https://api.cwsandbox.com/v1/networkConfigs"
payload = {
"spec": {
"ingress": [
{
"any": True,
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
]
}
],
"egress": [
{
"httpsHostname": "<string>",
"any": True,
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
],
"httpsHostnameExcept": ["<string>"]
}
],
"denyEgress": True,
"denyIngress": True
},
"networkConfigId": "<string>",
"etag": "<string>"
}
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({
spec: {
ingress: [{any: true, ports: [{port: 123, protocol: '<string>', endPort: 123}]}],
egress: [
{
httpsHostname: '<string>',
any: true,
ports: [{port: 123, protocol: '<string>', endPort: 123}],
httpsHostnameExcept: ['<string>']
}
],
denyEgress: true,
denyIngress: true
},
networkConfigId: '<string>',
etag: '<string>'
})
};
fetch('https://api.cwsandbox.com/v1/networkConfigs', 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.cwsandbox.com/v1/networkConfigs",
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([
'spec' => [
'ingress' => [
[
'any' => true,
'ports' => [
[
'port' => 123,
'protocol' => '<string>',
'endPort' => 123
]
]
]
],
'egress' => [
[
'httpsHostname' => '<string>',
'any' => true,
'ports' => [
[
'port' => 123,
'protocol' => '<string>',
'endPort' => 123
]
],
'httpsHostnameExcept' => [
'<string>'
]
]
],
'denyEgress' => true,
'denyIngress' => true
],
'networkConfigId' => '<string>',
'etag' => '<string>'
]),
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://api.cwsandbox.com/v1/networkConfigs"
payload := strings.NewReader("{\n \"spec\": {\n \"ingress\": [\n {\n \"any\": true,\n \"ports\": [\n {\n \"port\": 123,\n \"protocol\": \"<string>\",\n \"endPort\": 123\n }\n ]\n }\n ],\n \"egress\": [\n {\n \"httpsHostname\": \"<string>\",\n \"any\": true,\n \"ports\": [\n {\n \"port\": 123,\n \"protocol\": \"<string>\",\n \"endPort\": 123\n }\n ],\n \"httpsHostnameExcept\": [\n \"<string>\"\n ]\n }\n ],\n \"denyEgress\": true,\n \"denyIngress\": true\n },\n \"networkConfigId\": \"<string>\",\n \"etag\": \"<string>\"\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))
}HttpResponse<String> response = Unirest.post("https://api.cwsandbox.com/v1/networkConfigs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"spec\": {\n \"ingress\": [\n {\n \"any\": true,\n \"ports\": [\n {\n \"port\": 123,\n \"protocol\": \"<string>\",\n \"endPort\": 123\n }\n ]\n }\n ],\n \"egress\": [\n {\n \"httpsHostname\": \"<string>\",\n \"any\": true,\n \"ports\": [\n {\n \"port\": 123,\n \"protocol\": \"<string>\",\n \"endPort\": 123\n }\n ],\n \"httpsHostnameExcept\": [\n \"<string>\"\n ]\n }\n ],\n \"denyEgress\": true,\n \"denyIngress\": true\n },\n \"networkConfigId\": \"<string>\",\n \"etag\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cwsandbox.com/v1/networkConfigs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"spec\": {\n \"ingress\": [\n {\n \"any\": true,\n \"ports\": [\n {\n \"port\": 123,\n \"protocol\": \"<string>\",\n \"endPort\": 123\n }\n ]\n }\n ],\n \"egress\": [\n {\n \"httpsHostname\": \"<string>\",\n \"any\": true,\n \"ports\": [\n {\n \"port\": 123,\n \"protocol\": \"<string>\",\n \"endPort\": 123\n }\n ],\n \"httpsHostnameExcept\": [\n \"<string>\"\n ]\n }\n ],\n \"denyEgress\": true,\n \"denyIngress\": true\n },\n \"networkConfigId\": \"<string>\",\n \"etag\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"spec": {
"ingress": [
{
"cidr": {
"cidr": "<string>",
"except": [
"<string>"
]
},
"tenant": "TENANT_SCOPE_UNSPECIFIED",
"any": true,
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
]
}
],
"egress": [
{
"cidr": {
"cidr": "<string>",
"except": [
"<string>"
]
},
"httpsHostname": "<string>",
"tenant": "TENANT_SCOPE_UNSPECIFIED",
"any": true,
"selector": {
"podLabels": {},
"namespaceLabels": {}
},
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
],
"httpsHostnameExcept": [
"<string>"
]
}
],
"denyEgress": true,
"denyIngress": true,
"dnsEgress": "DNS_EGRESS_MODE_UNSPECIFIED"
},
"networkConfigId": "<string>",
"status": {
"sandboxId": "<string>",
"platformManaged": true,
"createTime": "2023-11-07T05:31:56Z",
"updateTime": "2023-11-07T05:31:56Z"
},
"etag": "<string>"
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Authorizations
CoreWeave API access token sent as a bearer token.
Query Parameters
Body
NetworkConfig is the desired network document a sandbox binds 1:1.
NetworkOptions declares the sandbox's network intent beyond port exposure.
Show child attributes
Show child attributes
Immutable, organization-unique ID matching ^[a-z][a-z0-9-]{2,62}$. Choose the ID on CreateNetworkConfig, without the reserved nc- prefix. The platform assigns an nc- ID when it creates a configuration automatically for a sandbox.
Optional concurrency token. Send the last returned value in the NetworkConfig update body to protect a desired-state write. A mismatch on that write returns ABORTED with CWSANDBOX_ETAG_MISMATCH. A bound update whose resulting spec already matches stored desired state reapplies enforcement without checking the token. Omitting the token permits the last persisted desired-state write to win. The token does not make enforcement atomic.
Response
OK
NetworkConfig is the desired network document a sandbox binds 1:1.
NetworkOptions declares the sandbox's network intent beyond port exposure.
Show child attributes
Show child attributes
Immutable, organization-unique ID matching ^[a-z][a-z0-9-]{2,62}$. Choose the ID on CreateNetworkConfig, without the reserved nc- prefix. The platform assigns an nc- ID when it creates a configuration automatically for a sandbox.
Show child attributes
Show child attributes
Optional concurrency token. Send the last returned value in the NetworkConfig update body to protect a desired-state write. A mismatch on that write returns ABORTED with CWSANDBOX_ETAG_MISMATCH. A bound update whose resulting spec already matches stored desired state reapplies enforcement without checking the token. Omitting the token permits the last persisted desired-state write to win. The token does not make enforcement atomic.
Was this page helpful?