Python SDK
Learn about how to programatically use Validin through the Python SDK
Installation Requirements
- Package:
validin-sdk(import name:validin) - Python: 3.9 or later
- Dependencies:
requests>=2.31.0 - License: MIT
Installation
From PyPI
pip install validin-sdkUse a virtual environment so the SDK and its dependency don't conflict with system packages:
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install validin-sdkFrom source
git clone https://github.com/Validin/validin-python-sdk.git
cd validin-python-sdk
pip install -e .Check the installation
python -c "import validin; print(validin.__version__)"
validin version # the CLI ships in the same packageConfiguration
The client needs an API key. Find yours in your Validin profile settings.
Saved settings (recommended)
Run validin setup once. It verifies your API key and endpoint and saves them to ~/.validin/config.json, readable only by you. Python scripts run as the same user can then create a client with no arguments:
from validin import Client
client = Client() # uses the key and endpoint saved by validin setupEnvironment variables
For CI, containers or a one-off session, set environment variables instead. They override the saved settings:
export VALIDIN_API_KEY="your-api-key"
# Enterprise accounts only: your dedicated endpoint
export VALIDIN_BASE_URL="https://your-enterprise-endpoint.example.com"Arguments
Arguments override everything else:
client = Client(
api_key="your-api-key",
base_url="https://your-enterprise-endpoint.example.com",
)Precedence
Each setting is resolved in this order, and the first one found wins:
- Constructor argument:
api_key,base_url - Environment variable:
VALIDIN_API_KEY,VALIDIN_BASE_URL - Saved config:
~/.validin/config.json, written byvalidin setup - Default endpoint:
https://app.validin.com
A base URL without a scheme gets https:// added. If no API key is found, Client() raises ValueError("api_key is required").
The SDK and the validin CLI read the same settings, so one validin setup configures both.
All constructor options
| Parameter | Default | Description |
|---|---|---|
api_key | $VALIDIN_API_KEY, then the saved config | API key, sent as a Bearer token. |
base_url | $VALIDIN_BASE_URL, then the saved config, then https://app.validin.com | API endpoint. |
session | new requests.Session | Your own session, for proxies, custom TLS, or connection pooling. |
timeout | 60.0 | Per-request timeout in seconds. |
bulk_max_retries | 2 | Retries per indicator for transient failures in bulk calls. |
bulk_retry_backoff_seconds | 0.5 | First retry delay. It doubles on each retry. |
bulk_retry_status_codes | {408, 425, 429, 500, 502, 503, 504} | HTTP statuses that bulk calls retry. |
import requests
from validin import Client
session = requests.Session()
session.proxies = {"https": "http://proxy.internal:3128"}
client = Client(session=session, timeout=120, bulk_max_retries=4)ValidinClient is an alias for Client.
Check the connection
client.ping() # raises AuthError if the key is rejected
client.quota() # used / limit / remaining, daily and monthlyCore concepts
Indicators
An Indicator is a typed value you can query: a domain, IP, CIDR range, hash, or free-text string. You rarely build one yourself. Indicator lookups accept plain strings and infer the type.
client.dns_history("example.com") # domain
client.dns_history("1.1.1.1") # ip
client.dns_history("203.0.113.0/24") # cidr
client.dns_history("google-site-verification=abc*") # string, prefix wildcardInference rules:
| Input | Inferred type |
|---|---|
| A valid IPv4 or IPv6 address | IndicatorType.IP |
An address with a prefix length (203.0.113.7/24) | IndicatorType.CIDR (host bits are masked: 203.0.113.0/24) |
| An even number of hex characters, at least 18 (MD5, SHA-1, SHA-256, header and banner hashes) | IndicatorType.HASH |
A name with at least two dot-separated labels of a-z, 0-9, - and _ | IndicatorType.DOMAIN (lower-cased, trailing dot removed, IDNs converted to punycode) |
| Anything else, including single words and values with surrounding whitespace | IndicatorType.STRING |
Inference follows how Validin indexes values, not what a value represents: a version string such as 2.4.41 is typed as a domain. To search it as text, pass Indicator("2.4.41", IndicatorType.STRING).
Plain hash strings work wherever a method takes hashes, including host_responses(), pivots(), fetch_content() and the open-directory hash methods. Where a method takes text but not hashes (dns_history(), extra_history(), registration_history()), a hex-only string is searched as text, so verification tokens still work; an explicit hash Indicator is refused there. To force a type, build the Indicator yourself:
from validin import Indicator, IndicatorType
Indicator("fc742437c62fa1e248680e0035bafbc55923423b", IndicatorType.HASH)
Indicator.from_str("example.com") # same inference the client usesString wildcards. For string queries to dns_history(), extra_history(), and registration_history(), a trailing * means "starts with". The SDK strips the * and sets wildcard=True.
ResultSet
History lookups return a ResultSet. Iterate over it to read the records or use these helpers.
| Member | Description |
|---|---|
for record in results / results[0] / len(results) | Iterate and index records. |
.keys | Deduplicated Indicators the records are about (for example, the queried domain in DNS records). |
.keys_str | .keys as plain strings. |
.values | Deduplicated record values (for example, the resolved IPs). |
.to_rows() | One dictionary per record. Fields such as registration can contain nested objects. Use with pandas.DataFrame(results.to_rows()) or csv.DictWriter. |
.aggregate() | Flattens and deduplicates records. Preserves errors and truncation from child results. |
.errors | Per-indicator failures from a bulk call. |
.truncated | True if the API capped any part of the result (raise limit to see more). |
.limited | True if the API capped this result set. |
.query_key, .query_opts, .status, .records_returned | Query metadata. |
.metadata | All metadata, including the raw API payload under "raw". |
.to_envelope(command=..., query=...) | The JSON envelope the CLI prints. |
Bulk queries
Pass a list of indicators to run several lookups in one call.
results = client.dns_history(["example.com", "example.org", "203.0.113.7"])With a list, the SDK:
- Sends at most 5 requests per second.
- Retries transient failures (by default 408, 425, 429, 500, 502, 503, 504, and network errors) with exponential backoff.
- Keeps going when one indicator fails (not found, rejected, invalid input). The failure is recorded in
results.errorsas{"indicator", "code", "status", "message"}. - Stops and raises on a rejected key (
AuthError) and on429once retries run out, because every remaining query would fail the same way.
For DNS history, each successful lookup produces a child ResultSet. Failed inputs appear in results.errors.
results = client.dns_history(["example.com", "example.org"])
for child in results: # one per successful lookup
print(child.query_key, len(child))
flat = results.aggregate() # one deduplicated set
print(len(flat), flat.values)
for err in results.errors:
print(f"{err['indicator']}: {err['code']} {err['message']}").keys, .values, and .to_rows() work directly on a bulk result too. They walk all child sets.
Time windows
Methods with a time window accept these parameters:
| Parameter | Accepts | Meaning |
|---|---|---|
lookback | int (days) | Only records seen in the last N days. Takes precedence: when set, first_seen and last_seen are ignored. |
first_seen | str (YYYY-MM-DD), date, datetime, or Unix timestamp | Records first seen on or after this time. |
last_seen | same as first_seen | Records last seen on or before this time. |
limit | int | Maximum records. When omitted, the API's default applies. |
Enriched indicators
EnrichedIndicator is a subclass of Indicator that also carries reputation data: score, verdict, reasons, annotations (a tuple of AnnotationRecord), and informational.
You get them from client.enrich() / client.reputation(), and on the key and value of history records when you pass annotate=True:
from validin import EnrichedIndicator
for record in client.dns_history("example.com", annotate=True):
if isinstance(record.value, EnrichedIndicator):
print(record.value.value, record.value.verdict, record.value.reasons)Because it is an Indicator, an enriched indicator can be passed anywhere a plain one can: to another query, or to add_to_project().
Method reference
Methods marked bulk accept a list of indicators and return a bulk ResultSet (see Bulk queries).
DNS
dns_history(indicator, *, limit, first_seen, last_seen, lookback, annotate, wildcard, categories_include, exclude_nx) (bulk)
dns_history(indicator, *, limit, first_seen, last_seen, lookback, annotate, wildcard, categories_include, exclude_nx) (bulk)DNS resolution history (A, AAAA, NS, CNAME, and so on).
| Indicator | Returns |
|---|---|
| Domain | What the domain resolved to. |
| IP or CIDR | Domains that resolved to the address(es). |
| String | Records whose value matches the string (wildcard=True or a trailing * for prefix match). |
categories_include: record types to keep, for example["A", "AAAA"]or"A,NS"(any case).exclude_nx: drop NXDOMAIN observations.wildcard: for domains, include subdomains.annotate: attach reputation intel (see Enriched indicators).
Returns DNSRecords.
extra_history(indicator, ...) (bulk)
extra_history(indicator, ...) (bulk)Same parameters as dns_history(), for extra record types: TXT, MX, SOA, SRV, HTTPS, and others. Useful for hunting verification tokens and SPF records.
client.extra_history("example.com", categories_include=["TXT", "MX"])
client.extra_history("google-site-verification=AbCd*", lookback=30)ptr_history(indicator, *, limit, first_seen, last_seen, lookback, annotate, wildcard, time_format) (bulk)
ptr_history(indicator, *, limit, first_seen, last_seen, lookback, annotate, wildcard, time_format) (bulk)Reverse DNS (PTR / hostname) history for a domain, IP, or CIDR. limit is 1–20000. wildcard applies to domains only. time_format is "unix" or "iso". Returns DNSRecords.
subdomains(domain, *, limit, annotate) (bulk)
subdomains(domain, *, limit, annotate) (bulk)Known subdomains of a registered domain. A leading *. is dropped. Results are alphabetical. Returns SubdomainRecords.
Web and content
host_responses(indicator, *, limit, lookback, first_seen, last_seen, annotate) (bulk)
host_responses(indicator, *, limit, lookback, first_seen, last_seen, annotate) (bulk)HTTP(S) responses Validin's crawler recorded.
| Indicator | Returns |
|---|---|
| Domain, IP, or CIDR | Responses seen on that host. |
| Hash (body, header, banner, or favicon hash) | Every host that served that fingerprint. A plain hash string works: its type is inferred. |
The API searches the last 90 days unless lookback or first_seen is given. Rows are not in date order, so limit keeps an arbitrary subset.
Returns HostResponseRecords. Each record's .value is a HostResponse with host, ip, scheme, port, title, banner, meta, length, ext_links, body_hash, favicon_hash, header_hash, start_line, response_line, time, and more.
fetch_content(indicator, *, kind="html", date=None, include_parsed=True) (bulk)
fetch_content(indicator, *, kind="html", date=None, include_parsed=True) (bulk)What a hash points at. Accepts a hash string, an Indicator, or a HostResponse (its body_hash, or favicon_hash for favicons).
kind | Hash | Content |
|---|---|---|
"html" (default) | SHA-1 body hash | The page. .html() decodes it. .text, .resources, and .indicators (hosts and IPs the page references) are included unless include_parsed=False. |
"cert" | SHA-1 certificate fingerprint | .pem, .human_readable, and .certificate_fields() (subject, issuer, validity). |
"favicon" | MD5 favicon hash | .data() returns the image bytes. |
date (YYYY-MM-DD) is a day the hash was observed. A single hash returns a Content object. A list returns a bulk ResultSet of Content.
Certificates
certificates(indicator, *, wildcard, limit, first_seen, last_seen, lookback, time_format) (bulk)
certificates(indicator, *, wildcard, limit, first_seen, last_seen, lookback, time_format) (bulk)Certificate Transparency history for a domain. wildcard=True includes certificates for subdomains. limit is 1–20000 and counts CT log entries (each certificate is usually logged several times). Returns CertificateRecords with common_name, fingerprint, fingerprint_sha256, domains, and timestamp. The full observation is in .value (a CertificateObservation).
Registration
registration_history(indicator, *, limit, first_seen, last_seen, lookback, annotate, wildcard, include_fields, field) (bulk)
registration_history(indicator, *, limit, first_seen, last_seen, lookback, annotate, wildcard, include_fields, field) (bulk)WHOIS/RDAP history.
- Domain: the domain's registration snapshots.
- String: reverse search across registration fields (registrant email, organization, name server, and so on).
field: search one registration field only, for example"REGISTRANT_EMAIL","REGISTRAR", or"TECH_ORG"(any case). The value is always searched as text, even if it looks like a domain, so a name server or email domain works without wrapping it in a stringIndicator. Known names are invalidin.REGISTRATION_FIELDS. An unknown name raises aUserWarning, because the API returns an empty result. IP and CIDR indicators raiseValueError.
client.registration_history("[email protected]", field="REGISTRANT_EMAIL", lookback=365)
client.registration_history("Gname.com Pte. Ltd.", field="REGISTRAR", lookback=7)Returns RegistrationRecords with .domain, .registrar, and a Registration in .value (nameservers, status, registered, expires, updated, org, country, and more).
Alias: get_registration_history().
live_registration(indicator, *, mode="rdap", normalize=True) (bulk)
live_registration(indicator, *, mode="rdap", normalize=True) (bulk)A live registry lookup for a domain, IP, or CIDR. mode is "rdap" or "whois". With normalize=False the registry's response is kept raw in each record's raw["rdap"] (JSON) or raw["whois"] (text). to_rows() includes that mapping under raw.
Domains are looked up at their registered domain (a.b.example.com queries example.com). The API waits up to 30 seconds for the registry and caches results for 24 hours. Requires live-registration access on your account.
Reputation
enrich(indicator) / reputation(indicator) (bulk)
enrich(indicator) / reputation(indicator) (bulk)Reputation score, verdict, and threat-intel annotations for domains and IPs. The two names are aliases. Returns a ResultSet of EnrichedIndicators, one per queried indicator.
r = client.enrich("example.com")[0]
r.score, r.verdict, r.reasons
for a in r.annotations:
print(a.category, a.title, a.description)For a bulk call, iterate results.keys to get the EnrichedIndicators.
osint_context(indicators)
osint_context(indicators)Find the feeds and lists that mention each domain or IP. The SDK sends up to 1,000 distinct indicators per request. Your account needs the bulk role.
Returns a ResultSet of EnrichedIndicators, one per distinct indicator in input order, with annotations and reasons filled in. Both score and verdict are None. The SDK skips unsupported or invalid inputs and records them in results.errors as unsupported_indicator or invalid_indicator. In to_dict() rows, type is "OSINT_CONTEXT".
results = client.osint_context(["example.com", "203.0.113.7", "evil.example"])
for ind in results:
if ind.annotations:
print(ind.value, ind.reasons)OSINT history
osint_history(indicator, *, limit, first_seen, last_seen, lookback, wildcard) (bulk)
osint_history(indicator, *, limit, first_seen, last_seen, lookback, wildcard) (bulk)Open-source lists and feeds (block lists, popularity rankings, cloud provider IP ranges, and so on) that included a domain, IP, or CIDR, with when it was seen there. wildcard=True includes subdomains of a domain. Public suffixes such as co.uk are refused by the API.
Returns OsintRecords with key, source (the list or feed, also available as .value), url, tags (for example category/informational, type/popular), categories and types (the tags without their prefix), first_seen, and last_seen.
for rec in client.osint_history("example.com", lookback=90):
print(rec.source, rec.categories, rec.last_seen.date())Pivots
pivots(indicator, *, category, limit, first_seen, last_seen, lookback, annotate, wildcard) (bulk)
pivots(indicator, *, category, limit, first_seen, last_seen, lookback, annotate, wildcard) (bulk)Where a value was seen on other hosts: the IPs and hosts whose crawled responses contained it. Records are typed <CATEGORY>-IP / <CATEGORY>-HOST (relation is "ip" or "host"), and the category says where the value was seen.
| Indicator | Where it was seen |
|---|---|
| Domain | Pages linking to it (ANCHORS_LINKS, JS_LINKS, LINKS_LINKS), certificates naming it (CERT_DOMAIN), redirects to it (LOCATION_DOMAIN). |
| Hash | Hosts that served it (BODY_SHA1, HEADER_HASH, CERT_FINGERPRINT, ...). |
| String | Hosts whose server banner, title, or certificate fields contain it. |
| IP or CIDR | Hosts that redirect to it (LOCATION_IP4, from the Location: header). IPs also get HOST-<CATEGORY> records (relation is "observed_on"): what the IP's own responses contained, such as its server banner, title, and hashes. |
categorynarrows the lookup to one attribute, for example"TITLE","BODY_SHA1","HEADER_HASH","CERT_DOMAIN", or"JARM". Case doesn't matter, and record types such as"HOST-SERVER"or"SERVER-IP"are accepted and reduced to"SERVER". The documented categories per indicator type are invalidin.PIVOT_CATEGORIES. The API can return others, includingSSDEEPandCERT_OU. An unknown category returns an empty result.categorycan't be used with a CIDR (ValueError). An IP takes onlyLOCATION_IP4(hosts that redirect to it). Leavecategoryoff to also get what the IP itself served.- An even-length hex value of 18 or more characters is looked up as a hash, including 20-character header hashes. To search such a value as text, pass
Indicator(value, IndicatorType.STRING). wildcard: for domains, include subdomains.annotate: attach reputation intel.
Returns PivotRecords with key, type, category, relation, value (an Indicator), value_type, first_seen, and last_seen. Pass a record's value back into pivots() to pivot again:
# Find redirects to the IP and content the IP served.
for rec in client.pivots("203.0.113.7", lookback=30):
print(rec.relation, rec.category, rec.value)
# Every IP and host that served the same page body
same_body = client.pivots("fc742437c62fa1e248680e0035bafbc55923423b", category="BODY_SHA1")
print(same_body.values)Threat groups
Named threat actors, groups, and malware families that Validin tracks, with their publicly reported indicators and reports. These need the bulk or projects role on your account. Threat keys are matched in lower case. An unknown key raises ApiError with code "not_found" (the API answers it with a 403), or appears in results.errors in a bulk call.
| Method | Description |
|---|---|
threat_names(*, category=None) | Every named threat (several thousand), as ThreatGroups with threat_key, category, aliases, and indicator_counts. category keeps only malicious, malware, or suspicious groups (one value or a list). See validin.THREAT_CATEGORIES. |
threat_group(threat_key) | One group's summary as a ThreatGroup: also name, total_indicators, references_count, description_references, mitre_ttps, activity (indicators reported per activity_period), and last_updated. |
threat_group_indicators(threat_key) (bulk) | Indicators reported for a group, as ThreatIndicators (key is a typed Indicator, plus threat_key and date_added). Pass a list of keys for several groups. |
threat_group_reports(threat_key) (bulk) | Links to public reports about a group, newest first, as ThreatReports (url, date, source, display_key). |
groups = client.threat_names(category="malware")
print(len(groups), [g.threat_key for g in groups][:10])
iocs = client.threat_group_indicators("some-threat-key")
domains = [i.key for i in iocs if i.key.type.value == "domain"]Lookalikes
lookalikes(target, *, exclude, limit, lookback, depth, similarity)
lookalikes(target, *, exclude, limit, lookback, depth, similarity)Newly registered domains that resemble a target. Not bulk.
| Parameter | Description |
|---|---|
target | A domain ("acme.com"), a compiled re.Pattern, or a slash-delimited regex string ("/^acme-(login|pay)\./"). |
exclude | Domains or keywords to leave out (list or comma-separated string). |
limit | 1–250. |
lookback | 1–90 days. |
depth | "labels", "subdomains", or "fqdns". |
similarity | Maximum edit distance, 0–4. Domain targets only. |
Returns LookalikeRecords with key (the lookalike domain), match, keyword, similarity, registrar, registered, first_seen, and recent_dns.
Alias: get_lookalikes().
Live scans
Live scans fetch a URL now from Validin's crawlers.
| Method | Description |
|---|---|
start_scan(find, *, countries, refer, user_agent) | Start a scan. Returns a ScanJob. |
get_scan(scan_id) | Current status. Returns a ScanJob. |
get_scan_crawl_results(scan_id) | What the scan fetched. Returns ScanRecords. |
scan(find, *, countries, refer, user_agent, wait=True, poll_interval=2.0, timeout=120.0) | Start, wait, and return the results. With wait=False, returns the ScanJob immediately. |
ScanJob has scan_id, status, done, succeeded, failed, refresh(), wait(poll_interval=, timeout=), and crawl_results(). wait() raises TimeoutError if the scan doesn't finish in time.
ScanRecord.response is a ScanResponse: a HostResponse plus path, body, location, jarm, country, certificate fields, and request headers.
Open directories (beta)
These need the open-directories role on your account.
| Method | Description |
|---|---|
open_directories(indicator, *, wildcard, limit, first_seen, last_seen, lookback, annotate) (bulk) | Open-directory crawls on a domain, IP, or CIDR, newest first. Returns OpenDirCrawls. |
query_open_directories(query, *, limit, first_seen, last_seen, lookback, include_files, include_fields, annotate) | Search with open_dir.* clauses, for example 'open_dir.file.ext = "exe"'. On timeout, results.metadata["timed_out"] is true and results.errors contains a timed_out entry, even if the search found no rows. include_files=True adds up to 50 matching files per crawl (needs an open_dir.file.* clause). |
open_directories_by_url(url, *, limit) | Every capture of one exact URL. An index lookup: the URL is not fetched. Trailing slashes matter. Returns OpenDirCaptures. |
open_directory_files_by_hash(file_hash, *, limit, first_seen, last_seen, lookback) (bulk) | Captured files matching an MD5, SHA-1, or SHA-256. limit caps crawls searched, not files returned. Returns OpenDirFiles. |
get_open_directory(doc_id) | Metadata for a crawl (14-hex id), directory, or file (18-hex id). Returns OpenDirCrawl, OpenDirDirectory, or OpenDirFile. |
open_directory_entries(doc_id, *, recursive, entry_type, sort, order, page, page_size) | List a directory. A crawl id lists its starting directory. Fetches every page unless page is given. recursive=True is capped at 10,000 entries. entry_type is "file" or "dir". Set sort to name, size, or last_modified. |
open_directory_file_content(file) | Download a captured file by 18-hex file id, MD5/SHA-1/SHA-256, OpenDirFile, or OpenDirEntry. Returns OpenDirFileContent with .data (bytes), .filename, .truncated, and .save(path). |
Treat downloaded files as malware.
open_directory_file_content()returns bytes in memory and.save()only writes them. Never execute or open them outside an isolated analysis environment.
Projects
Errors (unknown project, insufficient permission) raise ApiError.
Projects
| Method | Description |
|---|---|
list_projects() | Projects you can see. Returns a list of Project. |
get_project(project_id) | One Project. |
create_project(name, description="") | Name is 1–63 characters, description at most 250. |
edit_project(project_id, *, name, description, tlp, auto_alerts) | Changes only the fields passed. tlp is CLEAR, GREEN, AMBER, RED, or None to clear. |
delete_project(project_id) | Deletes the project and its indicators. Author only. |
Indicators
| Method | Description |
|---|---|
project_indicators(project_id) | ResultSet of ProjectIndicator (key, key_type, tags, note, alert, added, added_by). |
add_to_project(project_id, indicators, *, note="", tags=None) | Add one indicator or a list. Accepts strings, Indicators, EnrichedIndicators, and ProjectIndicators. Strings are typed by the inference rules, so an even-length hex string of 18+ characters is stored as a hash and other text as raw. Add individual IPs for a CIDR range. |
remove_from_project(project_id, indicators) | Remove one or many. |
add_indicator_tags(project_id, indicator, tags) / remove_indicator_tags(...) | Tag or untag one indicator. |
set_indicator_note(project_id, indicator, note) | Replace an indicator's note. |
add_project_indicators(project_id, *, types, note, tags) | Low-level add: types maps dom, ip4, ip6, hash, raw to lists of values. |
Allowed tags (validin.PROJECT_TAGS): ground truth, confirmed, unconfirmed, rejected, suspected, compromised. Other values raise ValueError.
Alerts
| Method | Description |
|---|---|
project_alert_dates(project_id) | Days with alerts, newest first. |
latest_project_alerts(project_id) | The newest day's alerts: {"date", "project_id", "results"}. |
project_alerts(project_id, day) | Alerts for one UTC day (date, datetime, "YYYY-MM-DD", or "YYYYMMDD"). |
project_alert_preferences(project_id) | Change types that raise alerts, by source. None if never set. |
set_project_alert_preferences(project_id, preferences) | Replace preferences, for example {"dns": ["A", "NS"], "subdomains": ["new"]}. Sources left out raise no alerts. Valid values are in validin.ALERT_PREFERENCE_TYPES. |
stop_alerting(project_id, indicators) | Turn off alerts and keep the indicators in the project. At most 10,000 per call. |
delete_project_alerts(project_id, alerts) | Delete alerts by alert_rowid (ints, or alert dicts). 1–1000 per call. |
Sharing (enterprise)
| Method | Description |
|---|---|
project_members(project_id) | Members and their permissions. |
share_project(project_id, users, *, permission="edit", alert=False, notify=False, message=None) | Share with existing users by user id or email. permission is edit, add-indicators, or view. Returns how many were newly added. |
unshare_project(project_id, user) | Remove a member. |
leave_project(project_id) | Remove yourself. |
set_member_permission(project_id, user, permission) | Change a member's level. |
Resources (reference links)
| Method | Description |
|---|---|
project_resources(project_id) | Saved links: {url, note, added_by, time}. |
add_project_resource(project_id, url, note=None) | Save an http(s) link. |
set_project_resource_note(project_id, url, note) | Replace a link's note. |
delete_project_resources(project_id, urls) | Delete by URL. Returns how many were deleted. |
Live scans in projects
project_scans(project_id), add_scan_to_project(project_id, scan), remove_scan_from_project(project_id, scan). scan is a scan id or ScanJob.
YARA rules
Listing rules and reading matches work on any account. Managing rules needs an enterprise account with YARA access.
| Method | Description |
|---|---|
yara_rules(project_id) | Rules in a project. Returns a list of YaraRule (rule_id, name, tracked, versions, latest_version, source). |
get_yara_rule(project_id, rule_id) | One rule with all versions. |
add_yara_rule(project_id, source_text) | Create a rule. Returns the rule id. |
edit_yara_rule(project_id, rule_id, source_text, *, base_version=None, name=None) | Save a new version. base_version defaults to the latest version. name defaults to the rule <name> in the source. |
delete_yara_rule(project_id, rule_id) | Delete a rule with all versions, runs, and matches. Can't be undone. |
yara_matches(project_id, rule_id, *, page, page_size, include_html, first_seen, last_seen, sort_by, sort_order) | Matches. With no page/page_size, every page is fetched (sorted by match_time ascending so new matches don't shift pages). Returns YaraMatchRecords. Alias: get_project_yara_rule_matches(). |
delete_yara_matches(project_id, rule_id, row_ids) | Delete matches by row id (ints, or YaraMatchRecords). 1–1000 per call. |
run_yara_retrohunt(project_id, rule_id, version, *, lookback_hours=1, notification="none", sources=None, content_types=None) | Scan up to 168 hours of history. notification is none, alert, or alert_and_email. Choose sources from virtual_host and ip4. |
cancel_yara_retrohunt(project_id, rule_id, *, run_id=None) | Cancel running retrohunts, or one run. |
track_yara_rule(project_id, rule_id, version, *, sources=("virtual_host", "ip4"), content_type=None) | Match new content against a rule version as it's crawled. |
untrack_yara_rule(project_id, rule_id) | Stop live matching. |
Bulk search jobs
These manage bulk searches started in the Validin web app.
| Method | Description |
|---|---|
bulk_jobs() | Your bulk searches, newest first. |
bulk_job_status(job_id) | Status, progress, and per-source result counts. |
edit_bulk_job(job_id, *, name, description) | Rename (up to 128 characters) or change the description (up to 1024). |
kill_bulk_job(job_id) | Stop a queued or running search. Results so far are kept. |
Account
| Method | Description |
|---|---|
ping() | Checks the endpoint is reachable and the key is accepted. |
quota() | {"daily": {"used", "limit", "remaining"}, "monthly": {...}, "other_metered": {...}, "next_daily_reset", "next_monthly_reset"}. Resets are timezone-aware UTC datetimes. other_metered is usage that doesn't count against the quota (YARA live tracking, project alerts, bulk searches). |
usage() | Raw usage by API path, plus remaining quota. |
Domain submissions
submit_domains(domains)
submit_domains(domains)Ask Validin to start scanning domains. This can't be undone. Duplicates (case and trailing dots ignored) are dropped. Values that aren't domain names are returned in invalid without being sent. The rest go 10,000 per request. Needs full API access.
result = client.submit_domains(["new-phish.example", "other.example"])
# {"requested": 2, "valid": 2, "accepted": 2, "requests": 1, "invalid": []}accepted counts the domains the API accepted. It can be zero if the API skips every name, for example when all have unknown TLDs.
Record types
Use ResultSet.to_rows() for one dictionary per record. DNS rows include the key, value, their types and observation dates. Other record types have their own fields.
| Record | Returned by | Notable fields |
|---|---|---|
DNSRecord | dns_history, extra_history, ptr_history | key, type (A, NS, TXT…), value, value_type, first_seen, last_seen |
SubdomainRecord | subdomains | key (parent domain), value (subdomain) |
HostResponseRecord | host_responses | key, value (a HostResponse), first_seen, last_seen |
Content | fetch_content | hash, kind, html(), text, resources, indicators, pem, certificate_fields(), data() |
CertificateRecord | certificates | common_name, fingerprint, fingerprint_sha256, domains, timestamp, value (a CertificateObservation) |
RegistrationRecord | registration_history, live_registration | domain, registrar, value (a Registration) |
EnrichedIndicator | enrich, reputation, osint_context, and annotate=True | value, type, score, verdict, reasons, annotations, informational, to_rows() |
AnnotationRecord | inside EnrichedIndicator.annotations | category, risk_cat, title, description, value |
PivotRecord | pivots | key, type, category, relation, value, value_type, first_seen, last_seen |
OsintRecord | osint_history | key, source, url, tags, categories, types, first_seen, last_seen |
ThreatGroup | threat_names, threat_group | threat_key, name, category, aliases, indicator_counts, total_indicators, mitre_ttps, activity, last_updated |
ThreatIndicator | threat_group_indicators | key (an Indicator), threat_key, date_added |
ThreatReport | threat_group_reports | url, threat_key, date, source, display_key |
LookalikeRecord | lookalikes | key, match, keyword, similarity, registrar, registered, recent_dns |
ScanRecord | scan, get_scan_crawl_results | scan_id, response (a ScanResponse) |
YaraMatchRecord | yara_matches | host, ip, path, title, hash, response_date, match_time, row_ids, html |
ProjectIndicator | project_indicators | key, key_type, tags, note, alert, added, added_by |
OpenDirCrawl, OpenDirFile, OpenDirDirectory, OpenDirEntry, OpenDirCapture, OpenDirFileContent | open-directory methods | ids, url, host, ip, size, hashes, timestamps |
Parsed timestamps can be None when the source omits the date.
Error handling
from validin import Client, ApiError, AuthError, ValidinError
client = Client()
try:
results = client.dns_history("example.com")
except AuthError:
print("API key rejected")
except ApiError as e:
print(f"HTTP {e.status_code} [{e.code}]: {e.message}")
except ValidinError as e:
print(f"SDK error: {e}")| Exception | When |
|---|---|
ValidinError | Base class for SDK errors. |
ApiError | The API returned a non-success status. Has status_code, message, url, code, indicator, and to_dict(). |
AuthError | Subclass of ApiError: the API rejected the key. code is always "auth_failed". |
UnsupportedIndicatorError | The lookup doesn’t support the indicator type. This is a ValueError for a single lookup. In bulk history and reputation lookups, check for unsupported_indicator in results.errors. |
ValueError | Invalid arguments, such as an out-of-range limit, a bad project tag or a missing API key at client construction. |
TimeoutError | ScanJob.wait() ran out of time. |
requests.RequestException | Network failure on a single request or after a bulk lookup exhausts its retries. |
ApiError.code is a stable, machine-readable string:
| Status | code |
|---|---|
| 400, 422 | bad_request |
| 401 (and rejected-key 403s) | auth_failed |
| 403 | forbidden (not_found for an unknown threat key, bad_request when OSINT history refuses a public suffix) |
| 404 | not_found |
| 408 | timeout |
| 429 | rate_limited |
| 5xx | server_error |
| other | api_error |
Check results.errors for individual failures. A rejected key, an exhausted rate limit or a persistent network failure stops the batch.
Updated about 8 hours ago
