> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kiwify.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Gerar token OAuth

> Entenda como adquirir o token Bearer OAuth, necessário para autenticação nas demais rotas da API.



## OpenAPI

````yaml post /oauth/token
openapi: 3.1.0
info:
  version: 1.0.0
  title: API Kiwify
  description: ''
servers:
  - url: https://public-api.kiwify.com/v1/
    description: base
security: []
tags:
  - name: Autenticação
  - name: Conta
  - name: Produtos
  - name: Vendas
  - name: Financeiro
  - name: Affiliados
  - name: Webhooks
  - name: Eventos
paths:
  /oauth/token:
    post:
      tags:
        - Autenticação
      summary: >-
        Endpoint para gerar um Bearer token utilizado como autenticação nos
        outros endpoints da API.
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/OAuthRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthSuccessResponse'
              examples:
                Success:
                  value:
                    access_token: >-
                      eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdG9yZV9hcGlfaW50ZWdyYXRpb25faWQiOiIzNmI1MDZlYS03M2ZmLTQ2NjQtODQ4Zi1iODFjYzllZmU0NzYiLCJzdG9yZV9pZCI6Ilh2UzBxZmtkekNaVGc4eiIsInNjb3BlIjoic3RhdHMgcHJvZHVjdHMgZXZlbnRzIHNhbGVzIHNhbGVzX3JlZnVuZCBmaW5hbmNpYWwgYWZmaWxpYXRlcyB3ZWJob29rcyIsImp0aSI6ImVkNGFlMmUyOWZhZWIxMzUwZjNmMTdjMzExYmM0NjhhIiwiZXhwIjoxNzAxMzQ4NTE1LCJpYXQiOjE3MDEyNjIxMTV9.dJWYnnQv6TREivsL3riYFQPypHg-6RqaGVff8iM4puw
                    token_type: Bearer
                    expires_in: 86400
                    scope: >-
                      stats products events sales sales_refund financial
                      affiliates webhooks
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthErrorResponse'
              examples:
                InvalidClient:
                  value:
                    error: auth_error
                    message: 'Invalid client: client is invalid'
          description: Solicitação Inválida
components:
  schemas:
    OAuthRequest:
      type: object
      properties:
        client_id:
          type: string
          example: be161f42-1d05-4949-8736-1a526c28672d
        client_secret:
          type: string
          example: a12b34c56d78e90f1234abcd5678efgh9012ijkl3456mnop7890qrst1234uvwx
      required:
        - client_id
        - client_secret
    OAuthSuccessResponse:
      type: object
      properties:
        access_token:
          type: string
          example: >-
            eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdG9yZV9hcGlfaW50ZWdyYXRpb25faWQiOiIyZThmMzExMy0wNmE1LTQ4OTAtOTgyNC1iNWM1ZmI3YmZkYTciLCJzdG9yZV9pZCI6IlU5VmNINnlaelJrVDJmQiIsImludGVncmF0aW9uX25hbWUiOiJ0ZXN0ZSIsInNjb3BlIjoic3RhdHMiLCJqdGkiOiJhZTMwZDQ4NjU3NWJmMDBiMDFiNzFkNDFlY2M3OWM5YyIsImV4cCI6MTcwMjU5MDg0NiwiaWF0IjoxNzAyNTA0NDQ2fQ.N8Nl5Coj3bL9M6tkaAE61bL2NnqwhUYfNnRqhTMGElc
        token_type:
          type: string
          example: Bearer
        expires_in:
          type: string
          example: '86400'
        scope:
          type: string
          example: >-
            stats products events sales sales_refund financial affiliates
            webhooks
    OAuthErrorResponse:
      type: object
      properties:
        error:
          type: string
          example: auth_error
        message:
          type: string
          example: 'Invalid client: client is invalid'

````