Docs
Public URLs ›

Create host route

POST/v1/sandboxes/{id}/host

Give a port a public address.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
  4. const route = await sandbox.expose(3000);
Answer201 Created · HostRoute
  1. {
  2. "id": string,
  3. "sandboxId": string,
  4. "port": integer,
  5. "title": string,
  6. "public": boolean,
  7. "hidden": boolean,
  8. "proxyPath": string,
  9. "registered": "true",
  10. "listening": boolean,
  11. … 2 more
  12. }

Route stored.

Path

idrequired
string
e.g. "sbx_0123456789abcdef"

Headers

Authorizationrequired
Bearer key
An API key that may make this call.

Body

portrequired
integer
titlerequired
string
publicrequired
boolean

Returns

201 Route stored. proxyPath reaches this port when proxy is available and something is listening.

HostRoute11 fields
id
string
sandboxId
string
port
integer
title
string
public
boolean
True gives the port a public address, reported as url.
More False keeps it behind proxyPath and your token.
hidden
boolean
proxyPath
string
Path on this API that reaches the port.
More Needs your token.
registered
true
listening
boolean
proxy
availablenot_configured
available while the sandbox is running and its ports can be reached.
url
stringnull
Public address of the port: HTTP and WebSocket only, no token needed, and hard to guess.
More It answers while the sandbox is running. Null when the route is not public or public addresses are off.

Errors and other answers

404 Not found.
409 route_limit_reached. The sandbox already has as many ports registered as it may.

Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.