Skip to main content

urlscan-python

PyPI version

The official Python API client for urlscan.io.

Requirements

  • Python 3.10+

Installation

pip install urlscan-python

Quickstart

Start by importing urlscan module:

import urlscan

Create a client with your API key:

with urlscan.Client("<your_api_key>") as client:
    ...

[!NOTE] The recommended way to use Client is as a context manager like the above. This will ensure closing a connection when leaving the with block.

Alternatively, you can explicitly close the connection pool without block-usage using ._close():

client = urlscan.Client("<your_api_key>")
try:
    ...
finally:
    client._close()

Scan a URL:

res = client.scan("<url>", visibility="public")
uuid: str = res["uuid"]

Wait for a scan result:

client.wait_for_result(uuid)

Get a scan result:

result = client.get_result(uuid)

Bulk scan:

client.bulk_scan(["<url>", "<url>"], visibility="public")

Alternatively, you can use _and_get_result(s) suffixed methods to do scan, wait and get at once.

client.scan_and_get_result("<url>", visibility="public")
client.bulk_scan_and_get_results(["<url>", "<url>"], visibility="public")

urlscan.Client.search() returns an iterator to iterate search results:

for result in client.search("page.domain:example.com"):
    print(result["_id"])

Pro

Use Pro class to interact with the pro API endpoints:

from urlscan import Pro

with Pro("<your_api_key>") as client:
    res = client.livescan.scan("<url>", scanner_id="us01")
    resource_id: str = res["uuid"]
    result = client.livescan.get_resource(scanner_id="us01", resource_id=resource_id, resource_type="result")

Examples

See Examples.

References

Help Wanted?

Please feel free to to open an issue if you find a bug or some feature that you want to see implemented.

Metadata

Release files for urlscan-python 2026.8.18

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

Source distribution (sdist)

Source distribution for urlscan-python 2026.8.18
File Size Uploaded Provenance
urlscan_python-2026.8.18.tar.gz 112.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for urlscan-python 2026.8.18
File Interpreter ABI Platform
urlscan_python-2026.8.18-py3-none-any.whl Python 3 none any Details

Total release size: 140.2 kB

Release files / urlscan_python-2026.8.18.tar.gz

Download URL urlscan_python-2026.8.18.tar.gz
Size 112.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b96c8a36d32072171ee0d8a03f407ec1c6c58c5c1633d8fba97ff77cadd0a983
BLAKE2b-256 checksum
How to use checksums
1035f30f166e1760194cc7dec203ba6fcb0f3a6ca58a5f68e189bf2d2ca9c80a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 18, 2026.

Transparency log

Release files / urlscan_python-2026.8.18-py3-none-any.whl

Download URL urlscan_python-2026.8.18-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8709d76bc76281dc8f5969f4d3e01de067d68415783373e7838f1818ccf7892
BLAKE2b-256 checksum
How to use checksums
4c1e8d5126b9d06029b3505ffd1a0508ec95b23f500db0fc6a3c91c309ab913c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 18, 2026.

Transparency log

Security for urlscan-python 2026.8.18

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for urlscan_python-2026.8.18.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 Aug 18, 2026.

Transparency log

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