Network Options
Customize network requests with custom headers, cookies, authentication, proxy routing, and more.
Full Configuration
{ "network": { "headers": { "X-Custom-Header": "value", "Accept-Language": "en-US,en;q=0.9" }, "cookies": [ { "name": "session", "value": "abc123", "domain": "example.com", "path": "/", "secure": true, "http_only": true, "same_site": "Lax", "expires": 1705600000 } ], "auth": { "type": "basic", "username": "user", "password": "pass" }, "proxy": "http://user:[email protected]:8080", "country": "us", "bypass_csp": false } }
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
headers |
object | — | Custom HTTP headers |
cookies |
array | — | Cookies to set before navigation |
auth |
object | — | HTTP authentication |
proxy |
string | — | HTTP/HTTPS proxy URL |
country |
string | — | Route through specific country |
bypass_csp |
boolean | false |
Bypass Content Security Policy |
Custom Headers
Add custom HTTP headers to all requests:
{ "network": { "headers": { "X-Custom-Header": "my-value", "Accept-Language": "fr-FR,fr;q=0.9" } } }
Common use cases: - Authorization tokens - Accept-Language for localization - Custom API keys - Cache control
Cookies
Set cookies before page load:
{ "network": { "cookies": [ { "name": "auth_token", "value": "eyJhbGciOiJIUzI1NiIs...", "domain": "example.com" } ] } }
Cookie Properties
| Property | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Cookie name |
value |
string | Yes | Cookie value |
domain |
string | Yes | Domain for the cookie |
path |
string | No | Path (default: /) |
secure |
boolean | No | HTTPS only |
http_only |
boolean | No | HTTP only (no JS access) |
same_site |
string | No | Strict, Lax, or None |
expires |
integer | No | Expiration (Unix timestamp) |
Session Authentication
{ "network": { "cookies": [ { "name": "session_id", "value": "abc123xyz", "domain": "app.example.com", "path": "/", "secure": true, "http_only": true } ] } }
HTTP Authentication
Basic Auth
{ "network": { "auth": { "type": "basic", "username": "admin", "password": "secret" } } }
Bearer Token
{ "network": { "auth": { "type": "bearer", "token": "eyJhbGciOiJIUzI1NiIs..." } } }
Proxy Configuration
Route requests through a proxy:
{ "network": { "proxy": "http://proxy.example.com:8080" } }
With authentication:
{ "network": { "proxy": "http://username:[email protected]:8080" } }
Country Routing
Route requests through a specific country for geo-targeted content:
{ "network": { "country": "gb" } }
Available Countries
| Code | Country |
|---|---|
us |
United States |
gb |
United Kingdom |
de |
Germany |
fr |
France |
jp |
Japan |
au |
Australia |
ca |
Canada |
Use this for: - Testing geo-restricted content - Capturing localized pricing - Viewing region-specific layouts
Bypass CSP
Bypass Content Security Policy to inject scripts:
{ "network": { "bypass_csp": true }, "page": { "scripts": ["console.log('Injected despite CSP')"] } }
Note: Use with caution. Only enable when you need to inject scripts on pages with strict CSP.
Common Patterns
Authenticated Dashboard
{ "url": "https://dashboard.example.com", "network": { "cookies": [ { "name": "auth", "value": "token123", "domain": "dashboard.example.com" } ] } }
Staging Environment with Basic Auth
{ "url": "https://staging.example.com", "network": { "auth": { "type": "basic", "username": "staging", "password": "preview123" } } }
UK Pricing Page
{ "url": "https://shop.example.com/pricing", "network": { "country": "gb" }, "browser": { "locale": "en-GB" } }
Examples
Capture Logged-In State
curl -X POST https://api.renderscreenshot.com/v1/screenshot \ -H "Authorization: Bearer rs_live_xxxxx" \ -H "Content-Type: application/json" \ -d '{ "url": "https://app.example.com/dashboard", "network": { "cookies": [ { "name": "session", "value": "user_session_token", "domain": "app.example.com", "secure": true } ] } }' \ --output dashboard.png
API Protected Page
curl -X POST https://api.renderscreenshot.com/v1/screenshot \ -H "Authorization: Bearer rs_live_xxxxx" \ -H "Content-Type: application/json" \ -d '{ "url": "https://api.example.com/docs", "network": { "headers": { "X-API-Key": "your-api-key" } } }' \ --output api-docs.png
See Also
- Browser Options - Locale and timezone
- Authentication - RenderScreenshot API authentication
- Blocking Options - Block requests by URL pattern