Skip to main content
Business IntelSource: ZipRecruiterTested: 2026-10-29

Programmatic Job Scraping with Python & ApifyClient: Exporting ZipRecruiter to PostgreSQL

Master programmatic job data extraction using Python, ApifyClient, and PostgreSQL. Build an automated data pipeline with idempotent database upserts and schema migrations.

Published by Scrape Playbook Editorial Team on October 29, 2026 • Updated October 29, 2026
8 min read
Audience: developer
⚡
Verified Cloud Scraper$5 Free Monthly Credits

Extract data from ZipRecruiter right now with ZipRecruiter Scraper - Jobs by Keyword or URL + Employer Leads

Architectural Overview: End-to-End Job Scraping Pipeline with Python & PostgreSQL

Data engineering teams building labor market intelligence platforms, job aggregators, or enterprise HR analytics systems require persistent, structured storage. While ad-hoc CSV downloads are sufficient for one-off analyses, production data products demand an automated, repeatable pipeline that extracts job listings from ZipRecruiter, validates the schema, and streams records into a relational database like PostgreSQL.

By coupling the serverless ZipRecruiter Scraper with Python’s official apify-client and psycopg2, you can decouple scraping infrastructure from data storage. Apify manages anti-bot bypasses, IP rotation, and headless browser sessions in the cloud, while your local or cloud Python worker handles data cleaning, relational mapping, and idempotent database upserts.


Setting Up ApifyClient & Initializing the Cloud Scraper

To begin, install the required Python libraries:

pip install apify-client psycopg2-binary

Authentication is managed via your Apify API token, which can be retrieved from the Apify Console settings. Pass your token through an environment variable (APIFY_TOKEN) to avoid hardcoding secrets.

When launching a scrape run, configure the input dictionary with target role keywords, item limits, and residential proxy options:

run_input = {
    "searchKeyword": "Cloud Architect remote",
    "maxItems": 100,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"]
    }
}

Designing the PostgreSQL Relational Schema for Job Market Data

A well-structured relational schema must enforce uniqueness on job postings while optimizing indexing for high-frequency queries across companies, locations, and salaries. Execute the following DDL statements in your PostgreSQL instance:

