Join us for our Developer Platform Hackathon, May 16-17. Apply now →
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": "<string>",
"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": "<string>",
"user": {
"type": "<string>",
"person": {
"email": "<string>"
},
"name": "<string>",
"avatar_url": "<string>",
"id": "<string>",
"object": "<string>"
}
},
"duplicated_template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Refreshes an access token, generating a new access token and new refresh token
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": "<string>",
"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": "<string>",
"user": {
"type": "<string>",
"person": {
"email": "<string>"
},
"name": "<string>",
"avatar_url": "<string>",
"id": "<string>",
"object": "<string>"
}
},
"duplicated_template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Documentation Index
Fetch the complete documentation index at: https://developers.notion.com/llms.txt
Use this file to discover all available pages before exploring further.
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
The API version to use for this request. The latest version is 2026-03-11.
2026-03-11 "bearer"Show child attributes