{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/yelp/json-schema/yelp-token-authorization-code-request-schema.json",
  "title": "Access Token Request",
  "description": "Access Token Request as per https://www.rfc-editor.org/rfc/rfc6749#section-4.1.3",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/yelp-oauth-authorization-v2-api-openapi.yml#/components/schemas/TokenAuthorizationCodeRequest",
  "type": "object",
  "allOf": [
    {
      "$ref": "#/$defs/TokenRequestBase"
    },
    {
      "type": "object",
      "properties": {
        "grant_type": {
          "type": "string",
          "description": "Value MUST be set to \"authorization_code\".",
          "enum": [
            "authorization_code"
          ]
        },
        "code": {
          "type": "string",
          "description": "Authorization code that is sent back to the redirect uri after a biz user authorized the client's oauth client."
        },
        "redirect_uri": {
          "type": "string",
          "description": "REQUIRED, if the \"redirect_uri\" parameter was included in the authorization request and their values MUST be identical."
        },
        "code_verifier": {
          "type": "string",
          "description": "PKCE code verifier (RFC 7636). The original random string used to generate the\ncode_challenge sent in the authorization request. Required when the authorization\nrequest included a code_challenge. Must be between 43 and 128 characters,\nusing [A-Z] / [a-z] / [0-9] / \"-\" / \".\" / \"_\" / \"~\".\n",
          "minLength": 43,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9\\-._~]+$"
        },
        "code_challenge_method": {
          "type": "string",
          "description": "The method used to derive the code_challenge from the code_verifier.\nOnly S256 is supported.\n",
          "enum": [
            "S256"
          ]
        }
      },
      "required": [
        "authorization_code",
        "code"
      ]
    }
  ],
  "$defs": {
    "TokenRequestBase": {
      "type": "object",
      "properties": {
        "client_id": {
          "$ref": "#/$defs/client_id"
        },
        "client_secret": {
          "$ref": "#/$defs/client_secret"
        },
        "grant_type": {
          "type": "string",
          "enum": [
            "authorization_code",
            "refresh_token"
          ],
          "description": "Grant type, as per specified in OAuth2 RFC."
        }
      },
      "required": [
        "client_id",
        "client_secret",
        "grant_type"
      ]
    },
    "client_id": {
      "type": "string",
      "description": "ID assigned by Yelp for the third-party system that will make user-authorized requests to Yelp."
    },
    "client_secret": {
      "type": "string",
      "description": "Client secret assigned by Yelp for the third-party system that will make user-authorized requests to Yelp.",
      "maxLength": 64,
      "minLength": 64
    }
  }
}