Session ID

Use the same IP for each API Request by using&session_id=12345. ZenRows will maintain a session for each ID for 10 minutes.

You will need to keep track of them on your side by storing each Session ID so you can reuse them.

# pip install zenrows
from zenrows import ZenRowsClient

client = ZenRowsClient("YOUR_ZENROWS_API_KEY")
url = "https://httpbin.io/anything"
params = {
    "session_id": 12345
}

response = client.get(url, params=params)

print(response.text)

Original HTTP Code

ZenRows API returns HTTP Codes depending on the result of the request. If you want to return the status code provided by the website, enable &original_status=true.

# pip install zenrows
from zenrows import ZenRowsClient

client = ZenRowsClient("YOUR_ZENROWS_API_KEY")
url = "https://httpbin.io/anything"
params = {
    "original_status": "true"
}

response = client.get(url, params=params)

print(response.text)

CAPTCHA Solver

This feature is deprecated, please use JS Instructions’ solve_captcha.

ZenRows already bypasses CAPTCHAs that get in your way to prevent you from accessing web pages. But you can integrate a paid solver (2Captcha) if you encounter an in-page CAPTCHA, like for submitting a form. You will need to add your solver’s API Key on the integrations section.

Add &resolve_captcha=true to the request for this feature.

Requires javascript rendering (&js_render=true).

# pip install zenrows
from zenrows import ZenRowsClient

client = ZenRowsClient("YOUR_ZENROWS_API_KEY")
url = "https://httpbin.io/anything"
params = {
    "js_render": "true",
    "resolve_captcha": "true"
}

response = client.get(url, params=params)

print(response.text)

POST / PUT Requests

Send POST / PUT requests as usual with your chosen language. ZenRows will transparently forward the data to the target site.

The return value will be the original response’s content. Headers and cookies will also be part of the response. The way to access them will depend on the manner of calling.

# pip install zenrows
from zenrows import ZenRowsClient

client = ZenRowsClient("YOUR_ZENROWS_API_KEY")
url = "https://httpbin.io/anything"
data = {
	"key1": "value1",
	"key2": "value2",
}

response = client.post(url, data=data)

print(response.text)

Credits Usage

Check credits consumption programmatically by calling the endpoint /usage. Usage calls will not count for concurrency, and results are available in real-time.

# pip install requests
import requests

response = requests.get('https://api.zenrows.com/v1/usage?apikey=YOUR_ZENROWS_API_KEY')
print(response.text)