Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.neariq.io/llms.txt

Use this file to discover all available pages before exploring further.

The NearIQ Python SDK is coming soon. Use the REST API directly in the meantime.

Using requests

import os
import requests

NEARIQ_KEY = os.environ["NEARIQ_API_KEY"]
BASE_URL = "https://app.neariq.io/api/v1"

def neariq(path: str, params: dict = None):
    res = requests.get(
        f"{BASE_URL}{path}",
        headers={"X-NearIQ-Key": NEARIQ_KEY},
        params=params,
        timeout=10,
    )
    res.raise_for_status()
    return res.json()

# Get your business profile
me = neariq("/me")
print(f"{me['name']}: {me['rating']} stars ({me['reviewCount']} reviews)")

# Get alerts from the past week
from datetime import datetime, timedelta, timezone
since = (datetime.now(timezone.utc) - timedelta(days=7)).isoformat()
alerts = neariq("/me/alerts", {"since": since, "severity": "warning"})
print(f"{alerts['total']} warnings this week")

Using httpx (async)

import httpx
import asyncio

async def get_alerts():
    async with httpx.AsyncClient() as client:
        res = await client.get(
            "https://app.neariq.io/api/v1/me/alerts",
            headers={"X-NearIQ-Key": NEARIQ_KEY},
        )
        res.raise_for_status()
        return res.json()

alerts = asyncio.run(get_alerts())