{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/instasent/json-schema/instasent-oauth-token-request-schema.json",
  "title": "OAuth token request",
  "description": "Form-encoded token request. Which fields are required depends on\n`grant_type`: `authorization_code` needs `code`, `code_verifier` and\n`redirect_uri`; `refresh_token` needs `refresh_token`. `client_id` is\nrequired for both.\n",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/instasent-oauth-api-openapi.yml#/components/schemas/OAuthTokenRequest",
  "type": "object",
  "properties": {
    "grant_type": {
      "type": "string",
      "description": "The grant being used. Any other value returns `unsupported_grant_type`.",
      "enum": [
        "authorization_code",
        "refresh_token"
      ]
    },
    "client_id": {
      "type": "string",
      "description": "The registered client id. It must match the client the code or\nrefresh token was issued to.\n"
    },
    "code": {
      "type": "string",
      "description": "`authorization_code` only. The single-use code the dashboard\nreturned to the callback. Consumed on first use.\n"
    },
    "code_verifier": {
      "type": "string",
      "description": "`authorization_code` only. The PKCE verifier whose `S256` hash was\nsent as `code_challenge` to the authorization endpoint.\n"
    },
    "redirect_uri": {
      "type": "string",
      "format": "uri",
      "description": "`authorization_code` only. Must be byte-identical to the\n`redirect_uri` the code was issued for.\n"
    },
    "refresh_token": {
      "type": "string",
      "description": "`refresh_token` only. The current refresh token, which this call\nconsumes and replaces.\n"
    }
  },
  "required": [
    "grant_type",
    "client_id"
  ]
}