Skip to main content
POST
/
v1
/
oauth
/
token
TypeScript SDK
import { Client } from "@notionhq/client"

const notion = new Client()

const response = await notion.oauth.token({
  client_id: process.env.OAUTH_CLIENT_ID,
  client_secret: process.env.OAUTH_CLIENT_SECRET,
  grant_type: "authorization_code",
  code: "abc123-authorization-code",
  redirect_uri: "https://example.com/callback"
})
{
  "access_token": "<string>",
  "token_type": "bearer",
  "refresh_token": "<string>",
  "bot_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "workspace_icon": "<string>",
  "workspace_name": "<string>",
  "workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "owner": {
    "type": "user",
    "user": {
      "type": "person",
      "person": {
        "email": "<string>"
      },
      "name": "<string>",
      "avatar_url": "<string>",
      "id": "<string>",
      "object": "user"
    }
  },
  "duplicated_template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
For step-by-step instructions on how to use this endpoint to refresh an access token, check out the Authorization guide.
Note: Each Public API endpoint can return several possible error codes. To see a full description of each type of error code, see the Error codes section of the Status codes documentation.

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Headers

Notion-Version
enum<string>
required

The API version to use for this request. The latest version is 2025-09-03.

Available options:
2025-09-03

Body

application/json
grant_type
enum<string>
required
Available options:
authorization_code
code
string
required
redirect_uri
string
external_account
object

Response

access_token
string
required
token_type
enum<string>
required
Available options:
bearer
refresh_token
string | null
required
bot_id
string<uuid>
required
workspace_icon
string | null
required
workspace_name
string | null
required
workspace_id
string<uuid>
required
owner
User · object
required
duplicated_template_id
string<uuid> | null
required
request_id
string<uuid>