Skip to main content

EnrichedNow Python library

CI

The official Python library for the EnrichedNow API: run scrapers and formulas, read their records and rows, and query the job-postings datasets.

  • Sync and async clients with the same surface
  • Typed models and typed errors; ships py.typed
  • Automatic pagination, retries with backoff, and waiting for a run to end
  • One runtime dependency: httpx
  • Python 3.9+

Install

pip install enrichednow

Quickstart

Create an API key in the console under API keys and put it in the environment:

export ENRICHEDNOW_API_KEY="en_live_..."
from enrichednow import EnrichedNow

client = EnrichedNow()  # reads ENRICHEDNOW_API_KEY

result = client.scrape("ats.board", {"board_url": "https://boards.greenhouse.io/acme"})

print(result.run.status, result.run.record_count)
for record in result.records:
    print(record["title"])

scrape starts a run, waits for it to end and hands back the run with its records. Records are fetched page by page as you iterate.

The client

from enrichednow import EnrichedNow

client = EnrichedNow(
    api_key="en_live_...",                    # default: the ENRICHEDNOW_API_KEY environment variable
    base_url="https://api.enrichednow.com",   # default
    timeout=30.0,                             # seconds for one HTTP request (or an httpx.Timeout)
    max_retries=2,                            # see "Retries"
)

Without a key, the constructor raises MissingAPIKeyError. Keep the key out of your code.

The client holds a connection pool. Use it as a context manager, or call client.close(), when you are done:

with EnrichedNow() as client:
    print(client.health().status)  # "ok"

To bring your own httpx.Client (custom transport or TLS settings), pass http_client=.... The library does not close a client it did not create.

Scrapers

for scraper in client.scrapers.list():          # the catalogue
    print(scraper.id, scraper.title, scraper.unit_cost, "units a", scraper.billing_unit)

scraper = client.scrapers.get("ats.board")      # with JSON Schemas
print(scraper.input_schema)                     # what goes in `input`
print(scraper.record_schema)                    # the shape of one record

Start a run

run = client.scrapers.run("careers.company", {"domain": "acme.com"})
print(run.id, run.status)                       # "queued"

wait (0 to 60 seconds) asks the API to hold the request open until the run ends or the time is up. Either way you get the run as it is at that moment, so treat queued and running as ordinary answers:

run = client.scrapers.run("careers.company", {"domain": "acme.com"}, wait=60)
if run.is_active:
    run = client.runs.wait(run.id)

The HTTP timeout of that one request is raised to wait + 30 seconds when yours is shorter.

Runs

run = client.runs.get("run_...")                # the run as it is now
run = client.runs.wait("run_...", timeout=600, poll_interval=2)   # poll until it has ended
run = client.runs.cancel("run_...")             # ask it to stop

for run in client.runs.list(scraper_id="ats.board", status="ok"):
    print(run.id, run.created_at, run.record_count)

unit_cost is what the scraper costs: units_per_request for one billed per request, units_per_record (each record) for one billed per record.

A Run has id, scraper_id, scraper_version, status, reason, input, record_count, units, units_per_request and units_per_record (its rate, fixed when it started), diagnostics, created_at, started_at and finished_at, plus a few helpers:

run.is_active queued or running
run.is_terminal the run has ended, however it ended
run.succeeded ended ok or partial
run.failed ended failed, unsupported or cancelled
run.raise_for_status() raises RunFailedError when run.failed; otherwise returns the run

runs.wait returns the run however it ended and raises WaitTimeoutError if it is still going after timeout seconds. The run itself carries on; the error has it on .run.

Cancelling is cooperative: a run that was already finishing may still complete. Read the status it ended with.

Records

for record in client.runs.records(run.id):      # every record, page after page
    ...

Records are plain dicts in the shape of the scraper's record_schema. They are kept for 7 days after the run ended; after that the list is empty and page.expired is True.

CSV and NDJSON, written by the API

with open("jobs.csv", "wb") as out:
    for chunk in client.runs.export_all(run.id, "csv"):  # every page; the header row once
        out.write(chunk)

