Skip to main content
Camofox Browser runs as a standalone HTTP server, making it easy to integrate with any language, framework, or agent system. The server exposes a REST API for browser automation with anti-detection fingerprinting.

Installation and startup

Clone the repository and install dependencies:
Start the server:
The server downloads the Camoufox browser engine (~300MB) on first run, then starts on port 9377. Production startup:

Default port

The server listens on port 9377 by default. Change it with the CAMOFOX_PORT environment variable:

Making HTTP requests

All endpoints accept JSON and return JSON responses. Include Content-Type: application/json for POST requests.

curl example

fetch example (JavaScript)

axios example (JavaScript)

Language-specific examples

Node.js

Python

Go

Rust

Authentication patterns

Camofox uses query parameters for user identification:

userId parameter

The userId isolates cookies and storage between users. Each userId gets a separate browser context.
When to use:
  • Multi-tenant applications where users should not share state
  • Testing with different account credentials
  • Isolating agent tasks

API key for cookies

Cookie import requires authentication via the Authorization header:
Setup:
Cookie import is disabled by default. Set CAMOFOX_API_KEY to enable it. Without the key, the server rejects cookie requests with 403 Forbidden.

Client library recommendations

Camofox does not provide official client libraries. Use standard HTTP clients in your language.
Recommended libraries: The REST API is stable and follows standard HTTP conventions. Any HTTP client works.

Integration patterns

Webhook handlers

Use Camofox to scrape data in response to webhook events:

Cron jobs

Schedule periodic scraping tasks:

Agent frameworks

Integrate with LangChain, AutoGPT, or custom agent loops:

Queue workers

Process scraping jobs from a queue:

Monitoring and logging

Camofox outputs structured JSON logs for production observability.

Log format

Every log line is a JSON object:

Fields

  • ts - ISO 8601 timestamp
  • level - Log level (info, error, warn)
  • msg - Message type (req, res, err)
  • reqId - Request ID for correlation
  • method - HTTP method
  • path - Request path
  • userId - User identifier from request
  • status - HTTP status code
  • ms - Request duration in milliseconds

Parsing logs

Use jq to filter and query logs:

Aggregation with log collectors

Forward logs to aggregation services: Datadog:
Logstash:
CloudWatch (AWS):

Health check endpoint

Monitor server health:
Response:
Use this endpoint for:
  • Load balancer health checks
  • Kubernetes liveness/readiness probes
  • Uptime monitoring (Pingdom, UptimeRobot)

Production deployment checklist

Before deploying to production:
1

Set environment variables

2

Configure resource limits

Adjust based on available memory:
3

Set up process manager

Use PM2 or systemd to keep the server running:PM2:
systemd:
4

Configure reverse proxy

Use nginx for HTTPS and rate limiting:
5

Set up monitoring

Monitor health endpoint:
Or use Prometheus:
6

Configure logging

Rotate logs to prevent disk space issues:
7

Test with load

Simulate concurrent requests:
Monitor memory usage:
8

Document API credentials

Store CAMOFOX_API_KEY securely:
  • Use environment variables (not config files)
  • Rotate keys periodically
  • Restrict access to cookie import endpoint

Docker deployment

Build and run the Docker image:
Docker Compose:

Cloud deployment

Fly.io

The included fly.toml configures memory and scaling.

Railway

Connect the GitHub repository to Railway. The included railway.toml auto-configures deployment. Add environment variables in the Railway dashboard:
  • CAMOFOX_API_KEY
  • MAX_SESSIONS
  • MAX_OLD_SPACE_SIZE

AWS ECS

Create a task definition:

DigitalOcean App Platform

Use the web UI to deploy from GitHub. Configure:
  • Environment variables: NODE_ENV, CAMOFOX_API_KEY
  • Build command: npm install
  • Run command: npm start
  • HTTP port: 9377
  • Health check: /health

Performance tuning

Optimize for low memory

Optimize for high throughput

Use proxy for scale

Rotate IPs with a proxy pool:
Camofox automatically sets locale/timezone based on proxy GeoIP.