Skip to content

Access Sandbox Endpoints

This guide shows how to reach services running inside your sandbox.

Ask the API for a signed endpoint for the port your service listens on. It returns the cluster’s gateway hostname and the headers to send:

Terminal window
curl https://api.nirvanalabs.io/v1/sandboxes/{sandbox_id}/endpoints/{port} \
-H "OPEN-SANDBOX-API-KEY: $NIRVANA_API_KEY"
{
"endpoint": "gw.0123456789ab.nirvanacloud.net",
"headers": {
"OpenSandbox-Ingress-To": "<sandbox_id>-8080-<token>"
}
}

The endpoint is the sandbox cluster’s gateway hostname, shown as gateway_hostname on the sandbox cluster. The headers route the request to the sandbox’s port. Always send the headers the response returns.

Send requests over HTTPS to the returned endpoint, with the returned headers:

Terminal window
curl "https://gw.0123456789ab.nirvanacloud.net/path" \
-H "OpenSandbox-Ingress-To: <value from headers>"

Use endpoint and headers exactly as the API returns them, and don’t build the routing yourself: how the gateway routes requests may change. Every sandbox is created with secure access, so requests without the returned headers are rejected.

An endpoint is valid for a limited time:

  • By default, it expires with the sandbox, or after 1 hour if the sandbox doesn’t expire.
  • Pass ?expires={unix_seconds} to choose the expiry yourself. It must be in the future.
  • An endpoint never lasts more than 24 hours.

When an endpoint expires, request a new one.

Getting 404 or no response? Check that the sandbox is Running, the port number is correct, and the service is listening on that port.

Requests rejected after working before? The endpoint has probably expired. Request a new one.

Can’t connect from your network? Allow outbound HTTPS to the cluster’s gateway_hostname.