page = client.runs.export(run.id, "ndjson", limit=500)  # one page: page.content, page.next_cursor, page.expired

The CSV has a column for each field of the scraper's record schema, in its order, so every page of every run of a scraper has the same columns; a nested object becomes parent.child columns, a list one cell of JSON, and a cell a spreadsheet would run as a formula starts with an apostrophe.

Files

A scraper that makes a file (a screenshot) puts its address in the record. client.runs.file(run.id, "screenshot.png") returns its bytes, read with your key.

Waiting longer in one call

wait holds a request open until the run ends, up to 300 seconds, on starting a run and on reading one: client.scrapers.run(..., wait=120), client.runs.get(run.id, wait=120). runs.list also takes api_key_id, from_ and to.

The one-liner

result = client.scrape(
    "ats.board",
    {"board_url": "https://boards.greenhouse.io/acme"},
    timeout=600,             # give up waiting after this many seconds (None: wait as long as it takes)
    poll_interval=2,
    raise_on_failure=True,
)
result.run        # the Run, ended
result.records    # iterable of records; `for record in result` works too

A run that ends failed, unsupported or cancelled raises RunFailedError with .status, .reason and .run. Pass raise_on_failure=False to get the result instead. A run that ends partial is returned: it has records, and result.run.reason says why it is not complete.

from enrichednow import RunFailedError

try:
    result = client.scrape("careers.company", {"domain": "acme.com"})
except RunFailedError as error:
    print(error.status, error.reason, error.run.id)

Formulas

A formula is a ready-made workflow: answer a few questions, get back a finished, deduplicated list of rows (companies hiring for your roles, local businesses with their contact pages, accounts flagged as hiring, …). A run of one never spends more than its unit cap, and counts as one run in progress whatever it does inside.

from enrichednow import EnrichedNow
from enrichednow.formula_params import JobOrderHunterParams

client = EnrichedNow()

params: JobOrderHunterParams = {"job_titles": ["Java Developer"], "locations": ["London"]}
result = client.run_formula("job-order-hunter", params, unit_cap=2000)

print(result.run.status, result.run.rows_total, result.run.units_spent)
for row in result:                     # every row, best first; pages are fetched as you go
    print(row.score, row.data["company_name"], row.data["job_title"])

run_formula starts the run, waits for it to end and returns it with its rows, as scrape does for a scraper. A run that ends partial is returned (it has rows; result.run.reasons says what is missing, such as contact columns left empty until a provider is connected); one that ends failed, unsupported or cancelled raises FormulaRunFailedError unless raise_on_failure=False.

enrichednow.formula_params has each formula's parameters as a TypedDict, so a type checker and your editor know its keys, values and defaults. A plain dict works for any formula, including one added after this version of the library.

The catalogue, and what a run would cost

for formula in client.formulas.list(query="companies hiring Java developers in London"):   # best first
    print(formula.id, formula.title, formula.available)

formula = client.formulas.get("job-order-hunter")                # its parameters' JSON Schema, presets, columns, samples
answer = client.formulas.estimate("job-order-hunter", params, unit_cap=2000)   # free
if answer.valid:
    print(answer.estimate.expected_units, answer.estimate.max_units)
else:
    print(answer.errors)                                          # [FieldProblem(path="params.job_titles", ...)]

Both the catalogue and estimates are free. Parameters that cannot run are not an error for estimate: valid is false and errors says what to change.

Runs and their rows

run = client.formulas.run("job-order-hunter", params, preview=True)   # at most 10 rows and 50 units
run = client.formula_runs.wait(run.id)                                  # however it ended
for row in client.formula_runs.rows(run.id, fields=["company_name", "contact_email"], min_score=50):
    print(row.data)
for company in client.formula_runs.rows(run.id, view="company"):        # one row per company
    print(company.data["company_name"], company.data["job_title"])     # a list: one for each of its rows
client.formula_runs.cancel(run.id)

