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"
}Creates an access token that a third-party service can use to authenticate with Notion.
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.
redirect_uri is a required field in the request body for this endpoint if:redirect_uri query parameter was set in the Authorization URL provided to users, or;redirect_uris included in the connection’s settings under OAuth Domain & URIs.redirect_uri field is required.This field is not allowed in the request body if:redirect_uri included in the connection’s settings under OAuth Domain & URIs, and the redirect_uri query parameter was not included in the Authorization URL.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