> ## Documentation Index
> Fetch the complete documentation index at: https://devs.izap.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Exchange or refresh an OAuth token

> Token endpoint supporting `grant_type=authorization_code` (PKCE `code_verifier` required, single-use `code`) and `grant_type=refresh_token`. Returns an access token and rotated refresh token.



## OpenAPI

````yaml /api-reference/openapi.json post /oauth/token
openapi: 3.1.0
info:
  title: iZap API
  version: v1
  description: Public REST API for the iZap WhatsApp business messaging platform.
  contact:
    name: iZap API Support
    email: suporte@izap.ai
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.izap.ai
    description: Production
  - url: https://api-staging.izap.ai
    description: Staging
security:
  - bearerAuth: []
tags:
  - name: Auth
    description: Login and token refresh.
  - name: OAuth
    description: OAuth 2.1 / PKCE authorization for third-party and MCP clients.
  - name: Businesses
    description: Business profile, hours, menus, and chatbot configuration.
  - name: Chats
    description: Conversations, messages, and template sends.
  - name: Scheduling
    description: Customers, services, providers, and bookings (Trinks-backed).
  - name: WhatsApp Templates
    description: Manage and sync WhatsApp message templates.
  - name: Transmissions
    description: Bulk WhatsApp template broadcasts.
  - name: Me
    description: The authenticated user's own profile and active business.
paths:
  /oauth/token:
    post:
      tags:
        - OAuth
      summary: Exchange or refresh an OAuth token
      description: >-
        Token endpoint supporting `grant_type=authorization_code` (PKCE
        `code_verifier` required, single-use `code`) and
        `grant_type=refresh_token`. Returns an access token and rotated refresh
        token.
      operationId: oauthToken
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - grant_type
              properties:
                grant_type:
                  type: string
                  enum:
                    - authorization_code
                    - refresh_token
                code:
                  type: string
                redirect_uri:
                  type: string
                  format: uri
                client_id:
                  type: string
                client_secret:
                  type: string
                code_verifier:
                  type: string
                refresh_token:
                  type: string
      responses:
        '200':
          description: Token issued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenPair'
              example:
                access_token: eyJhbGciOiJIUzI1NiIs...
                refresh_token: R2c8v5b3n1...
                token_type: bearer
        '401':
          description: Invalid client credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: invalid_client
      security: []
components:
  schemas:
    TokenPair:
      type: object
      properties:
        access_token:
          type: string
        refresh_token:
          type: string
        token_type:
          type: string
          example: bearer
    Error:
      type: object
      properties:
        detail:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT access token obtained from POST /api/v1/auth/jwt/login, the OAuth
        token endpoint, or a business-scoped API token. Some
        Business/Chat/Template/Scheduling endpoints alternatively accept HTTP
        Basic credentials scoped to the business slug.

````