Skip to main content
Web services give you a public HTTPS URL for an HTTP server running inside a runtime — a FastAPI app, Streamlit UI, Jupyter, or API docs — without tunnels or local port forwarding. Each runtime + port gets its own hostname on *.service.gravixlayer.ai. Open it in a browser, call it from code or CI, or share a short-lived link with a teammate.
The guest process must already be listening on the port. Opening a web service only publishes a route — it does not start your server.

When to use it

Defaults and access model

Private (default)
  • Programmatic clients send X-Gravix-Web-Service-Token: <token>.
  • Browsers use browser_url, which hits /_ws/auth once and sets an auth cookie for later page loads and API calls from that origin.
  • Auth headers and cookies are stripped before traffic is proxied into the guest — your app never sees the Gravix service token.
Public (is_public=true / --public)
  • No token required. Anyone with the URL can reach the guest port until expiry or revoke.
  • Use only for intentionally open demos. Prefer private for APIs and anything with data.
The runtime must be running. Expired services are removed automatically; call open again (or rotate) for a fresh link.

Quick start: FastAPI

Start a small API in the runtime, open a private web service, then create and list items. Guest egress is deny-by-default, so the examples create a temporary allow_all network policy so pip install can reach PyPI. Prefer a narrower allowlist in production.
For production, replace allow_all with an allowlist that includes only the hosts you need (for example pypi.org and files.pythonhosted.org). See Network Policies.

Open a service

Call the service

The SDK handle adds the token header for private services automatically:

List and revoke

From the UI

On the runtime detail page, open the Web Service section, enter a guest port, and open or copy the link. Private links use the same token/cookie model as the API. After expiry, open again for a fresh URL.

Security best practices

  1. Keep private by default — only use --public / is_public=True for deliberate demos.
  2. Treat tokens like secrets — store them in CI secrets; never commit them; prefer browser_url for humans so the token is not left in shared chat after auth.
  3. Short TTLs — use the smallest expires_in_seconds that fits the session; revoke when done.
  4. Rotate when leakedrotate_token=True / --rotate-token invalidates the previous token and browser cookies.
  5. Bind guest servers carefully — listen on 0.0.0.0 only if you intend edge access; do not expose admin UIs without auth inside the app.
  6. Egress is separate — web services are inbound HTTPS to the guest. Outbound calls from the guest still follow Network Policies.
A public web service URL is reachable by anyone who has it until it expires or you revoke it. Private tokens grant the same reachability for the TTL — share them only with intended clients.

Troubleshoot

Next

Network Policies

Control outbound destinations from the sandbox

Run commands

Start servers and install packages inside the runtime

Create Runtime

Create a sandbox to host your HTTP app

Identity Providers

Inject credentials your guest app needs