CREATE TABLE IF NOT EXISTS ziprecruiter_jobs (
    record_id VARCHAR(64) PRIMARY KEY,
    title VARCHAR(255) NOT NULL,
    company VARCHAR(255),
    location VARCHAR(255),
    job_type VARCHAR(64),
    salary_min NUMERIC(12, 2),
    salary_max NUMERIC(12, 2),
    salary_currency VARCHAR(3) DEFAULT 'USD',
    url TEXT,
    description TEXT,
    published_date TIMESTAMPTZ,
    scraped_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

-- Query performance indexes
CREATE INDEX IF NOT EXISTS idx_jobs_company ON ziprecruiter_jobs(company);
CREATE INDEX IF NOT EXISTS idx_jobs_location ON ziprecruiter_jobs(location);
CREATE INDEX IF NOT EXISTS idx_jobs_salary_min ON ziprecruiter_jobs(salary_min);
CREATE INDEX IF NOT EXISTS idx_jobs_published ON ziprecruiter_jobs(published_date);

The record_id column serves as the primary key, enabling idempotent upsert operations that update existing postings without creating duplicate rows.


Production Python Implementation: Streaming Extraction & Idempotent Upserts

The Python script below executes the cloud scrape, fetches the dataset items, and uses psycopg2.extras.execute_values to perform high-throughput bulk upserts into PostgreSQL:

import os
import psycopg2
from psycopg2.extras import execute_values
from apify_client import ApifyClient

# 1. Initialize Apify Client
client = ApifyClient(os.getenv("APIFY_TOKEN", "YOUR_APIFY_TOKEN"))

# 2. Database Connection Parameters
DB_CONFIG = {
    "dbname": "job_market_db",
    "user": "postgres",
    "password": "your_secure_password",
    "host": "localhost",
    "port": 5432
}

def ingest_ziprecruiter_to_postgres():
    print("Triggering ZipRecruiter Scraper run on Apify Cloud...")
    run_input = {
        "searchKeyword": "DevOps Engineer AWS",
        "maxItems": 100,
        "proxyConfiguration": {
            "useApifyProxy": True,
            "apifyProxyGroups": ["RESIDENTIAL"]
        }
    }
    
    run = client.actor("madeingermany/ziprecruiter-scraper").call(run_input=run_input)
    dataset_id = run["defaultDatasetId"]
    print(f"Run completed successfully. Dataset ID: {dataset_id}")

    # Fetch dataset items
    items = client.dataset(dataset_id).list_items().items
    print(f"Fetched {len(items)} records from Apify Dataset. Preparing SQL bulk upsert...")

    # Prepare records tuple
    rows_to_insert = []
    for item in items:
        rows_to_insert.append((
            item.get("recordId"),
            item.get("title") or "Untitled Position",
            item.get("company"),
            item.get("location"),
            item.get("jobType"),
            item.get("salaryMin"),
            item.get("salaryMax"),
            item.get("salaryCurrency") or "USD",
            item.get("url"),
            item.get("description"),
            item.get("publishedDate")
        ))

    upsert_query = """
    INSERT INTO ziprecruiter_jobs (
        record_id, title, company, location, job_type,
        salary_min, salary_max, salary_currency, url, description, published_date
    ) VALUES %s
    ON CONFLICT (record_id) DO UPDATE SET
        title = EXCLUDED.title,
        company = EXCLUDED.company,
        location = EXCLUDED.location,
        salary_min = EXCLUDED.salary_min,
        salary_max = EXCLUDED.salary_max,
        updated_at = NOW();
    """

    conn = psycopg2.connect(**DB_CONFIG)
    with conn.cursor() as cursor:
        execute_values(cursor, upsert_query, rows_to_insert)
    conn.commit()
    conn.close()

    print(f"Successfully upserted {len(rows_to_insert)} records into PostgreSQL table 'ziprecruiter_jobs'.")

if __name__ == "__main__":
    ingest_ziprecruiter_to_postgres()

Enterprise Orchestration, Rate Limiting & $5 Monthly Starter Tier Economics

When deploying this pipeline to production environments, consider the following best practices:

  1. Scheduled Orchestration: Run the ingestion script via Apache Airflow, Prefect, or Apify’s built-in cron scheduler to ingest daily job differentials.
  2. Batch Chunking: For runs scraping 1,000+ items, fetch records in batches of 250 using offset and limit to prevent memory bottlenecks.
  3. Database Connection Pooling: In serverless environments (e.g., AWS Lambda), utilize a connection pooler like PgBouncer to manage database connections efficiently.

The ZipRecruiter Scraper operates on a transparent Pay-Per-Event billing model:

  • Run Initiation: $0.00005 per execution.
  • Pay-Per-Result: $0.002 per extracted job record.

Apify includes a complimentary $5 free monthly credit on the $0 starter tier for every developer account. This allows you to execute recurring data pipelines and ingest up to 2,500 complete job postings into PostgreSQL every single month completely free. As your data needs grow, scaling to tens of thousands of postings remains cost-effective at just $2.00 per 1,000 records, providing an enterprise-grade data foundation with zero fixed subscription fees.

Expected Output Schema & Sample Records

Below is an authentic sample of data returned by the scraper. Records are formatted into clean JSON or exportable CSV spreadsheets.

Authentic Sample Output Data

ZipRecruiter
recordIdtitlecompanylocationjobTypesalaryMinsalaryMaxsalaryCurrencyurldescriptionpublishedDatescrapedAt
rec_zip_918241Senior Cloud Infrastructure EngineerScale DynamicsAustin, TX (Hybrid)Full-Time145000185000USDhttps://www.ziprecruiter.com/jobs/senior-cloud-infrastructure-engineer-4819aLead multi-region Kubernetes deployments, Terraform infrastructure-as-code pipelines, and AWS cloud security architectures.2026-10-28T09:15:00Z2026-10-29T12:00:00Z
rec_zip_918242Data Analytics & ML Ops LeadVanguard AI LabsRemote - US & CanadaFull-Time, Contract160000210000USDhttps://www.ziprecruiter.com/jobs/data-analytics-ml-ops-lead-5928bArchitect scalable data pipelines, feature stores, and automated model evaluation systems using Python, Snowflake, and PyTorch.2026-10-28T10:45:00Z2026-10-29T12:00:00Z
* Sample values are verified from real test runs. Personal records may be masked or synthetic for privacy.View Live Data Schema →

Required Inputs & Configuration Parameters

Configure only the fields supported by the verified scraper. You can test extractions directly in your browser or run them programmatically via Python, Node.js, or REST API.

Supported Input Parameters

ParameterTypeRequiredDefaultDescription & Example
searchKeywordstringOptionalmarket intelligence

Job title, technical skill, role keyword, or target query on ZipRecruiter

e.g. software engineer remote

startUrlsarrayOptional—

Direct ZipRecruiter search or category filter URLs

e.g. ["https://www.ziprecruiter.com/jobs-search?search=software+engineer&location=remote"]

maxItemsnumberOptional100

Maximum number of job listings to extract

Start Scraping for Free with $5 Monthly Cloud Credits

You don't need a credit card or a paid subscription to extract your data. Every user gets $5 in complimentary cloud credits every month—enough to scrape thousands of verified records without spending a penny.

100% Free Starter Allowance

How Far Your $5 Free Monthly Credits Go

$0.00 to Start (No Card Needed)

Every user receives $5.00 in free cloud credits every month. Because this cloud scraper charges only fractions of a cent per result instead of an expensive monthly software subscription, your free $5 allowance lets you extract thousands of fresh job leads completely free.

Monthly Free Credit

$5.00

Renewed every month for free
Estimated Free Output

~2,499

Full job leads for $0.00
Setup & Proxy Cost

$0.00

Cloud proxies & anti-bot included

Real Projects You Can Run Completely Free

Project GoalTarget VolumeTraditional Scraper CostYour Cost with Free Credits
Initial Test & Column Verification50 job leads$49/mo minimum$0.00 (100% Covered)
Targeted Local Market List500 job leads$99/mo subscription$0.00 (100% Covered)
Full Monthly Workflow Batch1,500+ job leads$199/mo + proxy fees$0.00 (100% Covered)
✓
No Monthly Lock-In: Never get billed recurring monthly fees. You only scrape when you need data.
✓
Zero Proxy Setup: Residential proxy rotation and anti-bot challenges are solved in the cloud automatically.
✓
One-Click Downloads: Instantly export clean data to Excel (.xlsx), CSV, or JSON spreadsheets.
✓
Run in Browser or via API: Test visually in your web browser or connect programmatically using Python or Node.js.

Ready to collect your first dataset?

Launch the pre-built tool now with your $5 free monthly credits. No card required.

Start Scraping for Free

Prerequisites

  • ✓Apify account with active balance ($5 free monthly credits included on $0 starter tier)
  • ✓Python 3.10+ installed with apify-client and psycopg2 or asyncpg
  • ✓Active PostgreSQL 14+ instance with write privileges

Observed Limitations

  • •Network latency when streaming large dataset batches requires pagination or chunking
  • •Database write throughput should use bulk insert/upsert operations (ON CONFLICT DO UPDATE)

Frequently Asked Questions

How do I authenticate with the Apify Python SDK?
Obtain your API token from the Apify Console integrations settings, then initialize the client via ApifyClient(token='YOUR_API_TOKEN') or set the APIFY_TOKEN environment variable.
Does the scraper support automated database upserts?
Yes, every record includes a unique recordId, making it trivial to execute idempotent SQL upserts (INSERT ... ON CONFLICT (record_id) DO UPDATE).
How many records can I ingest into PostgreSQL for free each month?
Under Apify's $5 free monthly credit on the $0 starter tier, you can run multiple scrapes and ingest up to 2,500 complete job records into your PostgreSQL database every month at zero cost.
Ready to collect your data?

Extract Live Data with ZipRecruiter Scraper - Jobs by Keyword or URL + Employer Leads

Extract structured data from ZipRecruiter directly into Excel, CSV, or JSON in minutes. Runs automatically in the cloud with built-in anti-bot bypass and residential proxy rotation. No coding or browser setup required.

100% free to test • $5 free monthly credits included • No credit card required to start

Related Scraping Playbooks

View all guides →
ZipRecruiter Scraper - Jobs by Keyword or URL + Employer LeadsFree Starter Tier • $5 Monthly Credits
Run on Apify