Skip to main content

Official Python SDK for the CiteFlow API (SEO, AEO, GEO audits).

Project description

citeflow-python

Official Python SDK for the CiteFlow Partner API — programmatic SEO, AEO, and GEO audits.

CiteFlow is an AI-visibility scanner: it audits how well a website can be crawled, understood, and cited by AI search engines (ChatGPT, Claude, Perplexity, Google AI Overviews). This SDK lets partners run those audits from their own products via the CiteFlow Partner API.

Install

pip install citeflow-python

Python 3.9+ required. Depends on requests.

Quickstart

import os
from citeflow import Citeflow

client = Citeflow(api_key=os.environ["CITEFLOW_API_KEY"])

# Create an audit and wait for the result (~30s for SEO).
audit = client.audits.create(url="https://example.com", type="seo")
result = client.audits.wait_for_completion(audit["audit_id"], timeout=90)

if result["status"] == "complete":
    print("Scores:", result["scores"])
elif result["status"] == "failed":
    print("Failure:", result["failure_reason"])

# Check remaining balance.
b = client.balance.retrieve()
print(f"Balance: {b['balance_usd']} ({b['balance']} credits)")

Features

  • Auto-retry on 429 and 5xx with exponential back-off + jitter. Honors Retry-After.
  • Auto Idempotency-Key on every POST — safe to retry on network failure without double-charging.
  • wait_for_completion polling helper with configurable timeout.
  • HMAC webhook verification with timestamp tolerance + rotation grace handling.
  • Pluggable requests.Session for custom proxies / adapters.

Webhook verification

from citeflow import verify_webhook_signature, parse_webhook_event, CiteflowSignatureError

# In your webhook handler (Flask, FastAPI, Django, …):
raw_body = request.get_data()  # bytes — do NOT JSON-parse first
try:
    event = parse_webhook_event(
        raw_body=raw_body,
        headers=request.headers,
        secret=os.environ["CITEFLOW_WEBHOOK_SECRET"],
    )
    # event["type"] in {"audit.completed", "audit.failed", "audit.cancelled", "balance.low"}
    print(event["id"], event["type"], event["data"])
    return "", 200
except CiteflowSignatureError:
    return "", 400

Errors

from citeflow import CiteflowError

try:
    client.audits.create(url="invalid", type="seo")
except CiteflowError as err:
    print(err.code, err.request_id)
    if err.code == "INSUFFICIENT_CREDITS":
        print(f"Need {err.required} more credits")

Full error catalog: https://citeflow.io/help/partner-api#troubleshooting.

Configuration

client = Citeflow(
    api_key="ckf_…",
    base_url="https://citeflow.io/api/v1",  # override for staging
    timeout=30.0,                            # per-request seconds
    max_retries=3,                           # for 429 + 5xx + network
)

License

MIT. CiteFlow API itself is a paid service — see https://citeflow.io/terms-of-service.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

citeflow_python-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

citeflow_python-0.1.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file citeflow_python-0.1.0.tar.gz.

File metadata

  • Download URL: citeflow_python-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for citeflow_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ceb98ef94312d78f1c9efe01d4288f04dafa3413904db2b2b215c5363f4ac048
MD5 d22ac9762699a26006e05b6ff270e4c8
BLAKE2b-256 46ad4d661ac427c0286ea4241c96ecd88a4446dec561c8e1ff88f7c5f58b91cf

See more details on using hashes here.

File details

Details for the file citeflow_python-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for citeflow_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec70e4d2e0625358187fa00ad058d2e5a764728e150a6bbe260a3320e93ebad3
MD5 cf81dc511c0bbaea02de0e4cb0b94ff9
BLAKE2b-256 da08ef260579c1ce261897ccff4ba6724fcbada63f168fc1483a19b9e4730613

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page