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://www.citeflow.io/api/v1",  # default; override only for staging/self-hosted
    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.1.tar.gz (7.6 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.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: citeflow_python-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 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.1.tar.gz
Algorithm Hash digest
SHA256 74250ea513e1f897a06e6aa9b650f5618225a2f952f2f15284bf0c4b833ade3c
MD5 6684bbebbc8a0a6e5850a09b674ede7d
BLAKE2b-256 4fd77253f6677cdfea61e06e33d9148fe37b9e20812a270a2b12c6d8e1c0b7ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for citeflow_python-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b278cff617ee8adf5b3bd350417616c61a7f567717efbcdb752eb09b96cc3c8
MD5 c09de3ddca0a65f17355735f92c0337b
BLAKE2b-256 d07d3a3b42f810058323a92e7e0ce22c9b045809eb1c9a761407c4ac1229d332

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