SDKs & Examples

Official SDKs & Code Examples

Integrate AdvisorAI into your application in minutes. Pick the SDK for your language or talk directly to the REST API.

View on GitHub

Install

pip install advisorai

Example

Python
import requests

BASE = "https://advisorai-backend.fly.dev/api/v1"

# Option A: API Key (sk_ prefix) — no expiry, great for CI/CD
headers = {"X-API-Key": "sk_your_api_key_here"}

# Option B: JWT login
res = requests.post(f"{BASE}/auth/login",
    json={"email": "you@co.com", "password": "••••"})
headers = {"Authorization": f"Bearer {res.json()['access_token']}"}

# Upload a document
with open("./compliance_policy.pdf", "rb") as f:
    doc = requests.post(f"{BASE}/documents/upload",
        headers=headers, files={"file": f}).json()
print(f"Document ready: {doc['id']}")

# Ask a question
answer = requests.post(f"{BASE}/advisor/ask",
    headers=headers,
    json={"query": "What are our VAT filing deadlines?"}
).json()
print(answer["answer"])
print("Sources:", answer["sources"])

# Check compliance score
score = requests.get(f"{BASE}/analytics/compliance-score",
    headers=headers).json()
print(f"Score: {score['compliance_score']}%")

Community examples

Built by the AdvisorAI community. Open source, free to use.

Python142

FastAPI middleware example

Drop-in middleware to add AdvisorAI-powered search to any FastAPI app.

TypeScript89

Next.js starter template

Full-stack starter with AdvisorAI SDK, Tailwind, and shadcn/ui pre-wired.

No-code57

Zapier integration template

Trigger AdvisorAI questions from any Zapier workflow using webhooks.

Start building

Start building with AdvisorAI

Free API key included with every account. No credit card required.