Getting started overview

This guide outlines the initial steps for integrating with ZenRows, focusing on account creation, API key retrieval, and executing a basic web scraping request. ZenRows functions as a proxy and data extraction API designed to manage common challenges in web scraping, such as IP blocking, CAPTCHAs, and dynamic content rendering ZenRows API reference. The service processes your requests by routing them through various proxies and applying anti-bot techniques before returning the target webpage's content.

The core interaction involves making an HTTP GET request to the ZenRows API endpoint, where the target URL and any desired scraping parameters are passed as query string parameters. Your API key, obtained after account registration, authenticates these requests.

Before proceeding, ensure you have a basic understanding of HTTP requests and how to make them using a programming language or command-line tool. Familiarity with parsing HTML or JSON content is also beneficial, depending on the data you intend to extract.

Here's a quick reference table for the getting started process:

Step What to do Where
1. Sign Up Create a ZenRows account to access the dashboard. ZenRows homepage
2. Get API Key Locate your unique API key in the dashboard. ZenRows Dashboard (after login)
3. Construct Request Formulate an HTTP GET request with your API key and target URL. Your preferred development environment
4. Execute Request Send the request to the ZenRows API endpoint. Your preferred development environment
5. Process Response Handle the returned HTML or JSON content. Your preferred development environment

Create an account and get keys

To begin using ZenRows, the first step is to create an account. ZenRows offers a free tier that includes 1,000 requests per month, which is suitable for initial testing and development ZenRows pricing page. Paid plans are available for higher request volumes and additional features, starting at $49 per month for 100,000 requests.

  1. Navigate to the ZenRows website: Open your web browser and go to the ZenRows homepage.
  2. Sign up: Look for a "Sign Up" or "Get Started Free" button. You will typically be prompted to enter your email address and create a password. Some services may offer sign-up via Google or GitHub accounts.
  3. Verify your email (if required): After submitting your registration details, you may receive an email asking you to verify your account. Follow the instructions in the email to complete this step.
  4. Access the dashboard: Once registered and logged in, you will be directed to your ZenRows dashboard.
  5. Locate your API key: Your unique API key is essential for authenticating all your requests to the ZenRows API. This key is usually displayed prominently on the dashboard's main page or within a "Settings" or "API Keys" section. Copy this key and store it securely; it will be used in every API call.

The API key is a string of characters that identifies your account and authorizes your usage. Treat your API key as sensitive information, similar to a password, to prevent unauthorized access to your request quota.

Your first request

After obtaining your API key, you can make your first request to the ZenRows API. The API operates by accepting a target URL and various parameters as part of a standard HTTP GET request. ZenRows then fetches the content of the target URL, applies any requested features (like JavaScript rendering or premium proxies), and returns the processed HTML or JSON content.

The base endpoint for ZenRows API requests is https://api.zenrows.com/v1/get.

Example Request Structure

A typical ZenRows request will include at least two query parameters:

  • url: The URL of the webpage you want to scrape.
  • apikey: Your unique ZenRows API key.

Additional parameters can be added to customize the scraping process, such as js_render=true for rendering JavaScript-heavy pages or premium_proxy=true for using premium proxies ZenRows API documentation.

cURL Example (Command Line)

Using cURL is a straightforward way to test your first API call from the command line:

curl "https://api.zenrows.com/v1/get?url=https%3A%2F%2Fwww.example.com&apikey=YOUR_API_KEY"

Replace YOUR_API_KEY with your actual API key and https%3A%2F%2Fwww.example.com with the URL of the website you wish to scrape (URL-encoded). The %3A%2F%2F represents :// and %2F represents / in URL encoding, which is important for correctly passing URLs as parameters Mozilla's URL encoding explanation.

Python Example

For a programmatic approach, Python's requests library is commonly used:

import requests

api_key = "YOUR_API_KEY"
target_url = "https://www.example.com"

params = {
    "url": target_url,
    "apikey": api_key
}

response = requests.get("https://api.zenrows.com/v1/get", params=params)

if response.status_code == 200:
    print(response.text)
else:
    print(f"Error: {response.status_code} - {response.text}")

Remember to replace YOUR_API_KEY and https://www.example.com with your specific details. This Python script will print the HTML content of the target URL if the request is successful.

Common next steps

Once you have successfully made your first request and received content, consider these next steps to enhance your web scraping capabilities with ZenRows:

  • Explore advanced parameters: ZenRows offers various parameters to control the scraping process. Experiment with options like js_render=true for JavaScript-heavy sites, premium_proxy=true for better bypass rates, proxy_country to specify a proxy location, or autoparse=true to receive a JSON object of parsed data ZenRows API reference documentation.
  • Integrate into your application: Move beyond simple test scripts and integrate ZenRows into your larger application or data pipeline. Consider how you will store, process, and analyze the extracted data.
  • Implement error handling: Production-ready applications should include robust error handling. This involves checking HTTP status codes, handling network issues, and retrying failed requests strategically.
  • Manage request volume: For large-scale scraping, monitor your request usage in the ZenRows dashboard and consider upgrading your plan if you anticipate exceeding your current quota.
  • Parse extracted data: The raw HTML returned by ZenRows often needs to be parsed to extract specific data points. Libraries like Beautiful Soup (Python) or Cheerio (Node.js) are commonly used for this purpose.
  • Review usage statistics: Regularly check your ZenRows dashboard for usage statistics, current plan details, and any notifications regarding your account.

Troubleshooting the first call

Encountering issues during your first API call is not uncommon. Here are some troubleshooting tips for ZenRows requests:

  • Invalid API Key: Double-check that you have copied your API key correctly from your ZenRows dashboard. An incorrect key will typically result in an authentication error (e.g., HTTP 401 Unauthorized).
  • Incorrect URL Encoding: Ensure that the target URL passed in the url parameter is properly URL-encoded. Special characters in URLs (like /, :, ?, &) must be encoded to prevent misinterpretation by the API. Most HTTP client libraries handle this automatically when you pass parameters as a dictionary or object, but if constructing the URL manually, ensure correct encoding URL encoding standards.
  • Missing Parameters: Verify that both the url and apikey parameters are present in your request. Omitting either will lead to an error.
  • Rate Limits: If you are on the free tier or a lower-paid plan, you might hit rate limits, especially if testing rapidly. Check your ZenRows dashboard for current usage and rate limit status.
  • Target Website Issues: Sometimes, the issue might be with the target website itself (e.g., it's down, requires specific headers, or has very aggressive anti-bot measures). Try scraping a different, simpler website (like example.com) to isolate whether the problem is with your ZenRows integration or the target.
  • Network Connectivity: Ensure your development environment has stable internet connectivity.
  • Check ZenRows Status Page: In rare cases, ZenRows itself might be experiencing an outage or maintenance. Check their official status page (often linked from their documentation or dashboard) for any service interruptions.
  • Consult Documentation: The ZenRows documentation provides detailed explanations of parameters, error codes, and common use cases. Refer to it for specific error messages you might receive.

When troubleshooting, it's helpful to print the full API response, including status codes and response headers, as these often contain clues about the nature of the error.