Skip to main content

Installation & Setup

Get started with ClearProxy in your Node.js project.
1

Installation

Install the package via npm:
2

Initialization

Initialize the client using your API key.

Validating Proxies

The check() method is the core of the SDK, allowing you to validate proxy lists with various configurations.

client.check(file, options)

Parameters:
  • file (string) - Path to your proxy list file.
  • options (object) - Configuration for the checking job.

Configuration Options

Basic Example


Real-Time Progress Tracking

Real-time feedback via WebSockets, allowing you to track progress as it happens instead of waiting for the entire job to finish.

Implementation

To enable real-time tracking, provide an onProgress callback in the check() options.

Job ID Management

You can optionally provide a jobId to identify the socket connection. If omitted while using onProgress, the SDK automatically generates one.
WebSocket Logic: The SDK manages the WebSocket lifecycle automatically—opening it when the check starts and closing it upon completion or failure.

Advanced Validation (Custom URLs)

Verify if your proxies can access specific websites with custom status code and content requirements.

Usage

Helper Methods

The SDK provides utilities to process custom validation results easily.

client.getCustomUrlSummary(result)

Get an aggregated summary of all tested URLs.

client.filterByCustomUrl(result, url)

Extract a list of proxies that specifically passed for a given URL.

Utility Methods

Exporting Results

Convert your validated proxy lists into different formats.

client.export(proxies, format, auth)

  • format: txt, json, or csv
  • auth: boolean (include user:pass if available)

Account & API Info


Response Structure

Standard Response

Custom URL Response

When customUrls are provided, the custom_url_validation field is populated.

Error Handling


Complete Example

This example demonstrates a full workflow: initialization, checking with real-time progress, using custom validation, and saving results.