API Reference
Build against PreviewBox with a simple JSON REST API.
Base URL
Base URL
https://server.previewbox.devAll endpoints return JSON. The service health check at /health is public; everything else requires authentication.
Authentication
Authenticate with either your session token (from the CLI or dashboard) or a scoped API key. Generate API keys in Dashboard → Settings → API Keys.
Bearer token
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://server.previewbox.dev/api/tunnels API key
curl -H "X-API-Key: pb_YOUR_API_KEY" \
https://server.previewbox.dev/api/tunnelsEndpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /health | Service health check |
| POST | /api/auth/register | Create an account |
| POST | /api/auth/login | Sign in |
| GET | /api/tunnels | List your tunnels |
| POST | /api/tunnels | Create a tunnel |
| GET | /api/tunnels/:id | Tunnel details |
| DELETE | /api/tunnels/:id | Delete a tunnel |
| GET | /api/active-tunnels | Currently active tunnels |
| GET | /api/tunnels/:id/stats | Tunnel request statistics |
| GET | /api/tunnels/:id/logs | Tunnel request logs |
| GET | /api/tunnels/:id/uptime | Tunnel uptime history |
| GET | /api/tunnels/:id/alerts | Smart alert rules |
| POST | /api/tunnels/:id/alerts | Create an alert rule |
| GET | /api/tunnels/:id/record | Traffic recording |
| POST | /api/tunnels/:id/replay | Replay a recorded request |
| GET | /api/tunnels/:id/snapshots | Tunnel snapshots |
| GET | /api/tunnels/:id/access-tokens | Tunnel access tokens |
| GET | /api/tunnels/:id/ip-allowlist | IP allowlist |
| PUT | /api/tunnels/:id/basic-auth | Basic auth credentials |
| PUT | /api/tunnels/:id/rate-limit | Rate limit config |
| GET | /api/stats | Platform statistics |
| GET | /api/analytics/endpoints | Endpoint analytics |
| GET | /api/apikeys | List API keys |
| POST | /api/apikeys | Create an API key |
| POST | /api/apikeys/:id/rotate | Rotate an API key |
| GET | /api/webhooks | List webhooks |
| POST | /api/webhooks | Create a webhook |
| POST | /api/webhooks/:id/test | Send a test delivery |
| GET | /api/audit | Audit log |
| GET | /api/export | Export your data |
| GET | /api/usage | Usage quotas |
| GET | /api/teams | Team memberships |
| GET | /api/changelog | Product changelog |
| GET | /api/sse/stats | Real-time stats stream (SSE) |
Many tunnel sub-resources follow the same pattern — see the backend's route list for the full set (throttle, custom-404, metadata, share, snapshots, schedules, OpenAPI and more).
Example
List active tunnels
curl -s -H "Authorization: Bearer YOUR_TOKEN" \
https://server.previewbox.dev/api/tunnels | jq .Want real-time events instead of polling? See webhooks.