{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/demandware/json-schema/demandware-token-request-schema.json",
  "title": "TokenRequest",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/demandware-auth-v1-openapi.yml#/components/schemas/TokenRequest",
  "required": [
    "grant_type"
  ],
  "type": "object",
  "properties": {
    "refresh_token": {
      "maxLength": 256,
      "type": "string",
      "description": "The long-term token used to refresh the short term access token. Required only with a grant type of `refresh_token`."
    },
    "code": {
      "maxLength": 256,
      "type": "string",
      "description": "Authorization code from the OAuth 2.1 service received in the front channel that is used to get access tokens and refresh tokens. Required with a grant type of `authorization_code` and `session_bridge`."
    },
    "usid": {
      "type": "string",
      "description": "The shopper's unique identifier, if known. If not provided, a new USID is generated."
    },
    "grant_type": {
      "$ref": "#/$defs/GrantType"
    },
    "redirect_uri": {
      "maxLength": 256,
      "type": "string",
      "description": "The redirect URI that was used when getting the authorization code. A variety of URI formats and wildcards for host are supported, but app links like `airbnb://` or `fb://` are not. \n\nExamples of supported URIs:\n  - `http://localhost:3000/callback`\n  - `https://example.com/callback`\n  - `com.example.app:redirect_uri_path`\n  - ` *.subdomain.topleveldomain.com`\n"
    },
    "code_verifier": {
      "maxLength": 128,
      "type": "string",
      "description": "PKCE code verifier. Created by the client calling the `login` endpoint.\n\nThe `code_verifier` should be a high entropy cryptographically random string with a minimum of 43 characters and a maximum of 128 characters.\n\nThe `code_verifier` is optional when using a private client id for the token request."
    },
    "client_id": {
      "maxLength": 40,
      "type": "string",
      "description": "The SLAS client ID. Required when the grant type is `authorization_code_pkce`."
    },
    "channel_id": {
      "maxLength": 100,
      "type": "string",
      "description": "The channel (B2C Commerce site) that the user is associated with.\n\n**Important: We strongly recommended using the channel_id query parameter because it will be required in the future.\n\n**NOTE - As of July 31, 2024**, SLAS will be requiring the `channel_id` query parameter in token requests."
    },
    "dnt": {
      "type": "string",
      "description": "This is an optional parameter to set `Do Not Track` for the session. \n\nSLAS is making this available, but will not be used by B2C Commerce until after the 24.4 release.\n\nValues are:\n  * `false`\n  * `true`\n\nIf not added the `dnt` value will default to `false`."
    }
  },
  "$defs": {
    "GrantType": {
      "type": "string",
      "description": "Grant Type",
      "enum": [
        "authorization_code",
        "refresh_token",
        "client_credentials",
        "authorization_code_pkce",
        "session_bridge"
      ]
    }
  }
}