Installation and startup
Clone the repository and install dependencies:Default port
The server listens on port 9377 by default. Change it with theCAMOFOX_PORT environment variable:
Making HTTP requests
All endpoints accept JSON and return JSON responses. IncludeContent-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
TheuserId isolates cookies and storage between users. Each userId gets a separate browser context.
- 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 theAuthorization header:
Client library recommendations
Camofox does not provide official client libraries. Use standard HTTP clients in your language.
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 timestamplevel- Log level (info,error,warn)msg- Message type (req,res,err)reqId- Request ID for correlationmethod- HTTP methodpath- Request pathuserId- User identifier from requeststatus- HTTP status codems- Request duration in milliseconds
Parsing logs
Usejq to filter and query logs:
Aggregation with log collectors
Forward logs to aggregation services: Datadog:Health check endpoint
Monitor server health:- 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:Cloud deployment
Fly.io
fly.toml configures memory and scaling.
Railway
Connect the GitHub repository to Railway. The includedrailway.toml auto-configures deployment.
Add environment variables in the Railway dashboard:
CAMOFOX_API_KEYMAX_SESSIONSMAX_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