Skip to main content
This page is the implementation path for a V1 partner integration: register an app, complete OAuth, create a customer, collect consent, send events, and read a profile.

Requirements

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.
Every redirect_uri must match a registered URI exactly. Wildcards are not accepted in production.
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.
Send an Idempotency-Key header on mutating calls. Replays return the original result. A reused key with a different body returns 409 idempotency_conflict.
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.

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.
Example response:
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.
Poll GET /v1/connection-sessions/:session_id until status is authorized or completed. 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, include consent_purpose and an Idempotency-Key.
202 response. The event is accepted and queued; heavier projection is asynchronous.
Batch the same shape to POST /v1/events/batch (1–100 events).

6. Read the resolved profile and intents

Reads are synchronous and scoped to the caller plus optional consent_purpose.
Sample profile and intent bodies are on outputs.

7. Register a webhook endpoint

Delivery of those events is near-term. Registration and secret issuance are live so you can build the receiver during the pilot.

OAuth token exchange

If you are not using the SDK auth helper, the raw PKCE exchange is:
Discovery lives at 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.
Common codes: idempotency_key_required, idempotency_conflict, consent_required, invalid_scope, invalid_redirect_uri.

Next