Skip to content

Expose a port

View .md
POST

Give a port inside the sandbox an HTTPS URL, to reach a web server or API you started in it. The service must listen on 0.0.0.0. A sandbox exposes at most 20 ports.

Authorization

  • Authorizationheaderrequired

    Bearer YOUR_API_KEY. Create a key in the dashboard.

Path parameters

  • sandboxIdstringrequired

    Sandbox ID.

Body

application/json

  • portintegerrequired

    Port your service listens on inside the machine.

    Limitsmin 1 · max 65535
  • publicboolean

    false returns a URL with an access token in its query string: anyone holding the full URL can open it, so treat it as a secret. Opened in a browser, the token moves into a cookie for that host and leaves the address bar, so the page's own links, assets and WebSockets work. Other clients send it as ?_token= on every request. true returns a URL anyone can open. Calling again with a different value changes it for the same URL.

    Defaultfalse

Responses

200The URL.
  • portobjectrequired
    3 properties
    • portintegerrequired
    • urlstring<uri>required

      HTTPS URL on zavu.run that reaches the port, WebSockets included. Calling this again for the same port returns the same URL. It keeps working across a stop and resume; while the sandbox is stopped it answers 503, and once the sandbox is deleted it answers 404.

    • publicbooleanrequired
400Invalid port.
  • codestringrequired
  • messagestringrequired
  • detailsobject
401Unauthorized.
  • codestringrequired
  • messagestringrequired
  • detailsobject
404Sandbox not found, or it belongs to another project.
  • codestringrequired
  • messagestringrequired
  • detailsobject
409`sandbox_not_running`: the sandbox is stopped, stopping, failed or deleted; resume it first. `sandbox_not_ready`: it is still starting and did not become ready in time; retry. `port_limit_reached`: it already exposes 20 ports.
  • codestringrequired
  • messagestringrequired
  • detailsobject
503`sandbox_unavailable`: ports cannot be exposed right now; retry shortly.
  • codestringrequired
  • messagestringrequired
  • detailsobject