---
updatedAt: 2026-11-11T12:01:33.000Z
agentTools:
  projectIndex: https://docs.yotpo.com/llms.txt
---

# Generate Access Token

For apps that many merchants install: exchange the temporary code from the merchant's install for an access token. See [Authenticating with OAuth 2.0](doc:authenticating). To integrate one store you work on directly, use [Generate access token](ref:yotpo-authentication) with that store's API secret instead.

> 📘 Have you registered your app yet?
>
> You need an app ID and secret before you can call this endpoint. See [Registering your integration](https://docs.yotpo.com/docs/registering-a-new-app).

Send the `access_token` from the response in the `X-Yotpo-Token` header of every other request. The token is per store: a merchant with several Yotpo stores installs your app on each one, and you get a separate token for each.

Send `client_id` and `client_secret` in the request body as JSON or form fields. An `Authorization: Basic` header isn't read. The error bodies for this endpoint aren't valid JSON: see [Errors](https://docs.yotpo.com/docs/error-handling#token-endpoint-errors-post-v2oauth2token).

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "App partners API",
    "description": "Endpoints for apps that Yotpo merchants install. The app-level webhook is defined separately, in webhooks.json.",
    "version": "2"
  },
  "servers": [
    {
      "url": "https://developers.yotpo.com"
    }
  ],
  "security": [
    {
      "X-Yotpo-Token": []
    }
  ],
  "x-readme": {
    "headers": [],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "paths": {
    "/v2/oauth2/token": {
      "post": {
        "summary": "Generate Access Token",
        "description": "For apps that many merchants install. To integrate one store you work on directly, use [Generate access token](ref:yotpo-authentication) with that store's API secret instead.\n\nUse this endpoint to generate an access_token using your OAuth 2.0 code. Learn more about OAuth 2.0 <a href=\"/docs/authenticating\" target=\"_blank\">here</a>.\n\n**Have you registered your app yet?**\n\nBefore you start building your app on top of Yotpo’s App Developer API, you first need to register it with us. If you haven’t done so yet, refer to the steps in our <a href=\"/docs/welcome\" target=\"_blank\">Welcome Guide</a>.",
        "operationId": "generate-a-token",
        "security": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "grant_type",
                  "client_id",
                  "client_secret",
                  "redirect_uri",
                  "code"
                ],
                "properties": {
                  "grant_type": {
                    "type": "string",
                    "description": "The `grant_type` for this request is `authorization_code`",
                    "default": "authorization_code"
                  },
                  "client_id": {
                    "type": "string",
                    "description": "The `Application ID` shared with you upon app registration"
                  },
                  "client_secret": {
                    "type": "string",
                    "description": "The `Application Secret` shared with you upon app registration"
                  },
                  "redirect_uri": {
                    "type": "string",
                    "description": "The redirect/callback URI provided upon app creation. Your token will be sent there"
                  },
                  "code": {
                    "type": "string",
                    "description": "The OAuth 2.0 code granted via the installation link"
                  }
                }
              },
              "examples": {
                "Body": {
                  "value": {
                    "grant_type": "authorization_code",
                    "client_id": "ad75ashh833b123a844660454acd63a3",
                    "client_secret": "5892d858jh8d2221as59b5k50981fcdc",
                    "redirect_uri": "https://www.yotpo.com/myapp",
                    "code": "035h12g8mnve9934804jk17428k8b63b"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"access_token\": {access_token},\n    \"token_type\": \"bearer\"\n}"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid client credentials, redirect URI or authorization code.",
            "content": {
              "application/json": {
                "examples": {
                  "Invalid client": {
                    "summary": "Wrong client_id or client_secret",
                    "value": {
                      "error": "invalid_client",
                      "error_description": "Invalid client authentication"
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "OAuth error code, for example `invalid_client`."
                    },
                    "error_description": {
                      "type": "string",
                      "description": "Human-readable reason for the error."
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "components": {
    "securitySchemes": {
      "X-Yotpo-Token": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Yotpo-Token",
        "description": "Send your app's access token for the merchant's store in the `X-Yotpo-Token` header of every request. To get a token, see [Generate Access Token](ref:generate-a-token). The API also reads the token from an `access_token` query parameter, but that isn't recommended: URLs end up in server and proxy logs. `Authorization: Bearer` is not supported."
      }
    }
  }
}
```

# Sibling pages

* [Table of Contents](https://docs.yotpo.com/reference/partners-table-of-contents.md)
* [Guidelines and Conventions](https://docs.yotpo.com/reference/partners-guidelines-and-conventions.md)
* [Changelog](https://docs.yotpo.com/reference/partners-changelog.md)
* [Retrieve Token Info](https://docs.yotpo.com/reference/retrieve-token-info.md)
* [Remove Application](https://docs.yotpo.com/reference/remove-application.md)
* [Yotpo Postman Collection](https://docs.yotpo.com/reference/yotpo-postman-collection.md)