Skip to main content
Get the public URL for accessing a specific port on your sandbox.

Basic Request

curl -X GET https://api.gravixlayer.com/v1/agents/sandboxes/550e8400-e29b-41d4-a716-446655440000/host/8000 \
  -H "Authorization: Bearer YOUR_API_KEY"

Path Parameters

ParameterTypeRequiredDescription
idstringYesSandbox ID (UUID)
portintegerYesPort number (1-65535)

Response

{
  "url": "https://550e8400-e29b-41d4-a716-446655440000-8000.gravixlayer.com"
}

Common Ports

PortServiceUse Case
3000Node.js/ReactWeb development
5000FlaskPython web applications
8000HTTP ServerSimple web servers
8080Alternative HTTPWeb applications
8888JupyterNotebook servers

Example: Access Web Server

Start a web server in your sandbox:
curl -X POST https://api.gravixlayer.com/v1/agents/sandboxes/550e8400-e29b-41d4-a716-446655440000/code/run \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "import http.server\nimport socketserver\nfrom threading import Thread\n\nclass Handler(http.server.SimpleHTTPRequestHandler):\n    def do_GET(self):\n        self.send_response(200)\n        self.send_header(\"Content-type\", \"text/html\")\n        self.end_headers()\n        self.wfile.write(b\"Hello from AgentBox!\")\n\nserver = socketserver.TCPServer((\"\", 8000), Handler)\nThread(target=server.serve_forever, daemon=True).start()\nprint(\"Server started on port 8000\")",
    "language": "python"
  }'
Then get the public URL:
curl -X GET https://api.gravixlayer.com/v1/agents/sandboxes/550e8400-e29b-41d4-a716-446655440000/host/8000 \
  -H "Authorization: Bearer YOUR_API_KEY"

Next Steps