Requirements
Partner application
Partner application
A confidential backend that can store
client_id and client_secret. Public/browser clients can start connection sessions but must not hold the client secret.Exact redirect URIs
Exact redirect URIs
Every
redirect_uri must match a registered URI exactly. Wildcards are not accepted in production.OAuth 2.1 with PKCE
OAuth 2.1 with PKCE
Authorization-code flow only.
code_challenge_method must be S256. Access tokens are short-lived (about 15 minutes). Refresh tokens rotate when offline_access is granted.Consent before events
Consent before events
POST /v1/events is rejected without a valid consent receipt for the event’s consent_purpose.Idempotency
Idempotency
Send an
Idempotency-Key header on mutating calls. Replays return the original result. A reused key with a different body returns 409 idempotency_conflict.Scopes
Scopes
Request only the scopes you will call. A typical profile-reading integration uses
connections:write, consent:write, events:write, profile:read, claims:read, and intents:read.Recommended scope templates
1. Configure the client
2. Create or upsert the partner customer
The customer is your user. You do not need their global Swapnice user id.Customer
profile accepts public display fields only (username, bio_markdown, avatar_url, banner_url, coarse public location). Do not send payment, government-id, or credential data.3. Start a connection session
This is the Plaid-Link-style step: your app opens a Swapnice-hosted connection URL so the user can authorize the link.GET /v1/connection-sessions/:session_id until status is authorized or completed.
4. Record the consent receipt
After the user accepts, persist the receipt. Events for a purpose are rejected until this exists.5. Ingest a consented event
The SDK can emit this from an observer. A backend can POST the same payload. Either way, includeconsent_purpose and an Idempotency-Key.
202 response. The event is accepted and queued; heavier projection is asynchronous.
POST /v1/events/batch (1–100 events).
6. Read the resolved profile and intents
Reads are synchronous and scoped to the caller plus optionalconsent_purpose.
7. Register a webhook endpoint
OAuth token exchange
If you are not using the SDK auth helper, the raw PKCE exchange is:GET /.well-known/oauth-authorization-server.
Error shape
All Partner API errors use a stable machine-readable code and a request id. They never include secrets or private wallet data.idempotency_key_required, idempotency_conflict, consent_required, invalid_scope, invalid_redirect_uri.
Next
- Authentication — PKCE, scopes, and token errors
- Consent and account linking
- Events and intent ontology
- Request walkthrough
- What data is collected
- API reference