OAuth
ObtainToken
Returns an OAuth access token and refresh token using the authorization_code or refresh_token grant type.
When grant_type is authorization_code:
- With the code flow, provide code, client_id, and client_secret.
- With the PKCE flow, provide code, client_id, and code_verifier.
When grant_type is refresh_token:
- With the code flow, provide refresh_token, client_id, and client_secret. The response returns the same refresh token provided in the request.
- With the PKCE flow, provide refresh_token and client_id. The response returns a new refresh token.
You can use the scopes parameter to limit the set of permissions authorized by the access token. You can use the short_lived parameter to create an access token that expires in 24 hours.
Important: OAuth tokens should be encrypted and stored on a secure server. Application clients should never interact directly with OAuth tokens.
post/oauth2/token
Request body
Example request
{
"client_id": "sq0idp-uaPHILoPzWZk3tlJqlML0g",
"client_secret": "sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM",
"code": "sq0cgb-l0SBqxs4uwxErTVyYOdemg",
"grant_type": "authorization_code"
}Response
Success
Example response
{
"access_token": "EAAl3ikZIe18J-2-cHlV2bL4-EaZHGoJUhtEBT7QA6-7AgwIHw8Xe1IoUvGsNxA",
"expires_at": "2025-04-03T18:31:06Z",
"merchant_id": "MLQW2MYBY81PZ",
"refresh_token": "EQAAl0OcByu3IYJYScGGg-8E5YNf0r0b6jCTCMy5nOcRZ4ok0wbWAL8vY3tZWNcc",
"short_lived": false,
"token_type": "bearer"
}