Trade an authorization code or refresh token for a Bearer access token.Accepts JSON or form-encoded bodies. Access tokens last about 15 minutes. Include code_verifier for authorization-code exchanges.
Authorizations
client_secret
string
query
required
Form-style client secret authentication for confidential clients where HTTP Basic is unavailable.
Body
application/jsonapplication/x-www-form-urlencoded
Option 1
Option 2
grant_type
enum<string>
required
Available options:
authorization_code
code
string
required
redirect_uri
string<uri>
required
client_id
string
required
client_secret
string
required
code_verifier
string
required
Minimum string length: 43
Response
Token response.
access_token
string
required
token_type
enum<string>
required
Available options:
Bearer
expires_in
integer
required
Example:
900
scope
string
required
refresh_token
string
Rotating refresh token when offline_access is granted.
{"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.4347","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":"control","enabled":true,"payload":{"type":"string","value":"control"},"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/api-reference/oauth-token","slug":"/partners/api-reference/oauth-token","pageMetadata":{"title":"Exchange or refresh a token","description":"Trade an authorization code or refresh token for a Bearer access token.","openapi":"openapi.yaml POST /oauth/token","href":"/partners/api-reference/oauth-token"},"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: \"Trade an authorization code or refresh token for a Bearer access token.\"\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={code:`code`,p:`p`,..._provideComponents(),...props.components};return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Trade an authorization code or refresh token for a Bearer access token.`}),`\n`,_jsxs(_components.p,{children:[`Accepts JSON or form-encoded bodies. Access tokens last about 15 minutes. Include `,_jsx(_components.code,{children:`code_verifier`}),` for authorization-code exchanges.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Exchange or refresh a token","description":"Trade an authorization code or refresh token for a Bearer access token.","openapi":"openapi.yaml POST /oauth/token","href":"/partners/api-reference/oauth-token"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"tags":["OAuth"],"summary":"Exchange or refresh OAuth tokens","operationId":"createOAuthToken","description":"Trade an authorization code or refresh token for a Bearer access token.","security":["4703c40c-3cb4-4695-bbe2-34517e07a001"],"requestBody":"2054217f-14c2-4660-b779-289eb75b0240","responses":{"200":"e5b43aff-3c72-44e3-8c52-bf4b81471ac8","400":"21c92ee3-87a4-4c23-bb67-6fae695d7b12","401":"ead5b0a0-a618-4cf9-8bad-b01245596978"},"method":"post","type":"path","servers":["99d2c55b-f3b5-46da-95d7-cc24acc2568d","ca47aed7-56c6-49e4-9275-ab5aa1e8e0f3"],"path":"/oauth/token","baseUrlOptions":["https://swapnice-gateway-dev.ceo-cbc.workers.dev","https://swapnice-gateway-production.ceo-cbc.workers.dev"],"title":"Exchange or refresh OAuth tokens","codeSamples":[],"requestExampleLanguages":["bash","javascript","python"],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","required":["grant_type","code","redirect_uri","client_id","client_secret","code_verifier"],"properties":{"grant_type":{"type":"string","enum":["authorization_code"],"isRequired":true,"uniqueKey":"oneOf.0.grant_type","typeLabel":"enum\u003cstring>"},"code":{"type":"string","isRequired":true,"uniqueKey":"oneOf.0.code","typeLabel":"string"},"redirect_uri":{"type":"string","format":"uri","isRequired":true,"uniqueKey":"oneOf.0.redirect_uri","typeLabel":"string\u003curi>"},"client_id":{"type":"string","isRequired":true,"uniqueKey":"oneOf.0.client_id","typeLabel":"string"},"client_secret":{"type":"string","isRequired":true,"uniqueKey":"oneOf.0.client_secret","typeLabel":"string"},"code_verifier":{"type":"string","minLength":43,"isRequired":true,"uniqueKey":"oneOf.0.code_verifier","typeLabel":"string"}},"uniqueKey":"oneOf.0","typeLabel":"object"},{"type":"object","required":["grant_type","refresh_token","client_id","client_secret"],"properties":{"grant_type":{"type":"string","enum":["refresh_token"],"isRequired":true,"uniqueKey":"oneOf.1.grant_type","typeLabel":"enum\u003cstring>"},"refresh_token":{"type":"string","isRequired":true,"uniqueKey":"oneOf.1.refresh_token","typeLabel":"string"},"client_id":{"type":"string","isRequired":true,"uniqueKey":"oneOf.1.client_id","typeLabel":"string"},"client_secret":{"type":"string","isRequired":true,"uniqueKey":"oneOf.1.client_secret","typeLabel":"string"}},"uniqueKey":"oneOf.1","typeLabel":"object"}],"uniqueKey":"","typeLabel":"object"},"example":{"grant_type":"authorization_code","client_id":"swa_client_01HZZZ8KQ2J9X2RW7B8Y4D2FPK","client_secret":"swa_secret_example","code":"swa_code_01HZZZ9N3K","code_verifier":"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~","redirect_uri":"https://partner.example.com/swapnice/callback"},"examples":{"Example":{"title":"Example","value":{"grant_type":"authorization_code","client_id":"swa_client_01HZZZ8KQ2J9X2RW7B8Y4D2FPK","client_secret":"swa_secret_example","code":"swa_code_01HZZZ9N3K","code_verifier":"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~","redirect_uri":"https://partner.example.com/swapnice/callback"}}},"exampleType":"examples"},"application/x-www-form-urlencoded":{"schema":{"oneOf":[{"type":"object","required":["grant_type","code","redirect_uri","client_id","client_secret","code_verifier"],"properties":{"grant_type":{"type":"string","enum":["authorization_code"],"isRequired":true,"uniqueKey":"oneOf.0.grant_type","typeLabel":"enum\u003cstring>"},"code":{"type":"string","isRequired":true,"uniqueKey":"oneOf.0.code","typeLabel":"string"},"redirect_uri":{"type":"string","format":"uri","isRequired":true,"uniqueKey":"oneOf.0.redirect_uri","typeLabel":"string\u003curi>"},"client_id":{"type":"string","isRequired":true,"uniqueKey":"oneOf.0.client_id","typeLabel":"string"},"client_secret":{"type":"string","isRequired":true,"uniqueKey":"oneOf.0.client_secret","typeLabel":"string"},"code_verifier":{"type":"string","minLength":43,"isRequired":true,"uniqueKey":"oneOf.0.code_verifier","typeLabel":"string"}},"uniqueKey":"oneOf.0","typeLabel":"object"},{"type":"object","required":["grant_type","refresh_token","client_id","client_secret"],"properties":{"grant_type":{"type":"string","enum":["refresh_token"],"isRequired":true,"uniqueKey":"oneOf.1.grant_type","typeLabel":"enum\u003cstring>"},"refresh_token":{"type":"string","isRequired":true,"uniqueKey":"oneOf.1.refresh_token","typeLabel":"string"},"client_id":{"type":"string","isRequired":true,"uniqueKey":"oneOf.1.client_id","typeLabel":"string"},"client_secret":{"type":"string","isRequired":true,"uniqueKey":"oneOf.1.client_secret","typeLabel":"string"}},"uniqueKey":"oneOf.1","typeLabel":"object"}],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"grant_type":"authorization_code","code":"\u003cstring>","redirect_uri":"\u003cstring>","client_id":"\u003cstring>","client_secret":"\u003cstring>","code_verifier":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"examples"},"responses":{"e5b43aff-3c72-44e3-8c52-bf4b81471ac8":{"description":"Token response.","content":{"application/json":{"schema":{"type":"object","required":["access_token","token_type","expires_in","scope"],"properties":{"access_token":{"type":"string","isRequired":true,"uniqueKey":"access_token","typeLabel":"string"},"token_type":{"type":"string","enum":["Bearer"],"isRequired":true,"uniqueKey":"token_type","typeLabel":"enum\u003cstring>"},"expires_in":{"type":"integer","example":900,"isRequired":true,"uniqueKey":"expires_in","typeLabel":"integer"},"scope":{"type":"string","isRequired":true,"uniqueKey":"scope","typeLabel":"string"},"refresh_token":{"type":"string","description":"Rotating refresh token when `offline_access` is granted.","uniqueKey":"refresh_token","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"example":{"access_token":"swa_at_example","token_type":"Bearer","expires_in":900,"scope":"connections:write consent:write events:write profile:read"},"examples":{"Example":{"title":"Example","value":{"access_token":"swa_at_example","token_type":"Bearer","expires_in":900,"scope":"connections:write consent:write events:write profile:read"}}},"exampleType":"examples"}},"exampleType":"examples"},"21c92ee3-87a4-4c23-bb67-6fae695d7b12":{"description":"OAuth error response.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string","enum":["invalid_request","invalid_client","invalid_grant","unauthorized_client","unsupported_grant_type","invalid_scope"],"isRequired":true,"uniqueKey":"error","typeLabel":"enum\u003cstring>"},"error_description":{"type":"string","uniqueKey":"error_description","typeLabel":"string"},"error_uri":{"type":"string","format":"uri","uniqueKey":"error_uri","typeLabel":"string\u003curi>"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"invalid_request","error_description":"\u003cstring>","error_uri":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"ead5b0a0-a618-4cf9-8bad-b01245596978":{"description":"OAuth error response.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string","enum":["invalid_request","invalid_client","invalid_grant","unauthorized_client","unsupported_grant_type","invalid_scope"],"isRequired":true,"uniqueKey":"error","typeLabel":"enum\u003cstring>"},"error_description":{"type":"string","uniqueKey":"error_description","typeLabel":"string"},"error_uri":{"type":"string","format":"uri","uniqueKey":"error_uri","typeLabel":"string\u003curi>"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"invalid_request","error_description":"\u003cstring>","error_uri":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"4703c40c-3cb4-4695-bbe2-34517e07a001":{"ClientSecretPost":{"type":"apiKey","in":"query","name":"client_secret","description":"Form-style client secret authentication for confidential clients where HTTP Basic is unavailable.","scopes":[]}}},"servers":{"99d2c55b-f3b5-46da-95d7-cc24acc2568d":{"url":"https://swapnice-gateway-dev.ceo-cbc.workers.dev","description":"Development"},"ca47aed7-56c6-49e4-9275-ab5aa1e8e0f3":{"url":"https://swapnice-gateway-production.ceo-cbc.workers.dev","description":"Production"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"apiKey","in":"query","name":"client_secret","description":"Form-style client secret authentication for confidential clients where HTTP Basic is unavailable.","scopes":[]},"schema":{"title":"client_secret","type":"string","description":"Form-style client secret authentication for confidential clients where HTTP Basic is unavailable.","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"ClientSecretPost","name":"client_secret"}],"title":"ClientSecretPost"}]},"originalFileLocation":"openapi.yaml"},"subdomain":"swapnice","siteName":"Swapnice","title":"Exchange or refresh a token - Swapnice","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-26T21:35:09.447Z","originalFileLocation":"partners/api-reference/oauth-token.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=\"Trade an authorization code or refresh token for a Bearer access token.\">\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=\"Exchange or refresh a token - Swapnice\">\u003cmeta data-mint-head property=\"og:description\" content=\"Trade an authorization code or refresh token for a Bearer access token.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Swapnice\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://swapnice.mintlify.app/partners/api-reference/oauth-token\">\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=OAuth\u0026amp;title=Exchange+or+refresh+a+token\u0026amp;description=Trade+an+authorization+code+or+refresh+token+for+a+Bearer+access+token.\u0026amp;theme=881faf2d303744559c6d5af1\u0026amp;signature=36d481917a2b270fce521adb17705e93f15c888054cf82db97c8ab1b82b4cd6e\">\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=\"Exchange or refresh a token - Swapnice\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Trade an authorization code or refresh token for a Bearer access token.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://swapnice.mintlify.site/_mintlify/api/og/v2?division=OAuth\u0026amp;title=Exchange+or+refresh+a+token\u0026amp;description=Trade+an+authorization+code+or+refresh+token+for+a+Bearer+access+token.\u0026amp;theme=881faf2d303744559c6d5af1\u0026amp;signature=36d481917a2b270fce521adb17705e93f15c888054cf82db97c8ab1b82b4cd6e\">\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/api-reference/oauth-token\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/partners/api-reference/oauth-token.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/api-reference/oauth-token#webpage\",\"url\":\"https://swapnice.mintlify.app/partners/api-reference/oauth-token\",\"name\":\"Exchange or refresh a token\",\"description\":\"Trade an authorization code or refresh token for a Bearer access token.\",\"dateModified\":\"2026-08-26T21:35:09.447Z\",\"isPartOf\":{\"@id\":\"https://swapnice.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://swapnice.mintlify.app/partners/api-reference/oauth-token#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://swapnice.mintlify.app/partners/api-reference/oauth-token#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"OAuth\",\"item\":\"https://swapnice.mintlify.app/partners/api/oauth\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Exchange or refresh a token\",\"item\":\"https://swapnice.mintlify.app/partners/api-reference/oauth-token\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://swapnice.mintlify.app/partners/api-reference/oauth-token#apireference\",\"headline\":\"Exchange or refresh a token\",\"name\":\"Exchange or refresh a token\",\"description\":\"Trade an authorization code or refresh token for a Bearer access token.\",\"url\":\"https://swapnice.mintlify.app/partners/api-reference/oauth-token\",\"mainEntityOfPage\":{\"@id\":\"https://swapnice.mintlify.app/partners/api-reference/oauth-token#webpage\"},\"dateModified\":\"2026-08-26T21:35:09.447Z\",\"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/api-reference/oauth-token.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","pages":[{"title":"Guides","href":"/partners/introduction"}]},{"tab":"API Reference","icon":"square-terminal","groups":[{"group":"Overview","pages":[{"title":"API overview","href":"/partners/api-overview"}]},{"group":"OAuth","pages":[{"title":"OAuth","href":"/partners/api/oauth"},{"title":"Get authorization server metadata","openapi":"openapi.yaml GET /.well-known/oauth-authorization-server","href":"/partners/api-reference/oauth-metadata"},{"title":"Create an authorization code","openapi":"openapi.yaml POST /oauth/authorize","href":"/partners/api-reference/oauth-authorize"},{"title":"Start browser authorization","description":"Browser-facing authorize page for hosted connect UX.","openapi":"openapi.yaml GET /oauth/authorize","href":"/partners/api-reference/oauth-authorize-browser"},{"title":"Exchange or refresh a token","openapi":"openapi.yaml POST /oauth/token","href":"/partners/api-reference/oauth-token"},{"title":"Introspect a token","description":"Confirm a token is active and inspect its scopes.","openapi":"openapi.yaml POST /oauth/introspect","href":"/partners/api-reference/oauth-introspect"},{"title":"Revoke a token","openapi":"openapi.yaml POST /oauth/revoke","href":"/partners/api-reference/oauth-revoke"}]},{"group":"Apps","pages":[{"title":"Apps","href":"/partners/api/apps"},{"title":"Create a partner app","openapi":"openapi.yaml POST /v1/apps","href":"/partners/api-reference/apps-create"},{"title":"Get a partner app","openapi":"openapi.yaml GET /v1/apps/{app_id}","href":"/partners/api-reference/apps-get"},{"title":"Update a partner app","openapi":"openapi.yaml PATCH /v1/apps/{app_id}","href":"/partners/api-reference/apps-update"}]},{"group":"Connection sessions","pages":[{"title":"Connection sessions","href":"/partners/api/connections"},{"title":"Create a connection session","openapi":"openapi.yaml POST /v1/connection-sessions","href":"/partners/api-reference/connections-create"},{"title":"Get a connection session","openapi":"openapi.yaml GET /v1/connection-sessions/{session_id}","href":"/partners/api-reference/connections-get"},{"title":"Cancel a connection session","openapi":"openapi.yaml DELETE /v1/connection-sessions/{session_id}","href":"/partners/api-reference/connections-delete"}]},{"group":"Consent","pages":[{"title":"Consent","href":"/partners/api/consent"},{"title":"Create a consent receipt","openapi":"openapi.yaml POST /v1/consent-receipts","href":"/partners/api-reference/consent-create"},{"title":"List consent receipts","openapi":"openapi.yaml GET /v1/consent-receipts","href":"/partners/api-reference/consent-list"},{"title":"Revoke consent","openapi":"openapi.yaml POST /v1/consent-receipts/{receipt_id}/revoke","href":"/partners/api-reference/consent-revoke"},{"title":"Get effective consent","openapi":"openapi.yaml GET /v1/customers/{customer_id}/effective-consent","href":"/partners/api-reference/consent-effective"}]},{"group":"Customers","pages":[{"title":"Customers","href":"/partners/api/customers"},{"title":"Create or upsert a customer","openapi":"openapi.yaml POST /v1/customers","href":"/partners/api-reference/customers-upsert"},{"title":"Get a customer","openapi":"openapi.yaml GET /v1/customers/{customer_id}","href":"/partners/api-reference/customers-get"}]},{"group":"Events","pages":[{"title":"Events","href":"/partners/api/events"},{"title":"Ingest an event","openapi":"openapi.yaml POST /v1/events","href":"/partners/api-reference/events-ingest"},{"title":"Ingest a batch of events","openapi":"openapi.yaml POST /v1/events/batch","href":"/partners/api-reference/events-batch"},{"title":"Get event status","openapi":"openapi.yaml GET /v1/events/{event_id}","href":"/partners/api-reference/events-get"}]},{"group":"Profiles","pages":[{"title":"Profiles","href":"/partners/api/profiles"},{"title":"Get a resolved profile","openapi":"openapi.yaml GET /v1/profiles/{customer_id}","href":"/partners/api-reference/profiles-get"},{"title":"List claims","openapi":"openapi.yaml GET /v1/profiles/{customer_id}/claims","href":"/partners/api-reference/profiles-claims"},{"title":"List intents","openapi":"openapi.yaml GET /v1/profiles/{customer_id}/intents","href":"/partners/api-reference/profiles-intents"}]},{"group":"Entries and ontologies","pages":[{"title":"Entries and ontologies","href":"/partners/api/catalog"},{"title":"List ontologies","openapi":"openapi.yaml GET /v1/ontologies","href":"/partners/api-reference/ontologies-list"},{"title":"Get an ontology","openapi":"openapi.yaml GET /v1/ontologies/{ontology_id}","href":"/partners/api-reference/ontologies-get"},{"title":"Rebuild ontology fields","openapi":"openapi.yaml POST /v1/ontologies/{ontology_id}/fields/rebuild","href":"/partners/api-reference/ontologies-rebuild"},{"title":"Create or upsert an entry","openapi":"openapi.yaml POST /v1/entries","href":"/partners/api-reference/entries-upsert"},{"title":"Get an entry","openapi":"openapi.yaml GET /v1/entries/{entry_id}","href":"/partners/api-reference/entries-get"},{"title":"Replace an entry","openapi":"openapi.yaml PUT /v1/entries/{entry_id}","href":"/partners/api-reference/entries-update"}]},{"group":"Webhooks","pages":[{"title":"Webhooks","href":"/partners/api/webhooks"},{"title":"Register a webhook endpoint","openapi":"openapi.yaml POST /v1/webhook-endpoints","href":"/partners/api-reference/webhooks-create"},{"title":"List webhook endpoints","openapi":"openapi.yaml GET /v1/webhook-endpoints","href":"/partners/api-reference/webhooks-list"}]},{"group":"Workflows","pages":[{"title":"Get workflow status","openapi":"openapi.yaml GET /v1/workflows/{workflow_id}","href":"/partners/api-reference/workflows-get"}]}]}]},{"product":"Swapnice App","icon":"sparkles","description":"Consumer product guides for personas, badges, inventory, and transactions.","pages":[{"title":"Swapnice App","href":"/introduction"}]}]},"basePath":"","title":"Exchange or refresh a token - Swapnice","deploymentId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","buildId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","dynamics":["10e4515597","c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["BannerMarkdown-DMIpkWQi.js","dist-Bg48sGSz.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js","OpenApiReferenceProvider-BMn8tSe3.js","snippetPresets-Dl5ZrD9W.js","utils-CddEzDcs.js","style-to-object-BY3JEAdk.js","utils-Dym31Pnf.js","v4-DIgz8zy6.js","addTypeLabelsToSchema-ZiqR8hPK.js","conditional-requirements-CFM0id0Q.js","cloneDeep-D3fPbylz.js","_Uint8Array-BcNtDki0.js","isObject-FP1Yky1u.js","ApiExamples-4Sf3CFhl.js","usePlaygroundInputsStore-Ck91l6q0.js","shallow-DapBSR9G.js","isEqual-Clu_sGzx.js","CodeSnippets-DAVHdSX2.js","CodeSnippet-Be6AcO_D.js","use-playground-group-access-CteWws2O.js","Page-_aL_PM_2.js","api-description-markdown-BPoPkVJQ.js","DynamicMarkdown-QJ7LkRm3.js","SectionHeading-DyxPTJti.js","MethodPill-CGjK-dNY.js","getPastedJson-C4YIGTOJ.js","Check2Icon-B7COpIZE.js","axios-CsQoIw0U.js","Markdown-Bquzb4Gw.js","AssistantPageLink-wSgGy_i5.js"]}