SDK + curl

Drop-in API examples

Augur ships an OpenAPI 3.1 spec at /api/v1/openapi.yaml — feed it into Stainless, openapi-generator or Postman for an auto-typed SDK. Below are the three handwritten templates most teams start from.

curl

# Mint a key first at https://augur.news/settings/api-keys

# Identity canary
curl -H "Authorization: Bearer $AUGUR_KEY" \
  https://augur.news/api/v1/me

# List your zones
curl -H "Authorization: Bearer $AUGUR_KEY" \
  https://augur.news/api/v1/zones

# Create a zone
curl -X POST -H "Authorization: Bearer $AUGUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Rotterdam port",
    "lat": 51.95,
    "lon": 4.14,
    "radius_km": 25,
    "min_severity": 60,
    "shape_type": "circle"
  }' \
  https://augur.news/api/v1/zones

# Recent alerts
curl -H "Authorization: Bearer $AUGUR_KEY" \
  "https://augur.news/api/v1/alerts?days=7&limit=200"

# Resolve an alert
curl -X PATCH -H "Authorization: Bearer $AUGUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resolved": true, "note": "Patched per runbook"}' \
  https://augur.news/api/v1/alerts/<alert_id>

# Usage analytics
curl -H "Authorization: Bearer $AUGUR_KEY" \
  "https://augur.news/api/v1/analytics?days=30"

# Audit log
curl -H "Authorization: Bearer $AUGUR_KEY" \
  "https://augur.news/api/v1/audit?days=30&limit=100"

JavaScript / TypeScript

// Augur SDK in 30 lines of TypeScript / JavaScript.
// Drop into any Node.js / Bun / Deno project.
const BASE = "https://augur.news/api/v1";
const KEY = process.env.AUGUR_KEY ?? "";

async function augur<T>(path: string, init: RequestInit = {}): Promise<T> {
  const r = await fetch(`${BASE}${path}`, {
    ...init,
    headers: {
      authorization: `Bearer ${KEY}`,
      "content-type": "application/json",
      ...(init.headers ?? {}),
    },
  });
  if (!r.ok) {
    throw new Error(`Augur ${path} ${r.status}: ${await r.text()}`);
  }
  return (await r.json()) as T;
}

// Identity
const me = await augur<{ user_id: string; plan: string }>("/me");
console.log(`Signed in as ${me.user_id} on plan ${me.plan}`);

// List zones
const { zones } = await augur<{ zones: Array<{ id: string; label: string }> }>(
  "/zones",
);

// Create zone
const created = await augur<{ zone: { id: string } }>("/zones", {
  method: "POST",
  body: JSON.stringify({
    label: "Rotterdam port",
    lat: 51.95,
    lon: 4.14,
    radius_km: 25,
    min_severity: 60,
  }),
});

// Resolve alert
await augur(`/alerts/${alertId}`, {
  method: "PATCH",
  body: JSON.stringify({ resolved: true, note: "Closed" }),
});

// Usage analytics for a dashboard
const stats = await augur<{
  alerts_window: number;
  alerts_by_day: Array<{ day: string; count: number }>;
}>("/analytics?days=30");

Python

"""Augur SDK in ~30 lines of Python (requests)."""
import os
import requests

BASE = "https://augur.news/api/v1"
KEY = os.environ["AUGUR_KEY"]


def _hdrs() -> dict:
    return {"Authorization": f"Bearer {KEY}", "Content-Type": "application/json"}


def get(path: str) -> dict:
    r = requests.get(f"{BASE}{path}", headers=_hdrs(), timeout=15)
    r.raise_for_status()
    return r.json()


def post(path: str, body: dict) -> dict:
    r = requests.post(f"{BASE}{path}", headers=_hdrs(), json=body, timeout=15)
    r.raise_for_status()
    return r.json()


def patch(path: str, body: dict) -> dict:
    r = requests.patch(f"{BASE}{path}", headers=_hdrs(), json=body, timeout=15)
    r.raise_for_status()
    return r.json()


# Identity canary
me = get("/me")
print(f"Signed in as {me['user_id']} on plan {me['plan']}")

# List zones
zones = get("/zones")["zones"]

# Create zone
created = post("/zones", {
    "label": "Rotterdam port",
    "lat": 51.95,
    "lon": 4.14,
    "radius_km": 25,
    "min_severity": 60,
})

# Resolve alert
patch(f"/alerts/{alert_id}", {"resolved": True, "note": "Patched"})

# Pull a 30-day analytics summary for a Looker / Metabase dashboard
stats = get("/analytics?days=30")