Skrap.ai Python SDK
The official Python library for the Skrap.ai API. Use it to verify email addresses, find work emails, search a company domain, search leads and companies, enrich people and companies, run bulk jobs, manage lists, read your usage and receive webhooks.
- Sync (
Skrap) and async (AsyncSkrap) clients - One dependency:
httpx - Type hints throughout, with
TypedDictmodels for every response (py.typed) - Automatic retries with exponential backoff that honour
Retry-After - Typed errors that carry the HTTP status, error code and retry hints
Install
pip install skrap-ai
Requires Python 3.9 or later. The package installs as skrap-ai and you import it as skrap. You need an API key: create one in the app under Settings → API keys & MCP.
Quick start
from skrap import Skrap
client = Skrap(api_key="sk_...") # or set SKRAP_API_KEY and call Skrap()
# Verify an address
result = client.verify_email("jane@example.com")
print(result["status"]) # valid | risky | invalid | unknown
# Find a work email
found = client.find_email(first_name="Jane", last_name="Doe", domain="example.com")
print(found["emails"][0]["email"] if found["emails"] else "not found")
Responses are plain dicts that keep the API's own keys (riskReasons, requestId, ...). Their types are described in skrap.types, so editors and type checkers know the fields. Keep API keys on the server.
Async
import asyncio
from skrap import AsyncSkrap
async def main() -> None:
async with AsyncSkrap() as client:
result = await client.verify_email("jane@example.com")
print(result["status"])
asyncio.run(main())
AsyncSkrap has the same methods as Skrap; you await each one, and iter_results becomes an async for. To cancel a call, cancel its task, for example with asyncio.wait_for.
Configuration
client = Skrap(
api_key="sk_...", # default: SKRAP_API_KEY
base_url="https://api.skrap.ai", # default: SKRAP_BASE_URL, then https://api.skrap.ai
timeout=120, # seconds per attempt (verify and find can take about a minute)
max_retries=2, # retries after the first attempt; 0 turns retries off
max_retry_delay=60, # longest Retry-After (seconds) the client will wait for
default_headers={"x-my-trace": "abc"},
http_client=None, # your own httpx.Client (proxies, transports); not closed by close()
)
You can use the client as a context manager (with Skrap() as client:) or call client.close() when done. Every method also takes per-request overrides:
client.verify_email(
"jane@example.com", request_options={"timeout": 30, "max_retries": 0, "headers": {"x-my-trace": "abc"}}
)
request_options also takes idempotency_key (see Idempotent retries).
Test without spending credits
Addresses at sandbox.skrap.ai are answered from fixed rules: no live check runs, nothing is charged, and every answer carries sandbox: True. For example valid@sandbox.skrap.ai, invalid@, risky@, role@, disposable@, unknown@ and retry@ (unknown, retryable: True) for verify; last name Valid, Risky or Unknown at the domain sandbox.skrap.ai for find; and sandbox.skrap.ai as the company in domain search and in the company enrichment calls. See the sandbox docs.
r = client.verify_email("risky@sandbox.skrap.ai")
r["status"], r["sandbox"] # ('risky', True)
Credits
Lookups that come back invalid, unknown or not found are free. If you repeat a verify or find that you already paid for, it is also free while inside your plan's repeat window, and the answer then carries repeat: {"free": True, "firstChargedAt": ...}. See pricing and the credit table.
Methods
Verify an email
Costs 1 credit when the result is valid or risky.
r = client.verify_email("jane@example.com")
r["status"] # 'valid' | 'risky' | 'invalid' | 'unknown'
r["retryable"] # True: unknown for a temporary reason, try again later
r["score"] # 95 valid, 10-70 risky, 0 invalid, None unknown
r["checks"] # syntax, mxFound, smtp, catchAll, disposable, roleAccount, freeProvider
r["riskReasons"] # risky only: catch_all, catch_all_unconfirmed, role_account, disposable
r["didYouMean"] # typo hint or None
r["requestId"] # same as the X-Request-Id header
Find a work email
Costs 1 credit when a valid or risky email is found. Give a domain when you have one (best results). Otherwise give a company name.
r = client.find_email(
first_name="Jane",
last_name="Doe", # or full_name="Jane Doe"
domain="example.com", # or company="Example Inc" (+ optional location="Austin")
)
r["email"] # best address, or None
r["status"] # 'valid' | 'risky' | 'invalid' | 'unknown'
r["score"] # confidence 0-100, None without an address
r["catchAll"] # True: catch-all domain (the mailbox cannot be proven)
r["source"] # mail_server | email_format | best_guess | records | web
r["emails"] # [{"email": ..., "status": ...}]
r["domainStatus"] # 'valid' | 'invalid' | 'unknown'
r["retryable"] # True: unknown for a temporary reason, try again later
r["requestId"]
A find waits for the final answer, which can take up to about 50 seconds when a mail server is slow. To be answered sooner, give a budget:
r = client.find_email(first_name="Jane", last_name="Doe", domain="example.com", budget_ms=10_000)
if r.get("deferred"):
# Not done within 10 s: status 'unknown', retryable True, not charged.
# The find keeps running; the same request again collects its answer.
r = client.find_email(first_name="Jane", last_name="Doe", domain="example.com", budget_ms=10_000)
The budget is sent as the x-skrap-budget-ms header. The API uses at least 3,000 ms, and ignores a budget that is not shorter than its own. find_email also takes linkedin_url (the person's profile), which helps match records.
Some mail servers answer slowly. In that case the first answer has pendingRefinement: True and is not charged yet. Wait for the final answer like this:
if r.get("pendingRefinement"):
final = client.wait_for_find_refinement(r["requestId"], interval=2, timeout=120)
final["email"], final["status"]
# or poll yourself:
state = client.get_find_refinement(r["requestId"]) # {"ready": bool, "email"?, "status"?, ...}
Sometimes a company name matches several companies. Then the answer has needsCompanyConfirmation: True and suggestions (name, domain, employeeCount). Resend with the domain you mean.
Domain search
A company domain (or name, or LinkedIn company id) in: the company, its email format and one page of 25 people. Costs 1 credit when a company or people come back; nothing found is free, and so is the same page again inside your plan's repeat window.
ds = client.domain_search(
"example.com", # or company="Example Inc", or company_linkedin_id=...
seniority=["vp", "director"], # c_suite, vp, director, manager, staff
department=["sales"],
page=1, # 1-20
)
ds["company"] # name, industry, size, employeeCount, headquarters, ... or None
ds["emailFormat"] # {"formats": [{"format": "{first}.{last}", "share": ...}], "evidence", "catchAll"} or None
ds.get("emailFormatInfo") # when emailFormat is None: reason, catchAll, likelyFormat
ds["people"] # id, name, firstName, lastName, title, location, linkedinUrl
ds["hasMore"], ds["total"]
# People come without emails. Get one (1 credit for a valid or risky email):
person = ds["people"][0]
email = client.search.lead_email(person["id"], name=person["name"], domain=ds["domain"])
Enrichment
You are charged only when something is found. Each account can spend up to 5,000 credits a day on enrichment, and the limit resets at midnight UTC. Over the limit, you get a RateLimitError with code ENRICH_DAILY_LIMIT.
# Who is behind a work email. 2 credits when found (+1 with include_company when the profile is found).
who = client.enrich.reverse_email("jane.doe@example.com", include_company=True)
who["person"]["fullName"]
who["company"] # the person's current company: name, domain, linkedinUrl
who["companyProfile"] # full company profile, only with include_company=True
# A LinkedIn profile, plus the work email at the current employer when on record. 1 credit (+1 with email).
p = client.enrich.person("https://www.linkedin.com/in/jane-doe", include_email=True)
p["person"], p["workEmail"] # workEmail: {"address", "status"} or None
# A company from its domain or LinkedIn page. 1 credit (+1 with include_breakdown).
c = client.enrich.company(domain="example.com", include_breakdown=True)
c["company"]["industry"], c["headcountBreakdown"]["departments"]
# People at a company. 1 credit per person returned (emails included).
team = client.enrich.company_contacts(
domain="example.com",
seniority=["vp", "director"],
department=["sales"],
country=["US"],
limit=10,
page=1,
)
for person in team["people"]:
print(person["fullName"], person["title"], (person["email"] or {}).get("address"))
# The best contacts for a role, best match first. 1 credit per person with a verified work email;
# people without one are returned free (name and title only).
dm = client.enrich.decision_makers(
domain="example.com",
role="sales", # founder_ceo, sales, marketing, engineering, hr, finance, operations
titles=["Head of Revenue"], # optional: your own titles first, up to 10
country=["US"],
limit=3, # 1-10
)
for person in dm["people"]:
print(person["tier"], person["title"], (person["email"] or {}).get("address", "(no email)"))
dm["withEmail"] # what you were charged for
Every enrichment answer carries creditsCharged and requestId.
Search leads and companies
The same search as the app. A search costs 0 credits: it uses one of your plan's daily searches. A repeat of a search you already made, and pages 2 and later, are free. Rows come without emails. Use a key with the search scope (or full access).
import time
page = client.search.leads(
filters={
"seniority": {"include": ["300", "220"]}, # VP, director
"department": {"include": ["sales"]},
"location": {"include": [{"id": "101282230", "text": "Germany"}]}, # or a plain name: ["Germany"]
},
page=1,
)
# The first answer can be partial while the rest of the page loads.
rows = {row["id"]: row for row in page["results"]}
state = page
while state["status"] == "partial" and state.get("continuationToken"):
time.sleep(2)
state = client.search.continue_page(state["continuationToken"])
rows.update({row["id"]: row for row in state["results"]})
# Companies: the same call with search_kind="company".
companies = client.search.companies(
filters={"company_keywords": {"include": ["fintech"]}, "year_founded": {"min": 2018}}
)
client.search.filters() # every filter and option id (cache it)
client.search.typeahead("company", "stripe") # ids for the company and place filters
# The work email of a person row: 1 credit for a valid or risky email; not found is free.
lead = next(iter(rows.values()))
e = client.search.lead_email(lead["id"], name=lead["name"], domain=lead.get("domain"))
if e.get("pendingRefinement"):
client.wait_for_find_refinement(e["requestId"])
When the day's searches are used up you get a RateLimitError with code QUOTA_EXCEEDED; retry_after says when the counter resets (00:00 UTC). An expired continuation token raises a SkrapError with status 410 and code CONTINUATION_EXPIRED: run the search again.
Bulk jobs
A bulk job takes up to 25,000 rows and runs in the background. Each verify row is charged once, when it settles as valid or risky.
job = client.bulk.verify(["jane@example.com", "john@example.org"], list_name="Q2")
job2 = client.bulk.find(
[
{"first_name": "Jane", "last_name": "Doe", "domain": "example.com"},
{"first_name": "Li", "company": "Acme"},
]
)
task = client.tasks.get(job["taskId"]) # status + progress
# poll until completed, failed, cancelled or paused
done = client.tasks.wait(
job["taskId"],
interval=5,
on_progress=lambda t: print(t["progress"]["percentage"]),
)
page = client.tasks.results(job["taskId"], offset=0, limit=50) # one page
for row in client.tasks.iter_results(job["taskId"]): # every row
print(row["email"], row["status"])
csv_text = client.tasks.download(job["taskId"])["csv"] # results CSV
link = client.tasks.download_url(job["taskId"])["downloadUrl"] # signed link to the stored file
client.tasks.pause(job["taskId"])
client.tasks.resume(job["taskId"])
client.tasks.cancel(job["taskId"]) # rows already processed stay charged; nothing else is
A job also pauses itself when credits run out (metadata.pauseReason == "insufficient_credits"). Resume it after a top-up. While a job has no results yet, tasks.download() raises a SkrapError with code TASK_PROCESSING (status 202). Results are kept for 30 days. After that, results and downloads fail with status 410 and code RESULTS_EXPIRED. You can also subscribe to the bulk_job.completed webhook instead of polling.
Lists
lists = client.lists.list(kind="prospect")["lists"] # id, name, kind, leadCount
new = client.lists.create("Q2 outbound", kind="prospect")["list"] # "prospect" or "company"
client.lists.add_lead(
new["id"],
{
"id": "lead-123", # your id, unique in the list
"name": "Jane Doe",
"company": "Example Inc",
"email": "jane@example.com", # required on prospect (people) lists
"email_status": "valid", # snake_case or camelCase keys
"job_role": "CTO",
"domain": "example.com",
},
)
client.lists.transfer_leads(new["id"], target_list_id="other-list-id", lead_ids=["lead-123"], mode="move")
export = client.lists.export(ids=[new["id"]], kind="prospect") # ids defaults to "all"
export["csv"], export["suppressed"] # do-not-contact leads are left out unless include_suppressed=True
Adding a lead whose id or email is already in the list raises ConflictError (409).
Account
me = client.account.get() # id, email, plan, credits, team, apiKey
This call is free, so it works well as a connection test.
Usage
What your keys and your team spent: single requests and bulk jobs, newest first, with the credits each one cost. Free. Use a key with the account scope (or full access). Team owners and admins see the whole team; members see their own usage.
from datetime import date
page = client.usage.list(
from_=date(2026, 11, 1), # date, datetime (naive = UTC), "YYYY-MM-DD" or ISO timestamp; default: last 30 days
to="2026-11-14",
tool=["verify", "find"], # verify, find, search, enrichment, bulk, bulk-verify, bulk-find, other
kind="request", # or "bulk_job"
api_key_id="key-id", # optional
limit=100, # 1-500
)
page["items"] # timestamp, endpoint, tool, status, credits, apiKeyName, userEmail, requestId, sandbox, ...
page["totals"] # credits, requests, bulkJobs over the whole range
page["nextCursor"] # pass as cursor= for the next page
for item in client.usage.iter_items(from_="2026-11-01"):
print(item["timestamp"], item["endpoint"], item["credits"])
export = client.usage.export(from_="2026-11-01", to="2026-11-14") # up to 100,000 rows
export["csv"], export["rows"], export["truncated"]
Webhooks
hook = client.webhooks.create("https://example.com/skrap-webhook", ["bulk_job.completed", "credits.low"])
hook["secret"] # signing secret, returned only once: store it
client.webhooks.list()["webhooks"]
client.webhooks.delete(hook["id"])
client.webhooks.sample("bulk_job.completed") # example payload (list of one)
The events are bulk_job.completed, bulk_job.failed, credits.low and list.lead_added. Webhooks are available on paid plans. On a team, only owners and admins can subscribe or remove them.
Verify webhook signatures
Pass the raw request body as bytes, exactly as received:
from skrap import WebhookSignatureError, construct_webhook_event
@app.post("/skrap-webhook") # Flask
def skrap_webhook():
try:
event = construct_webhook_event(request.get_data(), request.headers.get("Skrap-Signature"), SECRET)
except WebhookSignatureError:
return "bad signature", 400
# de-duplicate with the Skrap-Event-Id header, then handle event["type"] / event["data"]
return "ok", 200
verify_webhook_signature(raw_body, header, secret) returns a bool instead of raising. Both functions reject signatures older than 5 minutes by default; change that with tolerance=.
Errors
Every failure raises a SkrapError. Specific cases use these subclasses:
| Class | HTTP | Typical code |
|---|---|---|
ValidationError |
400 | VALIDATION_ERROR, UNSUPPORTED_EMAIL |
AuthenticationError |
401 | INVALID_API_KEY, API_KEY_EXPIRED |
InsufficientCreditsError |
402 | INSUFFICIENT_CREDITS, MEMBER_CREDIT_LIMIT, OVERAGE_LIMIT, OVERAGE_BLOCKED |
PermissionDeniedError |
403 | PLAN_REQUIRED, SCOPE_REQUIRED, IP_NOT_ALLOWED, FEATURE_NOT_AVAILABLE, RESULTS_CAP, ACCESS_DENIED, AUTHORIZATION_ERROR |
NotFoundError |
404 | NOT_FOUND, TASK_NOT_FOUND |
ConflictError |
409 | IDEMPOTENCY_KEY_REUSED, IDEMPOTENCY_REQUEST_IN_PROGRESS, (duplicate list or lead) |
RateLimitError |
429 | RATE_LIMITED, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, KEY_CREDIT_CAP, ENRICH_DAILY_LIMIT, DECISION_MAKERS_DAILY_LIMIT, FREE_ENRICH_LIMIT |
ServerError |
5xx | INTERNAL_ERROR, ENRICH_UNAVAILABLE, CREDIT_CONTENTION |
APIConnectionError |
none | CONNECTION_ERROR |
APITimeoutError |
none | TIMEOUT |
Other statuses, such as 410 RESULTS_EXPIRED and CONTINUATION_EXPIRED, raise the base SkrapError.
from skrap import InsufficientCreditsError, RateLimitError, SkrapError
try:
client.verify_email("jane@example.com")
except InsufficientCreditsError as e:
print(e.details) # {"required": ..., "available": ..., "shortfall": ...}
except RateLimitError as e:
print(f"retry in {e.retry_after}s", e.body) # plan, planName, limitPerMinute, upgrade
except SkrapError as e:
print(e.status, e.code, e.message, e.retryable, e.request_id)
Every SkrapError has these fields:
status: the HTTP status, orNonewhen no response arrived.code: the API's error code. Some endpoints, such as list errors, send no code, so it can beNone.messageretryable: the API'sretryableflag when it sends one. Otherwise it is true for 429, 5xx, connection errors and timeouts.retry_after: in seconds.details,bodyandheadersrequest_id: currentlyNonefor most errors, because error responses do not carry a request id.
Retries
The client retries automatically (2 times by default):
- 429, 500 and 503: always retried. The API did no work and charged nothing.
- 502, 504, network errors and timeouts: retried only for calls that are safe to repeat. These are verify, find (a repeat is free) and all reads. Bulk job creation, enrichment, list writes, webhook changes and task controls are not retried after an unknown outcome, so they never run twice.
- Waiting: the client waits the
Retry-Afterheader (orretryAfterSec) when the API sends one. Otherwise it backs off exponentially with jitter, from 0.5 s up to 8 s. - Long waits: if the API asks to wait longer than
max_retry_delay(60 s by default), the client raises right away withretry_afterset. This happens with the daily enrichment limit, for example. - No retry: a response with
retryable: falseis never retried.
Idempotent retries
Give a POST an idempotency_key and the API remembers its successful answer for 24 hours: the same key with the same body gets that answer again, with no second charge and no second job, list or webhook. The key is sent as the Idempotency-Key header (1-255 printable ASCII characters; use a new UUID for each logical operation).
import uuid
job = client.bulk.verify(emails, request_options={"idempotency_key": str(uuid.uuid4())})
It works on verify, find, the enrichment calls, bulk.verify, bulk.find, lists.create, lists.add_lead and webhooks.create. With a key, the client also retries those calls after a network error or timeout, using the same key, and waits out a 409 IDEMPOTENCY_REQUEST_IN_PROGRESS while the first attempt is still running. The same key with a different body raises ConflictError with code IDEMPOTENCY_KEY_REUSED.
Plan rate limits are per key: Free 30, Professional 120 and Enterprise 600 requests a minute.
Response details
from skrap import response_meta
r = client.verify_email("jane@example.com")
meta = response_meta(r)
meta.status # 200
meta.request_id # x-request-id header, else the body's requestId (find and enrichment), else None
meta.rate_limit # RateLimitInfo(limit, remaining, reset) from the RateLimit headers, or None
meta.headers
Examples
examples/verify_then_find.py: verify, then find, with error handlingexamples/bulk_verify_async.py: async bulk job, wait, results, CSVexamples/webhook_server.py: receive webhooks and check their signatures
Documentation
- API reference: https://skrap.ai/docs/api
- Webhooks: https://skrap.ai/docs/webhooks
- OpenAPI: https://skrap.ai/openapi.json
License
MIT. See LICENSE.
Metadata
Release files for skrap-ai 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| skrap_ai-0.2.0.tar.gz | 53.9 kB | With provenance | Details for skrap_ai-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| skrap_ai-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for skrap_ai-0.2.0-py3-none-any.whl |
Total release size: 94.6 kB
Release files / skrap_ai-0.2.0.tar.gz
| Download URL | skrap_ai-0.2.0.tar.gz |
|---|---|
| Size | 53.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2d7a3436e2596d3b14eea26aad93b1e844f09a17251299b8056fbf908cd91c3
|
|
BLAKE2b-256 checksum How to use checksums |
93b0dac91e6c050714347d96ba3e8c0b1f40583b6dfa6cfc556f7b0529c8bece
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / skrap_ai-0.2.0-py3-none-any.whl
| Download URL | skrap_ai-0.2.0-py3-none-any.whl |
|---|---|
| Size | 40.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
704ff128706bee1c969e564b2a2f2fff1a5b59dae5dc91511221a210ce778981
|
|
BLAKE2b-256 checksum How to use checksums |
9c2d2cb5c639c5d3d90875b7ea188558d35b6935954b12c2c3fbab74042cfd1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for skrap-ai 0.2.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for skrap_ai-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA 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.