Skip to navigation

Create a token

For step-by-step instructions on how to use this endpoint to create a public integration, check out the Authorization guide. To walkthrough how to create tokens for Link Previews, refer to the Link Previews guide.

Redirect URI requirements for public integrations

The redirect_uri is a required field in the request body for this endpoint if:

In most cases, the redirect_uri field is required.

This field is not allowed in the request body if:

  • there is one redirect_uri included in the integration’s settings under OAuth Domain & URIs, and the redirect_uri query parameter was not included in the Authorization URL.

Learn more in the public integration section of 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.

Headers

AuthorizationstringOptionalDefaults to Basic $BASE64_ENCODED_ID_AND_SECRET

Request

This endpoint expects an object.
codestringRequired
A unique random code that Notion generates to authenticate with your service, generated when a user initiates the OAuth flow.
grant_typestringRequired

A constant string: “authorization_code”

redirect_uristringRequired

The “redirect_uri” that was provided in the OAuth Domain & URI section of the integration’s Authorization settings. Do not include this field if a “redirect_uri” query param was not included in the Authorization URL provided to users. In most cases, this field is required.

Response

200
access_tokenstringOptional
refresh_tokenstringOptional
bot_idstringOptional
duplicated_template_idanyOptional
ownerobjectOptional
workspace_iconstringOptional
workspace_idstringOptional
workspace_namestringOptional

Errors

400
Bad Request Error