Skip to main content

Webcite Python SDK

Webcite is an API for document parsing and claim verification. It reads PDFs, scans, spreadsheets and office files into Markdown with per-page provenance, checks claims against web sources or your own documents, and returns citations bound to the quotes that support or contradict them. On ParseBench 2, Webcite extraction scored 91.74 overall (ranking pending approval by LlamaIndex). This package is the official Python client for the Webcite API.

pip install webcite

Python 3.9 or newer. The only dependency is httpx.

First call

from webcite import Webcite

client = Webcite()  # reads WEBCITE_API_KEY
result = client.verify("The Great Wall of China is visible from the Moon with the naked eye.")
group = result["claim_groups"][0]
print(group["verdict"]["result"], result["usage"]["credits"])
for citation in group["citations"][:1]:
    print(citation["stance"], citation["url"])

Recorded output (from the saved response at webcite.co/samples/claim-great-wall.json, recorded from the API on 24 November 2026):

contradicted 4
contradicts https://www.nasa.gov/image-article/great-wall/

A verification costs 4 credits with the default stance and verdict. The Free plan includes 100 credits.

Parse a document

from webcite import Webcite

client = Webcite()
asset = client.upload("irs-form-w9-page-1.pdf")["data"]
doc = client.extract(asset["asset_id"])
print(doc["state"], doc["usage"]["credits"])
print(doc["markdown"].splitlines()[0])

Recorded output (saved response at webcite.co/samples/doc-irs-w9.json):

complete 0.4966
Form **W-9**

Uploading is free. Extraction is charged per page at cost. Check state before using markdown: complete: false and lost name parts that were not recovered. The request stays open until every page is read; there is no job to poll. extract_pages() returns anchored chunks for indexing and extract_figures() returns every recognised number with its source.

Check quotes against sources

sec = "https://www.sec.gov/Archives/edgar/data/320193/000032019324000123/aapl-20240928.htm"
results = client.verify_batch([
    {"id": "q1", "quote": "Total net sales 391,035", "url": sec},
    {"id": "q2", "quote": "Revenue was $12 million.", "asset_id": asset["asset_id"], "page": 1},
])
for item in results:
    print(item)

Search sources and preview evidence

found = client.search("Apple total net sales fiscal 2024", limit=5)
preview = client.source_preview(url=found["citations"][0]["url"], quote="Total net sales")

Stream a verification

for event in client.verify_stream("The Eiffel Tower is 330 meters tall"):
    print(event["data"].get("type"))

The iterator raises IncompleteStreamError (with the events received so far) if the stream ends without a result and a later done event, or reports error.

Ask a question over a document

job = client.ask("What was revenue in FY2025?", doc["markdown"])
answer = client.wait_for_ask(job["id"])  # polls GET /api/v1/ask/{id}
print(answer["status"])

wait_for_ask stops on done or failed. After max_wait seconds (600 by default) it returns the latest job view instead of raising, so you can keep polling.

Credits

print(client.balance()["credits"]["remaining"])  # free

Async

import asyncio
from webcite import AsyncWebcite

async def main() -> None:
    async with AsyncWebcite() as client:
        result = await client.verify("The Eiffel Tower is 330 meters tall")
        print(result["claim_groups"][0]["verdict"]["result"])

asyncio.run(main())

Every method on Webcite exists on AsyncWebcite.

Authentication

Create a key on the API Keys page (sign-in required) and set it as WEBCITE_API_KEY, or pass Webcite(api_key=...). The key is sent in the x-api-key header. Keep it on your server; never put it in frontend code, a public repository or a chat with an AI agent. The webcite command line tool in the TypeScript package can store a key with webcite login.

Self-hosted deployments

Set WEBCITE_API_URL or pass base_url:

client = Webcite(base_url="https://webcite.internal.example.com")

The default is https://api.webcite.co. A key works only against the environment that issued it.

Errors

Every error is a webcite.WebciteError with status, code, message (the server's text), next_step, doc_url and retry_after.

Error When
AuthenticationError 401, or no key. next_step points to the API keys page.
PermissionDeniedError 403. App keys cannot upload or extract.
NotFoundError 404. The ID does not belong to this account.
ConflictError 409. An Idempotency-Key was reused with a different payload.
InsufficientCreditsError The balance is below the cost. Nothing was charged.
RateLimitError 429. retry_after is in seconds.
ServerError 5xx.
WebciteTimeoutError, WebciteConnectionError The request did not complete.
IncompleteStreamError A stream ended without a result and done.
import webcite

try:
    client.verify("...")
except webcite.InsufficientCreditsError as err:
    print(err.message, err.next_step)

Retries and timeouts

GET requests and verify() are retried up to twice on 429 and 5xx, with backoff that honours Retry-After. verify() sends an Idempotency-Key, so a retry is not charged twice. Other paid calls (extraction, batch, upload) are never repeated automatically; a timeout does not prove the server did no work. The default timeout is 15 minutes, matching the extraction docs; pass timeout= (seconds or an httpx.Timeout) and max_retries= to change them.

The SDK sends no telemetry. Each request carries x-webcite-surface: sdk-python and a webcite-python/<version> user agent, which Webcite stores as labels only.

Use with agent frameworks

Short runnable examples are in examples/frameworks/:

Framework File How it connects
LangChain langchain_agent.py langchain-webcite tools and retriever
Haystack haystack_pipeline.py webcite-haystack components
CrewAI crewai_mcp.py Hosted MCP server
Google ADK google_adk_mcp.py Hosted MCP server through McpToolset
OpenAI Agents SDK openai_agents_mcp.py Hosted MCP server through MCPServerStreamableHttp
Pydantic AI pydantic_ai_mcp.py Hosted MCP server through MCPToolset

The MCP examples list the Webcite tools without calling a model when run with no arguments.

Development

make install
make check   # ruff, mypy --strict, pytest; no network calls

MIT licensed.

Metadata

Release files for webcite 0.1.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 webcite 0.1.0
File Size Uploaded Provenance Actions
webcite-0.1.0.tar.gz 70.3 kB Without provenance Details for webcite-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 92.7 kB

Release files / webcite-0.1.0.tar.gz

Download URL webcite-0.1.0.tar.gz
Size 70.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a9df5c924431ba2c4fac255f9873b5f1c02f1af9bf643f7f1cc0cb8f6d1952b6
BLAKE2b-256 checksum
How to use checksums
96ec1c086094f58b5fc8fe0deb31d63ede6766bc4e8f18b13aeb44824c05217d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / webcite-0.1.0-py3-none-any.whl

Download URL webcite-0.1.0-py3-none-any.whl
Size 22.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f603d89e7405343566fa2bf5c9c1e7b5c1a0eaec7f4091679dc6db907f99031
BLAKE2b-256 checksum
How to use checksums
970d3ecfb9fda8784e004fb08d2978cc49b207f548e3b39db26233687c1efa70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for webcite 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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