Skip to main content

Connect your agent to our attendance API

We give every customer a public API key so your team — or your AI agent — can pull your weekly attendance data straight into whatever app, spreadsheet, or workflow you already use. This page is the quick-start: get a key, drop in one of the example snippets, and you're done.

What's in the skill package

The bundle below contains a Claude Code skill manifest plus working copy-and-paste examples. Drop the kingdommetrics-attendance folder into your Claude Code .claude/skills/ directory and your agent will know how to authenticate and pull data on your behalf.

The shortest possible request

Once you have a key, this is the whole API:

curl -H "Authorization: Bearer km_pub_<your-key>" \
  "https://api.kingdommetrics.com/public/v1/attendance?start_date=2026-04-01&end_date=2026-04-30"

You'll get back something like:

{
  "data": [
    {
      "venue_id": "65f...",
      "venue": "Main Campus",
      "date": "2026-04-06",
      "event": "Sunday 9:30am",
      "scheduled_start_utc": "2026-04-06T13:30:00Z",
      "count": 412,
      "status": "ok"
    },
    {
      "venue_id": "65f...",
      "venue": "Main Campus",
      "date": "2026-04-13",
      "event": "Sunday 9:30am",
      "scheduled_start_utc": "2026-04-13T13:30:00Z",
      "count": null,
      "status": "missing"
    }
  ],
  "next_cursor": null
}

Every scheduled service in your range comes back as a row, even if no count was captured — those have count: null and a status of missing (not scheduled to capture), pending (capture in flight), or ok (final, dashboard-matching number).

Python (one file)

import os, requests

BASE = "https://api.kingdommetrics.com/public/v1"
KEY  = os.environ["KM_API_KEY"]

resp = requests.get(
    f"{BASE}/attendance",
    headers={"Authorization": f"Bearer {KEY}"},
    params={"start_date": "2026-04-01", "end_date": "2026-04-30"},
    timeout=30,
)
resp.raise_for_status()
for row in resp.json()["data"]:
    print(f"{row['date']}  {row['event']:25s}  {row['count'] or '—'}  ({row['status']})")

Node (no dependencies)

const KEY = process.env.KM_API_KEY;
const url = new URL("https://api.kingdommetrics.com/public/v1/attendance");
url.searchParams.set("start_date", "2026-04-01");
url.searchParams.set("end_date",   "2026-04-30");

const r = await fetch(url, { headers: { Authorization: `Bearer ${KEY}` } });
if (!r.ok) throw new Error(`KM API ${r.status}`);
const { data } = await r.json();
for (const row of data) {
  console.log(row.date, row.event.padEnd(25), row.count ?? "—", `(${row.status})`);
}

Pagination

Long ranges page via an opaque next_cursor. Pass it back as ?cursor=… on the next request to continue. When it comes back null, you've got the whole window.

Limits and etiquette

  • Default rate limit: 100 requests / day per key. Counter resets at UTC midnight. Need more? Email [email protected] — we raise limits per-customer on request.
  • Date range capped at 90 days per request — page through with cursor for longer windows.
  • Keys are scoped to your account only. They cannot read another customer's data, even if presented at the same hostname.
  • Lost the key? Revoke it in Settings → Integrations and create a new one.

Need help?

Email [email protected] with the label of the key you're using and the rough timestamp of any failing request — we keep an audit log on our end and can usually tell you exactly what went wrong.