API Reference
Nginjen exposes a REST API on port 9090 (configurable). All endpoints accept and return JSON.
Base URL
http://127.0.0.1:9090OpenAPI Spec
The full OpenAPI 3.1 specification is available at runtime:
bash
curl http://127.0.0.1:9090/openapi.jsonYou can view it in Swagger UI by pasting the spec URL, or use it to generate client libraries.
Endpoint Overview
Public (no auth)
| Method | Endpoint | Description |
|---|---|---|
| GET | /health | Health check |
| GET | /openapi.json | OpenAPI 3.1 spec |
| GET | /ws | WebSocket for session events |
Protected (auth when api_key is set)
| Method | Endpoint | Description |
|---|---|---|
| POST | /scrape | Extract page content |
| POST | /screenshot | Capture screenshot |
| POST | /navigate | Navigate to URL (stateless) |
| POST | /evaluate | Execute JavaScript (stateless) |
| GET | /sessions | List active sessions |
| POST | /sessions | Create new session |
| DELETE | /sessions/{id} | Close a session |
| POST | /sessions/{id}/navigate | Navigate session |
| POST | /sessions/{id}/execute | Execute JS in session |
| GET | /profiles | List fingerprint profiles |
| POST | /profiles | Create custom profile |
| GET | /profiles/{name} | Get profile details |
| DELETE | /profiles/{name} | Delete profile |
| GET | /cookies | List cookie domains |
| GET | /cookies/{domain} | Get cookies for domain |
| POST | /cookies/{domain} | Save cookies |
| DELETE | /cookies/{domain} | Delete cookies |
| POST | /search | Web search |
Response Format
All responses are JSON. Error responses follow this structure:
json
{
"error": "Description of what went wrong",
"code": "ERROR_CODE"
}Rate Limiting
Concurrency is controlled via a semaphore (default: 5 concurrent pages). Requests that exceed the limit queue until a browser page is available.
Configure in config.toml:
toml
[server]
max_concurrent_pages = 10