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

# Issue or refresh a token

> Exchange an authorization code for tokens, or refresh an access token using a refresh token. Accepts application/x-www-form-urlencoded (recommended) or application/json.



## OpenAPI

````yaml /en/api-reference/openapi.json post /oauth/token
openapi: 3.1.0
info:
  title: OAuth 2.1
  description: Endpoints for registering applications and managing OAuth 2.1 tokens.
  version: 1.0.0
  contact:
    name: Vendaze Support
    email: suporte@vendaze.com
servers:
  - url: https://api.vendaze.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: OAuth
  - name: People
  - name: Companies
  - name: Deals
  - name: Pipelines
  - name: Tasks
  - name: Task Types
  - name: Products
  - name: Tags
  - name: Lists
  - name: Custom Fields
  - name: Webhooks
paths:
  /oauth/token:
    post:
      tags:
        - OAuth
      summary: Issue or refresh a token
      description: >-
        Exchange an authorization code for tokens, or refresh an access token
        using a refresh token. Accepts application/x-www-form-urlencoded
        (recommended) or application/json.
      operationId: issueToken
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenRequest'
      responses:
        '200':
          description: Tokens issued successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenResponse'
        '400':
          description: >-
            Invalid or missing parameter. Possible error codes: `bad_request`
            (malformed body or unsupported Content-Type),
            `unsupported_grant_type` (`grant_type` is not `authorization_code`
            or `refresh_token`), `invalid_request` (missing required parameter
            for the given `grant_type`), `invalid_grant` (authorization code is
            invalid, expired, already used, or does not match).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: invalid_grant
                  message: >-
                    The provided authorization grant is invalid, expired, or
                    does not match.
                  request_id: 550e8400-e29b-41d4-a716-446655440000
        '401':
          description: Invalid client credentials (`client_id` or `client_secret`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: invalid_client
                  message: Invalid client credentials.
                  request_id: 550e8400-e29b-41d4-a716-446655440000
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '500':
          description: >-
            Token exchange failed. The authorization server was unavailable or
            returned an unexpected response. Retry the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: internal_error
                  message: An unexpected error occurred.
                  request_id: 550e8400-e29b-41d4-a716-446655440000
      security: []
components:
  schemas:
    TokenRequest:
      type: object
      required:
        - grant_type
        - client_id
        - client_secret
      properties:
        grant_type:
          type: string
          enum:
            - authorization_code
            - refresh_token
        code:
          type: string
          description: Required for grant_type=authorization_code.
        client_id:
          type: string
          format: uuid
        client_secret:
          type: string
        refresh_token:
          type: string
          description: Required for grant_type=refresh_token.
    TokenResponse:
      type: object
      required:
        - workspace_slug
      properties:
        access_token:
          type: string
          example: eyJ...
        refresh_token:
          type: string
          example: eyJ...
        token_type:
          type: string
          example: Bearer
        expires_in:
          type: integer
          example: 3600
        workspace_slug:
          type: string
          description: >-
            Slug of the workspace the user authorized. Use this to identify the
            connected account in your app.
          example: acme-corp
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            request_id:
              type: string
              format: uuid
  responses:
    RateLimitExceeded:
      description: 'Rate limit exceeded. Error code: `rate_limit_exceeded`.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: rate_limit_exceeded
              message: Rate limit exceeded. Try again in 60 seconds.
              request_id: 550e8400-e29b-41d4-a716-446655440000
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: OAuth 2.1 access token.

````