---
title: POST · Exchange a code
published: true
tier: free
index: 2
---

# POST · Exchange a code

`POST /api/auth/oauth2/token`

Exchange an authorization code from your app's callback **on your server**. Send an `application/x-www-form-urlencoded` body.

| Field | Value |
| --- | --- |
| `grant_type` | `authorization_code` |
| `client_id`, `client_secret` | Credentials for the registered app. |
| `code`, `redirect_uri` | Code from the callback and the same redirect URL used for authorization. |
| `code_verifier` | Original PKCE verifier stored for this sign-in. |

**Response.** JSON contains `access_token`, `token_type`, `expires_in` (seconds) and `scope`. Keep the token in your server session. Send `Authorization: Bearer <access_token>` on app API requests. Tokens last one hour. Start a new authorization to renew access. [Authorize an app](./authorize.md)
