Where the Swapnice SDK and Partner API overlap, and where their capabilities differ.
Both surfaces talk to the same Partner API. The SDK is the supported way to integrate. The REST API is the stable contract underneath it.The important difference is not “SDK can read profiles and the API cannot.” Both can. The SDK adds client-side collection, consent UX, retries, and typed helpers that a raw HTTP integration would otherwise have to build.
Quick comparison
Capability
TypeScript / Python SDK
Raw Partner API
OAuth 2.1 + PKCE token exchange
Built in
You implement
Connection session + consent UX
SDK presents or embeds the connect flow
You host redirects and poll session status
Automatic client-event capture
Yes, when you register observers
No. You must construct and POST every event
Device and session context enrichment
Added by the runtime SDK
You must attach context yourself
Offline queue and retry
Yes
You implement
Idempotency keys
Generated and retried for you
Required header on every mutating call
Typed requests and errors
Generated from the OpenAPI contract
You validate payloads
Server-to-server batch ingest
SDK events.batch helper
POST /v1/events/batch
Profile, claims, and intent reads
SDK read methods
GET /v1/profiles/:id and related routes
Webhook, app, and catalog admin
Thin SDK wrappers
Full HTTP surface
Consumer app Firebase APIs
Not available
Not available
If a teammate heard that “the SDK has more functionality,” this is what that means: the SDK can observe in-app behavior, run the Swapnice connection and consent flow, and keep events ordered through retries. The API can accept the same events and return the same profiles, but it will not collect or consent for you.
Use the SDK when
You are embedding Swapnice in a mobile app, web app, or checkout surface
You want Swapnice to collect consented first-party events as users move through your product
You need the hosted connection and consent experience rather than a custom OAuth UI
You want typed clients, automatic idempotency, and token refresh
Install the generated client:
npm install swapnice-sdk-ts
import { SwapniceClient } from "swapnice-sdk-ts";const swapnice = new SwapniceClient({ environment: "development", clientId: process.env.SWAPNICE_CLIENT_ID!, clientSecret: process.env.SWAPNICE_CLIENT_SECRET!,});
The same OpenAPI contract also generates a Python client for backend jobs.
Use the API directly when
A partner backend or ETL job is the only writer
You already collected consent in your own UI and only need to POST receipts and events
You are registering webhook endpoints, managing apps, or rebuilding ontologies
You are debugging with cURL, Postman, or an API gateway
Every SDK method maps to a documented HTTP route in the API reference. Replays and server jobs can call those routes without the client SDK.
What neither surface does
Neither the SDK nor the Partner API exposes Swapnice consumer-app internals:
Wallet, Dwolla, or Plaid credentials
NFC pack activation internals
Private account fields from the consumer user record
Another partner’s raw events or unresolved identities
Installing the SDK does not expand the purposes a user granted. Events collected for personalization stay unavailable for another purpose until that purpose is granted.
Capability split in practice
The usual split is:
Client SDK in the consumer-facing app to connect, collect consent, and observe product interactions.
Partner backend + API or server SDK to upsert customers, register webhooks, and read profiles and intents for the partner product.
See integration for the combined implementation path.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Swapnice","colors":{"primary":"#EF3E36","light":"#ff7461","dark":"#EF3E36"},"logo":{"light":"https://mintcdn.com/swapnice/nmF9u4u0noYUQzdF/logo/light.svg?fit=max\u0026auto=format\u0026n=nmF9u4u0noYUQzdF\u0026q=85\u0026s=2c31758780e3cecce18a07ca724b6ad0","dark":"https://mintcdn.com/swapnice/lQq8ZnnZLyVWSgup/logo/dark.svg?fit=max\u0026auto=format\u0026n=lQq8ZnnZLyVWSgup\u0026q=85\u0026s=69754cecc5b10ffe26a54cae0520a4bb"},"favicon":"https://mintcdn.com/swapnice/lQq8ZnnZLyVWSgup/favicon.svg?fit=max\u0026auto=format\u0026n=lQq8ZnnZLyVWSgup\u0026q=85\u0026s=0723e8f00210bfaf5bbeb07ddf9cb98d","api":{"openapi":["openapi.yaml"],"playground":{"display":"interactive"},"examples":{"languages":["curl","javascript","python"]}},"navbar":{"links":[{"icon":"code","href":"/partners/introduction","label":"Partner SDK"},{"icon":"square-terminal","href":"/partners/api-overview","label":"API Reference"},{"href":"mailto:api@swapnice.com","label":"Support"}],"primary":{"type":"button","label":"Get the SDK","href":"/partners/integration"}},"footer":{"socials":{"x":"https://x.com/swapnice","github":"https://github.com/swapnice","linkedin":"https://www.linkedin.com/company/swapped-inc"}},"search":{"prompt":"Search Partner SDK, API, or app guides"},"banner":{"content":"Integrating Swapnice? Start with the [Partner SDK](/partners/introduction) — sample code, data flow, and sandbox access.","dismissible":true},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Partner SDK","icon":"code","href":"/partners/introduction"},{"anchor":"Get the SDK","icon":"download","href":"/partners/integration"},{"anchor":"API Reference","icon":"square-terminal","href":"/partners/api-overview"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"swapnice","hasAudioNarration":false,"actualSubdomain":"swapnice","customDomains":[],"gitSource":{"type":"github","owner":"swapnice","repo":"swapnice-documentation","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{},"buildId":"6a91bb8a762748b8809410ef","clientVersion":"0.0.4336","searchFilterCounts":[{"language":"default","tag":"Partner SDK \u0026 API","count":59},{"language":"default","tag":"API Reference","count":43},{"language":"default","tag":"Guides","count":16},{"language":"default","tag":"Swapnice App","count":14},{"language":"default","tag":"Swapnice Features","count":11},{"language":"default","tag":"Entries and ontologies","count":7},{"language":"default","tag":"OAuth","count":7},{"language":"default","tag":"Consent","count":5},{"language":"default","tag":"Get started","count":5},{"language":"default","tag":"Integrate","count":5}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"main.css","content":""}]}
{"page":{"pagePath":"partners/sdk-vs-api","slug":"/partners/sdk-vs-api","pageMetadata":{"title":"SDK versus API","description":"Where the Swapnice SDK and Partner API overlap, and where their capabilities differ.","href":"/partners/sdk-vs-api"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Where the Swapnice SDK and Partner API overlap, and where their capabilities differ.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Mermaid,Table,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Mermaid)_missingMdxReference(`Mermaid`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Both surfaces talk to the same Partner API. The SDK is the supported way to integrate. The REST API is the stable contract underneath it.`}),`\n`,_jsx(_components.p,{children:`The important difference is not “SDK can read profiles and the API cannot.” Both can. The SDK adds client-side collection, consent UX, retries, and typed helpers that a raw HTTP integration would otherwise have to build.`}),`\n`,_jsx(Heading,{level:`2`,id:`quick-comparison`,children:`Quick comparison`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Capability`}),_jsx(_components.th,{children:`TypeScript / Python SDK`}),_jsx(_components.th,{children:`Raw Partner API`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`OAuth 2.1 + PKCE token exchange`}),_jsx(_components.td,{children:`Built in`}),_jsx(_components.td,{children:`You implement`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Connection session + consent UX`}),_jsx(_components.td,{children:`SDK presents or embeds the connect flow`}),_jsx(_components.td,{children:`You host redirects and poll session status`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Automatic client-event capture`}),_jsx(_components.td,{children:`Yes, when you register observers`}),_jsx(_components.td,{children:`No. You must construct and POST every event`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Device and session context enrichment`}),_jsx(_components.td,{children:`Added by the runtime SDK`}),_jsxs(_components.td,{children:[`You must attach `,_jsx(_components.code,{children:`context`}),` yourself`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Offline queue and retry`}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`You implement`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Idempotency keys`}),_jsx(_components.td,{children:`Generated and retried for you`}),_jsx(_components.td,{children:`Required header on every mutating call`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Typed requests and errors`}),_jsx(_components.td,{children:`Generated from the OpenAPI contract`}),_jsx(_components.td,{children:`You validate payloads`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Server-to-server batch ingest`}),_jsxs(_components.td,{children:[`SDK `,_jsx(_components.code,{children:`events.batch`}),` helper`]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`POST /v1/events/batch`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Profile, claims, and intent reads`}),_jsx(_components.td,{children:`SDK read methods`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`GET /v1/profiles/:id`}),` and related routes`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Webhook, app, and catalog admin`}),_jsx(_components.td,{children:`Thin SDK wrappers`}),_jsx(_components.td,{children:`Full HTTP surface`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Consumer app Firebase APIs`}),_jsx(_components.td,{children:`Not available`}),_jsx(_components.td,{children:`Not available`})]})]})]}),`\n`,_jsx(Tip,{children:_jsx(_components.p,{children:`If a teammate heard that “the SDK has more functionality,” this is what that means: the SDK can observe in-app behavior, run the Swapnice connection and consent flow, and keep events ordered through retries. The API can accept the same events and return the same profiles, but it will not collect or consent for you.`})}),`\n`,_jsx(Heading,{level:`2`,id:`use-the-sdk-when`,children:`Use the SDK when`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`You are embedding Swapnice in a mobile app, web app, or checkout surface`}),`\n`,_jsx(_components.li,{children:`You want Swapnice to collect consented first-party events as users move through your product`}),`\n`,_jsx(_components.li,{children:`You need the hosted connection and consent experience rather than a custom OAuth UI`}),`\n`,_jsx(_components.li,{children:`You want typed clients, automatic idempotency, and token refresh`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Install the generated client:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npm`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` swapnice-sdk-ts`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`SwapniceClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"swapnice-sdk-ts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` swapnice`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` SwapniceClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` environment:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"development\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` clientId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`SWAPNICE_CLIENT_ID`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` clientSecret:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`SWAPNICE_CLIENT_SECRET`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The same OpenAPI contract also generates a Python client for backend jobs.`}),`\n`,_jsx(Heading,{level:`2`,id:`use-the-api-directly-when`,children:`Use the API directly when`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`A partner backend or ETL job is the only writer`}),`\n`,_jsx(_components.li,{children:`You already collected consent in your own UI and only need to POST receipts and events`}),`\n`,_jsx(_components.li,{children:`You are registering webhook endpoints, managing apps, or rebuilding ontologies`}),`\n`,_jsx(_components.li,{children:`You are debugging with cURL, Postman, or an API gateway`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Every SDK method maps to a documented HTTP route in the `,_jsx(_components.a,{href:`/partners/api-overview`,children:`API reference`}),`. Replays and server jobs can call those routes without the client SDK.`]}),`\n`,_jsx(Heading,{level:`2`,id:`what-neither-surface-does`,children:`What neither surface does`}),`\n`,_jsx(_components.p,{children:`Neither the SDK nor the Partner API exposes Swapnice consumer-app internals:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Wallet, Dwolla, or Plaid credentials`}),`\n`,_jsx(_components.li,{children:`NFC pack activation internals`}),`\n`,_jsx(_components.li,{children:`Private account fields from the consumer user record`}),`\n`,_jsx(_components.li,{children:`Another partner’s raw events or unresolved identities`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Installing the SDK does not expand the purposes a user granted. Events collected for `,_jsx(_components.code,{children:`personalization`}),` stay unavailable for another purpose until that purpose is granted.`]}),`\n`,_jsx(Heading,{level:`2`,id:`capability-split-in-practice`,children:`Capability split in practice`}),`\n`,_jsx(Mermaid,{chart:`flowchart LR\n subgraph sdk[\"SDK runtime\"]\n UI[\"Connect and consent UI\"]\n Cap[\"Event observers\"]\n Q[\"Retry and idempotency queue\"]\n Auth[\"PKCE and token refresh\"]\n end\n\n subgraph api[\"Partner API\"]\n Sess[\"Connection sessions\"]\n Cons[\"Consent receipts\"]\n Ev[\"Event ingest\"]\n Prof[\"Profiles, claims, intents\"]\n Cat[\"Apps, customers, entries\"]\n end\n\n UI --> Sess\n UI --> Cons\n Cap --> Q\n Auth --> api\n Q --> Ev\n Ev --> Prof`}),`\n`,_jsx(_components.p,{children:`The usual split is:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Client SDK`}),` in the consumer-facing app to connect, collect consent, and observe product interactions.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Partner backend + API or server SDK`}),` to upsert customers, register webhooks, and read profiles and intents for the partner product.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/partners/integration`,children:`integration`}),` for the combined implementation path.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"SDK versus API","description":"Where the Swapnice SDK and Partner API overlap, and where their capabilities differ.","href":"/partners/sdk-vs-api"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Quick comparison","slug":"quick-comparison","depth":2,"children":[]},{"title":"Use the SDK when","slug":"use-the-sdk-when","depth":2,"children":[]},{"title":"Use the API directly when","slug":"use-the-api-directly-when","depth":2,"children":[]},{"title":"What neither surface does","slug":"what-neither-surface-does","depth":2,"children":[]},{"title":"Capability split in practice","slug":"capability-split-in-practice","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"swapnice","siteName":"Swapnice","title":"SDK versus API - Swapnice","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-28T16:47:25.872Z","originalFileLocation":"partners/sdk-vs-api.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Where the Swapnice SDK and Partner API overlap, and where their capabilities differ.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Swapnice\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/swapnice/sU5gd7GPnTjFS3kb/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/swapnice/sU5gd7GPnTjFS3kb/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/swapnice/sU5gd7GPnTjFS3kb/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/swapnice/sU5gd7GPnTjFS3kb/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/swapnice/sU5gd7GPnTjFS3kb/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/swapnice/sU5gd7GPnTjFS3kb/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/swapnice/sU5gd7GPnTjFS3kb/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/swapnice/sU5gd7GPnTjFS3kb/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/swapnice/sU5gd7GPnTjFS3kb/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"SDK versus API - Swapnice\">\u003cmeta data-mint-head property=\"og:description\" content=\"Where the Swapnice SDK and Partner API overlap, and where their capabilities differ.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Swapnice\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://swapnice.mintlify.app/partners/sdk-vs-api\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://swapnice.mintlify.site/_mintlify/api/og/v2?division=Get+started\u0026amp;title=SDK+versus+API\u0026amp;description=Where+the+Swapnice+SDK+and+Partner+API+overlap%2C+and+where+their+capabilities+differ.\u0026amp;theme=881faf2d303744559c6d5af1\u0026amp;signature=aac99662608dbc9173ed2f7963f5ec27e7099052af9cf8a757e40710e5c28d8f\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"SDK versus API - Swapnice\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Where the Swapnice SDK and Partner API overlap, and where their capabilities differ.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://swapnice.mintlify.site/_mintlify/api/og/v2?division=Get+started\u0026amp;title=SDK+versus+API\u0026amp;description=Where+the+Swapnice+SDK+and+Partner+API+overlap%2C+and+where+their+capabilities+differ.\u0026amp;theme=881faf2d303744559c6d5af1\u0026amp;signature=aac99662608dbc9173ed2f7963f5ec27e7099052af9cf8a757e40710e5c28d8f\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/swapnice/sU5gd7GPnTjFS3kb/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Swapnice\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#EF3E36\">\u003clink data-mint-head rel=\"canonical\" href=\"https://swapnice.mintlify.app/partners/sdk-vs-api\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/partners/sdk-vs-api.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://swapnice.mintlify.app/#organization\",\"name\":\"Swapnice\",\"url\":\"https://swapnice.mintlify.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/swapnice/nmF9u4u0noYUQzdF/logo/light.svg?fit=max\u0026auto=format\u0026n=nmF9u4u0noYUQzdF\u0026q=85\u0026s=2c31758780e3cecce18a07ca724b6ad0\"}},{\"@type\":\"WebSite\",\"@id\":\"https://swapnice.mintlify.app#website\",\"name\":\"Swapnice\",\"url\":\"https://swapnice.mintlify.app\",\"publisher\":{\"@id\":\"https://swapnice.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://swapnice.mintlify.app/partners/sdk-vs-api#webpage\",\"url\":\"https://swapnice.mintlify.app/partners/sdk-vs-api\",\"name\":\"SDK versus API\",\"description\":\"Where the Swapnice SDK and Partner API overlap, and where their capabilities differ.\",\"dateModified\":\"2026-08-28T16:47:25.872Z\",\"isPartOf\":{\"@id\":\"https://swapnice.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://swapnice.mintlify.app/partners/sdk-vs-api#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://swapnice.mintlify.app/partners/sdk-vs-api#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Get started\",\"item\":\"https://swapnice.mintlify.app/partners/introduction\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SDK versus API\",\"item\":\"https://swapnice.mintlify.app/partners/sdk-vs-api\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://swapnice.mintlify.app/partners/sdk-vs-api#article\",\"headline\":\"SDK versus API\",\"name\":\"SDK versus API\",\"description\":\"Where the Swapnice SDK and Partner API overlap, and where their capabilities differ.\",\"url\":\"https://swapnice.mintlify.app/partners/sdk-vs-api\",\"mainEntityOfPage\":{\"@id\":\"https://swapnice.mintlify.app/partners/sdk-vs-api#webpage\"},\"dateModified\":\"2026-08-28T16:47:25.872Z\",\"publisher\":{\"@id\":\"https://swapnice.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://swapnice.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Swapnice\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Swapnice\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/partners/sdk-vs-api.md","siteName":"Swapnice","nav":{"global":{"anchors":[{"anchor":"Partner SDK","icon":"code","href":"/partners/introduction"},{"anchor":"Get the SDK","icon":"download","href":"/partners/integration"},{"anchor":"API Reference","icon":"square-terminal","href":"/partners/api-overview"}]},"products":[{"product":"Partner SDK \u0026 API","icon":"code","description":"Integrate the SDK: sample code, data collection, outputs, and sandbox.","tabs":[{"tab":"Guides","icon":"book-open","groups":[{"group":"Get started","pages":[{"title":"Partner SDK","href":"/partners/introduction"},{"title":"Environments","description":"Development and production Partner API hosts, what is isolated between them, and which URL partners should call.","href":"/partners/environments"},{"title":"SDK versus API","href":"/partners/sdk-vs-api"},{"title":"Authentication","description":"OAuth 2.1, PKCE, scopes, tokens, and how partner apps authenticate to the Swapnice API.","href":"/partners/authentication"},{"title":"Consent and account linking","href":"/partners/consent"}]},{"group":"Integrate","pages":[{"title":"Integration and sample code","href":"/partners/integration"},{"title":"Events and intent ontology","href":"/partners/events-and-intents"},{"title":"Entries and ontologies","href":"/partners/catalog"},{"title":"Webhooks","href":"/partners/webhooks"},{"title":"Example use cases","href":"/partners/use-cases"}]},{"group":"Data and outputs","pages":[{"title":"Data collection","href":"/partners/data-collection"},{"title":"Outputs","href":"/partners/outputs"},{"title":"Architecture and data flow","href":"/partners/architecture"}]},{"group":"Test and launch","pages":[{"title":"Sandbox and testing","href":"/partners/sandbox"},{"title":"Request walkthrough","href":"/partners/request-walkthrough"},{"title":"What a pilot enables","href":"/partners/pilot"}]}]},{"tab":"API Reference","icon":"square-terminal","pages":[{"title":"API Reference","href":"/partners/api-overview"}]}]},{"product":"Swapnice App","icon":"sparkles","description":"Consumer product guides for personas, badges, inventory, and transactions.","pages":[{"title":"Swapnice App","href":"/introduction"}]}]},"basePath":"","title":"SDK versus API - Swapnice","deploymentId":"dpl_9bQLTw9nc2h9csDGYcKwWenPcQWn","buildId":"dpl_9bQLTw9nc2h9csDGYcKwWenPcQWn","dynamics":["10e4515597"],"chunks":["BannerMarkdown-BXE6hfEw.js","dist-D9mz3EIS.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js"]}