> ## 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.

# Rotacionar credenciais do aplicativo

> Gera um novo client_secret e invalida o anterior imediatamente. O client_id permanece o mesmo. Os tokens ativos dos usuários não são afetados.



## OpenAPI

````yaml /pt/api-reference/openapi.json post /v1/auth/rotate-app
openapi: 3.1.0
info:
  title: OAuth 2.1
  description: Endpoints para registrar aplicativos e gerenciar tokens OAuth 2.1.
  version: 1.0.0
  contact:
    name: Suporte Vendaze
    email: suporte@vendaze.com
servers:
  - url: https://api.vendaze.com
    description: Produção
security:
  - bearerAuth: []
tags:
  - name: OAuth
  - name: Pessoas
  - name: Empresas
  - name: Negócios
  - name: Pipelines
  - name: Tarefas
  - name: Tipos de Tarefas
  - name: Produtos
  - name: Tags
  - name: Listas
  - name: Campos Adicionais
  - name: Webhooks
paths:
  /v1/auth/rotate-app:
    post:
      tags:
        - OAuth
      summary: Rotacionar credenciais do aplicativo
      description: >-
        Gera um novo client_secret e invalida o anterior imediatamente. O
        client_id permanece o mesmo. Os tokens ativos dos usuários não são
        afetados.
      operationId: rotateApp
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RotateAppRequest'
      responses:
        '200':
          description: >-
            Credenciais rotacionadas com sucesso. Novas credenciais enviadas por
            e-mail.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RotateAppResponse'
        '400':
          description: >-
            Body JSON inválido ou não parseável. Código de erro: `bad_request`.
            Mensagem: `"Request body must be valid JSON."`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: bad_request
                  message: Request body must be valid JSON.
                  request_id: 550e8400-e29b-41d4-a716-446655440000
        '401':
          description: >-
            E-mail não corresponde ao cadastrado no aplicativo. Código de erro:
            `invalid_client`. Mensagem: `"Invalid client credentials."`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: invalid_client
                  message: Invalid client credentials.
                  request_id: 550e8400-e29b-41d4-a716-446655440000
        '404':
          description: >-
            Aplicativo não encontrado ou revogado. Código de erro: `not_found`.
            Mensagem: `"App not found."`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: not_found
                  message: App not found.
                  request_id: 550e8400-e29b-41d4-a716-446655440000
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '500':
          description: >-
            Falha ao rotacionar ou persistir as credenciais. Código de erro:
            `internal_error`. Mensagem: `"An unexpected error occurred."` Use o
            `request_id` para correlacionar com os logs.
          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:
    RotateAppRequest:
      type: object
      required:
        - client_id
        - email
      properties:
        client_id:
          type: string
          format: uuid
          example: 9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
          description: client_id atual do aplicativo a ser rotacionado.
        email:
          type: string
          format: email
          example: dev@meusaas.com
          description: >-
            E-mail cadastrado no aplicativo. Usado para verificar a propriedade.
            A API nunca revela qual e-mail está cadastrado.
        app_name:
          type: string
          maxLength: 100
          example: Meu SaaS v2
          description: >-
            Novo nome exibido aos usuários na tela de consentimento. Máx. 100
            chars. Se omitido, o nome atual é mantido.
        description:
          type: string
          maxLength: 500
          example: Integração atualizada com a Vendaze.
          description: >-
            Nova descrição do que seu app faz. Máx. 500 chars. Se omitido, a
            descrição atual é mantida.
        avatar_image:
          type: string
          example: data:image/png;base64,iVBORw0KGgo...
          description: >-
            URL HTTPS pública ou Data URI base64 completo do logo do seu app
            (ex: `data:image/png;base64,...`). Formatos aceitos: JPEG, PNG,
            WebP, GIF, BMP, TIFF. Se omitido, o avatar atual é mantido.
        redirect_uris:
          type: array
          items:
            type: string
            format: uri
          example:
            - https://meusaas.com/callback/vendaze
          description: >-
            Nova lista de URIs HTTPS de redirecionamento. Substitui a lista
            anterior integralmente. Se omitido, a lista atual é mantida.
    RotateAppResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            app_name:
              type: string
              example: Meu SaaS v2
            client_id:
              type: string
              format: uuid
              example: 9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
              description: O client_id do aplicativo. Não muda após a rotação.
            avatar_url:
              type: string
              example: https://storage.vendaze.com/assets/integrations/meusaasv2.jpg
              description: >-
                URL pública do avatar armazenado. Presente somente se
                avatar_image foi enviado na requisição.
            message:
              type: string
              example: New credentials sent by email.
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            request_id:
              type: string
              format: uuid
    ValidationErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: validation_error
            message:
              type: string
              example: Validation failed.
            fields:
              type: object
              additionalProperties:
                type: string
            request_id:
              type: string
              format: uuid
  responses:
    ValidationError:
      description: >-
        Validação de entrada falhou. Código: `validation_error`. O objeto
        `fields` mapeia cada campo inválido para uma descrição do problema.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorResponse'
          example:
            error:
              code: validation_error
              message: Validation failed.
              fields:
                url: url must use HTTPS.
                events: At least one event is required.
              request_id: 550e8400-e29b-41d4-a716-446655440000
    RateLimitExceeded:
      description: 'Rate limit excedido. Código: `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: Access token OAuth 2.1.

````