HTTP API & protocol
The HTTP API and wire protocol behind the SDKs, how to run your own instance, and answers to common questions.
On this page
The five SDKs are clients of one small HTTP API, served by a single stateless Cloudflare Worker at
https://api.sponsorkit.io. The pages people see (this website, including the consent and checkout pages) are a
separate static site on GitHub Pages at https://ffmathy.github.io/sponsorkit. Most apps never call the API
directly. Read this section if you want to:
- call the API without an SDK, for example to verify sessions from a backend in another language: HTTP API;
- understand or review the design, or write an SDK for another language: Wire protocol;
- run your own instance on your own domain: Self-hosting;
- find a quick answer about cost, providers, privacy or reliability: FAQ.
Source documents#
The normative definitions live in the repository, next to the code:
docs/PROTOCOL.md: exactly what goes over the wire, including where the site and the API live. The Worker, the static pages, the conformance suite and every SDK follow it.docs/SPEC.md: why Sponsorkit works the way it does, including the trade-offs and the decisions behind them.sdks/conformance: a fake API and the scenarios every SDK must pass. A new SDK is complete when it passes all of them.
At a glance#
| Endpoint | Auth | Purpose |
|---|---|---|
GET /api/v1/targets | none | Public metadata about your accounts: existence, name, avatar, currency, tiers. |
POST /api/v1/auth/token | sign-in code + PKCE verifier | Exchanges a sign-in code for a session token. |
GET /api/v1/contributions | Bearer sks_… | The supporter's live contributions to the session's targets. |
GET /api/v1/health | none | Whether each provider is reachable. |
Sign-in and checkout run in the browser through the site's /connect/ and /checkout/ pages, which hand over to
the API's /api/oauth/… endpoints; see Wire protocol.