kosa8 docs Dashboard
esc
↑ ↓ move↵ openRuns in your browser; nothing you type is sent anywhere.

HTTP API / Custom domains

Custom domains

8 endpoints at https://api.kosa8.com, sent with Authorization: Bearer $KOSA8_API_KEY. Generated from the API's own OpenAPI description, which a test holds to the router.

The preview's custom domains#

GET/v1/sandboxes/{id}/previews/{port}/domainsscope sandboxes:read
Parameters
idrequiredpath · string
Sandbox id (sbx_…)
portrequiredpath · string
The port in the sandbox, 1-65535
Responses
200400401403404
curl -s -X GET https://api.kosa8.com/v1/sandboxes/$SBX/previews/$PORT/domains \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Serve the preview at your own hostname#

POST/v1/sandboxes/{id}/previews/{port}/domainsscope sandboxes:write

Through Cloudflare for SaaS custom hostnames: 501 not_available when this kosa8 Cloud has not configured it. A preview has at most 5 custom domains, an organization 50. The domain serves the preview as it is, private (signed link) or public, and follows the sandbox and port across a rotate.

Parameters
idrequiredpath · string
Sandbox id (sbx_…)
portrequiredpath · string
The port in the sandbox, 1-65535
JSON body
hostnamerequiredstring
A name under your own domain; never one under kosa8's or the preview domain
ssl_method"http" | "txt"
How Cloudflare validates the certificate: http (default, once the CNAME points here) or txt
Responses
201400401403404409501502
curl -s -X POST https://api.kosa8.com/v1/sandboxes/$SBX/previews/$PORT/domains \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

A custom domain's status, asked of Cloudflare again#

GET/v1/sandboxes/{id}/previews/{port}/domains/{hostname}scope sandboxes:read
Parameters
idrequiredpath · string
Sandbox id (sbx_…)
portrequiredpath · string
The port in the sandbox, 1-65535
hostnamerequiredpath · string
The custom domain, such as preview.example.com
Responses
200400401403404
curl -s -X GET https://api.kosa8.com/v1/sandboxes/$SBX/previews/$PORT/domains/$HOSTNAME \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Stop serving the preview at the hostname#

DELETE/v1/sandboxes/{id}/previews/{port}/domains/{hostname}scope sandboxes:write
Parameters
idrequiredpath · string
Sandbox id (sbx_…)
portrequiredpath · string
The port in the sandbox, 1-65535
hostnamerequiredpath · string
The custom domain, such as preview.example.com
Responses
200400401403404502
curl -s -X DELETE https://api.kosa8.com/v1/sandboxes/$SBX/previews/$PORT/domains/$HOSTNAME \
  -H "Authorization: Bearer $KOSA8_API_KEY"

The preview's custom domains#

GET/v1/previews/{preview_id}/domainsscope sandboxes:read
Parameters
preview_idrequiredpath · string
A preview's id, {sandbox_id}:{port} (the id field of a preview)
Responses
200400401403404
curl -s -X GET https://api.kosa8.com/v1/previews/$PREVIEW_ID/domains \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Serve the preview at your own hostname#

POST/v1/previews/{preview_id}/domainsscope sandboxes:write

Through Cloudflare for SaaS custom hostnames: 501 not_available when this kosa8 Cloud has not configured it. A preview has at most 5 custom domains, an organization 50. The domain serves the preview as it is, private (signed link) or public, and follows the sandbox and port across a rotate.

Parameters
preview_idrequiredpath · string
A preview's id, {sandbox_id}:{port} (the id field of a preview)
JSON body
hostnamerequiredstring
A name under your own domain; never one under kosa8's or the preview domain
ssl_method"http" | "txt"
How Cloudflare validates the certificate: http (default, once the CNAME points here) or txt
Responses
201400401403404409501502
curl -s -X POST https://api.kosa8.com/v1/previews/$PREVIEW_ID/domains \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

A custom domain's status, asked of Cloudflare again#

GET/v1/previews/{preview_id}/domains/{hostname}scope sandboxes:read
Parameters
preview_idrequiredpath · string
A preview's id, {sandbox_id}:{port} (the id field of a preview)
hostnamerequiredpath · string
The custom domain, such as preview.example.com
Responses
200400401403404
curl -s -X GET https://api.kosa8.com/v1/previews/$PREVIEW_ID/domains/$HOSTNAME \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Stop serving the preview at the hostname#

DELETE/v1/previews/{preview_id}/domains/{hostname}scope sandboxes:write
Parameters
preview_idrequiredpath · string
A preview's id, {sandbox_id}:{port} (the id field of a preview)
hostnamerequiredpath · string
The custom domain, such as preview.example.com
Responses
200400401403404502
curl -s -X DELETE https://api.kosa8.com/v1/previews/$PREVIEW_ID/domains/$HOSTNAME \
  -H "Authorization: Bearer $KOSA8_API_KEY"

The kosa8 weekly

Agent security news, one industry deep-dive and a hands-on challenge, every Monday. Unsubscribe in one click.

© 2026 kosa8 · kosa8.com · AI Agent Sandbox: Secure and Sovereign for Enterprise · Local models served by llamay · Agent gateway: MAQPNA