formulas.run takes unit_cap (the most it may spend: it stops there and ends partial), row_cap, wait (0 to 300 seconds held by the API) and idempotency_key; like a scraper run it always carries an Idempotency-Key, so a retry never starts a second run. Each look formula_runs.wait takes asks the API to hold the request for up to a minute, so a run is seen the moment it ends. Rows are kept 90 days.

As a file, written by the API (a CSV has the formula's columns in its order, and its header row once):

result.download("java-london.csv")                                   # or .ndjson
with open("rows.csv", "wb") as out:
    for chunk in client.formula_runs.export_all(run.id, "csv", view="company"):
        out.write(chunk)

Saved formulas

A saved formula keeps a formula with its parameters under a name, to run again by hand or on a schedule. Its runs deliver only rows it has not delivered before, so its rows since a time are exactly what is new.

saved = client.saved_formulas.create(
    "job-order-hunter", params,
    schedule={"cadence": "weekdays", "local_time": "07:30", "timezone": "Europe/London"},
    notify="digest",                     # "each_run" (the default), "digest" or "none": mail when a run finds new rows
    monthly_unit_cap=20000,
)

since = datetime.now(timezone.utc) - timedelta(days=1)
for row in client.saved_formulas.rows(saved.id, since=since):     # what a daily job polls: what is new
    print(row.data)

client.saved_formulas.run(saved.id, wait=60)          # now, by hand; include_seen=True delivers old rows too
client.saved_formulas.update(saved.id, schedule=None) # None removes the schedule (and the monthly cap; or name=None
                                                       # goes back to a name made from the parameters)
client.saved_formulas.pause(saved.id)
client.saved_formulas.resume(saved.id)
client.saved_formulas.reset_seen(saved.id)            # owners and admins: deliver everything again
copy = client.saved_formulas.duplicate(saved.id, copy_seen=True)
client.saved_formulas.archive(saved.id)
client.saved_formulas.limits()                        # schedules the plan allows, the shortest cadence, …
client.saved_formulas.snapshots(saved.id, entity_key="https://shop.example/item/1")   # a watch formula's history

Cadences are hourly, daily, weekdays, weekly (day_of_week, 0 is Monday) and monthly (day_of_month), as the formula and the plan allow (formula.schedules, client.saved_formulas.limits()).

The suppression list

Companies (by domain or by name) and addresses that every formula run leaves out, before any paid step, and never sends anywhere:

client.suppressions.add([("domain", "existing-client.example"), ("email", "someone@example.com"),
                         ("company_name", "Initech, Inc.")])
client.suppressions.upload(pathlib.Path("do-not-contact.csv"))   # bytes, text or a binary file work too
for entry in client.suppressions.list(kind="domain"):
    print(entry.value)
client.suppressions.delete("domain", "existing-client.example")

Row feedback, and the terms

client.formula_rows.feedback(row.id, "wrong_company", correct_domain="the-real-company.example")
for terms in client.attestations.list():
    print(terms.kind, terms.accepted)

wrong_company also corrects the match for the account's later runs. A formula that returns people (formula.needs_attestation) runs once an owner or an admin has accepted its terms in the console; until then starting it raises AttestationRequiredError.

Webhooks

Instead of polling, have a URL of yours told when a run ends. An endpoint is an https URL and the events it wants: run.succeeded (the status ok), run.partial, run.failed, run.unsupported, run.cancelled.

endpoint = client.webhooks.create(
    "https://example.com/hooks/enrichednow",
    ["run.succeeded", "run.partial", "run.failed"],
    description="production",
)
print(endpoint.id, endpoint.secret)             # the signing secret (whsec_...) is shown only here: store it
client.webhooks.list()                          # .endpoints (iterable) and .run_secret_set
client.webhooks.get("whk_...")
client.webhooks.update("whk_...", enabled=False)                # any of url, events, description, enabled
client.webhooks.rotate_secret("whk_...").secret                 # a new secret; the old one stops at once
client.webhooks.delete("whk_...")

for delivery in client.webhooks.deliveries.list(status="failed"):   # the delivery log, newest first
    print(delivery.id, delivery.event, delivery.attempts, delivery.error)
client.webhooks.deliveries.resend("whd_...")                    # send one again

Verify a request

Anybody who learns your URL can post to it, so check the signature before you act on a request. verify_webhook needs no client and makes no request. Give it the body exactly as it arrived, as raw bytes, before any JSON parsing:

import os

from flask import Flask, request

from enrichednow import WebhookVerificationError, parse_webhook

app = Flask(__name__)
SECRET = os.environ["ENRICHEDNOW_WEBHOOK_SECRET"]


@app.post("/hooks/enrichednow")
def run_ended():
    try:
        event = parse_webhook(
            SECRET,
            request.headers.get("X-Webhook-Timestamp", ""),
            request.get_data(),                                 # the raw bytes
            request.headers.get("X-Webhook-Signature", ""),
        )
    except WebhookVerificationError:
        return "", 400
    print(event.id, event.type, event.run.id, event.run.record_count)
    return "", 204

parse_webhook returns a WebhookEvent (id, type, created_at, run) and raises WebhookVerificationError for a request that does not verify. verify_webhook(secret, timestamp, body, signature) takes the same arguments and returns True or False. Both compare in constant time and refuse a timestamp more than 5 minutes from now (tolerance_s=300).

An event can arrive more than once, and is sent again when you resend a delivery; event.id is the same every time, so use it to ignore a repeat. Answer with a 2xx quickly and do the work afterwards.

A webhook for one run

client.webhooks.create_run_secret().secret      # once for the account; shown only here
run = client.scrapers.run("careers.company", {"domain": "acme.com"}, webhook_url="https://example.com/hooks/run-done")

webhook_url is told when that run ends, whichever way it ends, beside your endpoints. client.scrape() takes it too. What is sent there is signed with the account's run secret; verify it the same way.

Usage

from datetime import date

usage = client.usage.get()                      # this calendar month (UTC), by day
print(usage.total_units, "of", usage.allowance_units)

usage = client.usage.get(from_=date(2026, 11, 1), to="2026-11-18", group_by="scraper")
for row in usage.rows:
    print(row.key, row.units, row.runs)

client.usage.get(product="data")                # the data allowance and its usage

group_by is day, scraper or product. The period's first day is from_ here (from in the API, a reserved word in Python); the same goes for usage.period.from_. usage.unmetered is True for an account with no unit limit.

Where the account stands

Every answer about runs carries the account's units and runs in progress in its headers. The client keeps the last one it saw, and usage.standing() asks for it:

standing = client.usage.standing()
print(standing.units_remaining, standing.units_topup, standing.units_reset, standing.runs_remaining)
print(standing.units_available)                 # what is left of the allowance, and the top-up units

client.scrapers.run("ats.board", {...})
client.standing                                 # as that answer said it, without another call

Datasets

The datasets reads live under client.data. Each record returned costs one data unit, so stop iterating when you have what you need.

# Search postings
for posting in client.data.postings.list(title="software engineer", country="DE", status="open", limit=200):
    print(posting.title_clean, posting.company.name, posting.location.city, posting.url)

# One posting, with its description and history
posting = client.data.postings.get("...")
print(posting.description, posting.history.events)

# Companies
for company in client.data.companies.list(q="acme", ats="greenhouse"):
    print(company.domain, company.postings.open)

company = client.data.companies.get("acme.com")
for posting in client.data.companies.postings("acme.com", status="open"):
    ...

Posting filters: company_domain, title, location, country, remote, employment_type, seniority, function, status, source, provenance, unmatched, posted_from, posted_to, first_seen_from, first_seen_to, last_seen_from, last_seen_to, sort. Dates and times can be date / datetime objects or ISO 8601 strings; provenance can be a string or a list (["feed", "page"]).

To follow what is new, ask for what changed since you last asked:

new = client.data.postings.list(first_seen_from=last_checked)
seen = client.data.postings.list(sort="last_seen_at", last_seen_from=last_checked)

Two fields are renamed because the models keep the original JSON on .raw: the API's location.raw and salary.raw are location.raw_text and salary.raw_text.

Pagination

Every list returns a page. Iterating it yields its items and then those of every later page, fetching each page as it is reached:

for run in client.runs.list(limit=100):         # `limit` is the size of a page
    ...

everything = client.runs.records(run_id, limit=1000).to_list()

For one page at a time:

page = client.runs.records(run_id, limit=500)
page.items                # this page's records
page.next_cursor          # None on the last page
page.has_next_page()
page = page.next_page()   # None on the last page

for page in client.data.postings.list(status="open").iter_pages():
    save(page.items)

To resume later, keep page.next_cursor and pass it back as cursor= with the same other arguments. A cursor is an opaque string; pass it back unchanged.

Errors

Two different things can go wrong, and they are reported differently:

  • The request failed: the API answered 4xx or 5xx, or did not answer. The library raises.
  • The scrape failed: the request was fine, and the run ended failed or unsupported. runs.get and runs.wait return that run; scrape() and run.raise_for_status() raise RunFailedError.
EnrichedNowError
├── MissingAPIKeyError
├── APIConnectionError              the request never got an answer
│   └── APITimeoutError
├── APIError                        the API answered with an error
│   ├── AuthenticationError         401 unauthorized
│   │   └── PermissionDeniedError   403 forbidden
│   │       └── PlanLimitReachedError       403 plan_limit_reached: the plan allows no more schedules, or not this cadence
│   ├── NotFoundError               404 not_found, formula_not_found
│   ├── ConflictError               409 idempotency_conflict
│   │   ├── AttestationRequiredError        409 attestation_required: the formula's terms are not accepted yet
│   │   ├── FormulaUnavailableError         409 formula_unavailable: the formula cannot be run now
│   │   ├── RequirementMissingError         409 requirement_missing: it needs something the account lacks (.missing)
│   │   └── SavedFormulaArchivedError       409 saved_formula_archived: duplicate it to use it again
│   ├── RateLimitError              429 too_many_runs, rate_limited
│   ├── ValidationError             422 invalid_input, unit_cap_too_low (.min_unit_cap), and any other 4xx
│   │   └── QuotaExceededError      402 quota_exceeded
│   │       └── LimitReachedError   402 limit_reached: the account's, the key's or a saved formula's own spend limit
│   └── ServerError                 5xx internal, data_unavailable
├── RunFailedError                  a run ended failed, unsupported or cancelled
│   └── FormulaRunFailedError       a formula run did (run_formula)
├── WaitTimeoutError                a run did not end within the time given
└── WebhookVerificationError        a webhook request did not verify (parse_webhook)

An APIError carries what the API said:

import enrichednow

try:
    client.scrapers.run("ats.board", {"board": "acme"})
except enrichednow.LimitReachedError as error:          # before QuotaExceededError: it is one
    print(error.scope, error.limit_units, error.used_units)   # "account" or "key"; raise the limit in the console
except enrichednow.QuotaExceededError as error:
    print(error.used_units, error.allowance_units)
except enrichednow.ValidationError as error:
    print(error.status_code)    # 422
    print(error.code)           # "invalid_input"  <- match on this
    print(error.message)        # a sentence for a person
    print(error.fields)         # [{"path": "input.board_url", "message": "Field required"}, ...]
except enrichednow.RateLimitError as error:
    print(error.code)           # "too_many_runs" or "rate_limited"
    print(error.active_runs, error.max_concurrent_runs, error.retry_after)
except enrichednow.APIError as error:
    print(error.status_code, error.code, error.message, error.details, error.request_id)
Attribute
status_code The HTTP status.
code The API's stable error code.
message A sentence for a person. Show it or log it; do not parse it.
details Always a dict. fields for invalid_input; used_units and allowance_units for quota_exceeded (and topup_units and units_needed when starting a run was refused); scope, limit_units, used_units, units_needed (and key_id for a key) for limit_reached; active_runs and max_concurrent_runs for too_many_runs.
reason details["reason"] when the API gives one, such as email_not_verified on a 403.
request_id The request id, when the answer has one; otherwise None.
body, response The parsed body and the httpx.Response.

Retries

A request that fails in a way worth retrying is sent again, up to max_retries times (default 2), with exponential backoff and jitter: about half a second, then a second, then two, up to eight.

Failure Retried
The connection failed or the request timed out Yes
429 Yes, after the seconds in Retry-After when the answer has it
5xx Yes
Any other 4xx No: the same request would get the same answer

A Retry-After longer than 60 seconds is not waited for: the RateLimitError is raised, with the wait on .retry_after.

Starting a run is safe to repeat too. scrapers.run() and scrape() send an Idempotency-Key with the request, a new one for each call, so a retry after a timeout or a 5xx gets the run the first attempt started and never a second one. To make a call of your own repeatable (a job that may be restarted, say), pass your own key: client.scrape("ats.board", input, idempotency_key="import-2026-11-19-acme"). For 24 hours the same key with the same request gives the same run; the same key with a different request raises ConflictError.

webhooks.create() and webhooks.deliveries.resend() are the exception: they are sent again only when the API cannot have acted (the connection was never made, or the answer was 429), because a repeat would add a second endpoint, or queue the delivery twice.

client = EnrichedNow(max_retries=0)   # never retry
client = EnrichedNow(max_retries=5)

Async

AsyncEnrichedNow has the same resources, methods and arguments. Every call is awaited; lists are iterated with async for.

import asyncio
from enrichednow import AsyncEnrichedNow


async def main() -> None:
    async with AsyncEnrichedNow() as client:
        result = await client.scrape("ats.board", {"board_url": "https://boards.greenhouse.io/acme"})
        async for record in result.records:
            print(record["title"])

        run = await client.scrapers.run("careers.company", {"domain": "acme.com"}, wait=60)
        run = await client.runs.wait(run.id)

        async for posting in client.data.postings.list(status="open"):   # every item, page after page
            ...

        page = await client.runs.list(limit=50)                           # or one page
        page = await page.next_page()

        records = await client.runs.records(run.id).to_list()


asyncio.run(main())

Models

Responses are frozen dataclasses with type hints. Timestamps are datetime objects (UTC), days are date objects. Every model keeps the JSON it came from on .raw (also .to_dict()), so a field the API adds later is there before this library knows its name, and never breaks parsing.

run = client.runs.get("run_...")
run.finished_at                 # datetime
run.diagnostics.facts           # dict
run.raw                         # the JSON object, as returned

Development

pip install -e ".[dev]"
pytest               # the tests
mypy                 # the strict type check
python -m build      # the wheel and the source distribution, into dist/ (pip install build)

The tests run against a mocked transport and make no network calls.

Licence

MIT. See LICENSE. To report a security problem, see SECURITY.md.

Metadata

Release files for enrichednow 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for enrichednow 0.4.0
File Size Uploaded Provenance Actions
enrichednow-0.4.0.tar.gz 142.8 kB Without provenance Details for enrichednow-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for enrichednow 0.4.0
File Interpreter ABI Platform Actions
enrichednow-0.4.0-py3-none-any.whl Python 3 none any Details for enrichednow-0.4.0-py3-none-any.whl

Total release size: 244.3 kB

Release files / enrichednow-0.4.0.tar.gz

Download URL enrichednow-0.4.0.tar.gz
Size 142.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1f1c2d46bcd452c83f8e7ef9925b8eaa0c66abb4b077a476a8bbfe9c5daa1f13
BLAKE2b-256 checksum
How to use checksums
608264f63a808276825d85ba4a8e20972c2ce8cd5223b6c01abd400472feeaff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / enrichednow-0.4.0-py3-none-any.whl

Download URL enrichednow-0.4.0-py3-none-any.whl
Size 101.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8035d7c0a2e3ac1dc16c91cdd795456c305b0f267d3c3232c44d02338b0ccdff
BLAKE2b-256 checksum
How to use checksums
d94031d8fb8f8d9ec2448950ac35873df1deb8e219f814a0684c5d75fee28515
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for enrichednow 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page