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

# Atualizar aplicação OAuth

> Atualiza nome, metadados, scopes ou status da aplicação.

Permissão: `oauth-apps/update`. Envie apenas os campos que deseja alterar.

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH 'https://api.goatpay.com.br/v1/oauth-apps/update/clx_app_01' \
    -H 'X-API-Key: gp_live_SUA_CHAVE' \
    -H 'Content-Type: application/json' \
    -d '{
      "name": "ERP Parceiro v2",
      "allowedScopes": ["account:read", "payments:read", "payments:write"],
      "status": "ACTIVE"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "success": true,
    "message": "Aplicação OAuth atualizada com sucesso",
    "data": {
      "item": {
        "id": "clx_app_01",
        "name": "ERP Parceiro v2",
        "status": "ACTIVE",
        "allowedScopes": ["account:read", "payments:read", "payments:write"],
        "clients": []
      }
    },
    "requestId": "req_oauth_update"
  }
  ```
</ResponseExample>

### Parâmetros

<ParamField path="id" type="string" required>
  ID da aplicação OAuth.
</ParamField>

### Corpo da requisição

<ParamField body="name" type="string">
  Novo nome da aplicação.
</ParamField>

<ParamField body="description" type="string">
  Nova descrição.
</ParamField>

<ParamField body="logoUrl" type="string">
  URL do logo exibido no consentimento.
</ParamField>

<ParamField body="privacyPolicyUrl" type="string">
  URL da política de privacidade.
</ParamField>

<ParamField body="termsUrl" type="string">
  URL dos termos de uso.
</ParamField>

<ParamField body="allowedScopes" type="array">
  Novo conjunto de scopes permitidos.
</ParamField>

<ParamField body="status" type="string">
  `ACTIVE` ou `DISABLED` — apps desabilitadas não podem iniciar novos fluxos de authorize.
</ParamField>

<ParamField body="website" type="string">
  URL do site.
</ParamField>

<ParamField body="developerName" type="string">
  Nome do desenvolvedor.
</ParamField>


## OpenAPI

````yaml PATCH /oauth-apps/update/{id}
openapi: 3.1.0
info:
  title: GoatPay API
  description: >
    API pública merchant da GoatPay. Autenticação via header `X-API-Key:
    gp_live_...`.

    Respostas de sucesso usam o envelope `{ success, message, data, requestId
    }`.

    Campos internos (`accountId`, `metadata`, histórico de entregas de webhook,
    etc.) não são expostos.

    `providerTransactionId` aparece como `referenceId`; `providerInfractionId`
    como `infractionId`.

    Rate limit global: 100 requisições por minuto por API key (HTTP 429). Sem
    chave, limite por IP.
  version: 1.0.0
servers:
  - url: https://api.goatpay.com.br/v1
    description: Produção
security:
  - apiKeyAuth: []
tags:
  - name: pix
    description: >-
      Cobranças PIX (receber), reembolsos de depósito recebido e transferências
      PIX (enviar). Alias legado em payouts/* para envios.
  - name: transfer-internal
    description: Transferências entre contas GoatPay
  - name: transfer-scheduled
    description: Transferências programadas (agendar, repetir ou por saldo)
  - name: crypto
    description: Depósitos e transferências em criptomoeda
  - name: billings
    description: >-
      Cobranças avulsas (pagamento único) — boleto, cartão ou PIX na Conta
      Padrão (PF ou PJ)
  - name: subscriptions
    description: >-
      Assinaturas recorrentes com ciclo fixo — boleto, cartão ou PIX na Conta
      Padrão (PF ou PJ)
  - name: account
    description: Saldo e extrato
  - name: subaccount
    description: Subcontas merchant (carteiras lógicas sob a conta principal)
  - name: meds
    description: Disputas MED
  - name: webhooks
    description: Endpoints de webhook de saída
  - name: oauth
    description: OAuth 2.0 — autorização de terceiros (fora do prefixo /v1)
  - name: oauth-apps
    description: Gestão de aplicações OAuth (prefixo /v1, API key)
  - name: payouts
    description: Alias de transfer-pix para saques PIX
  - name: customers
    description: Clientes da loja (CRM)
  - name: products
    description: Produtos e entregas digitais
  - name: coupons
    description: Cupons de desconto para links
  - name: payment-links
    description: Links de pagamento e checkout hospedado
paths:
  /oauth-apps/update/{id}:
    patch:
      tags:
        - oauth-apps
      summary: Atualizar aplicação OAuth
      description: Atualiza metadados, scopes ou status. Permissão `oauth-apps/update`.
      operationId: oauthAppsUpdate
      parameters:
        - $ref: '#/components/parameters/ResourceId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOAuth2Application'
      responses:
        '200':
          $ref: '#/components/responses/OAuthAppsItemSuccess'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    ResourceId:
      name: id
      in: path
      required: true
      schema:
        type: string
      description: ID do recurso (transação, cobrança, webhook, etc.)
  schemas:
    UpdateOAuth2Application:
      type: object
      properties:
        name:
          type: string
          maxLength: 120
        description:
          type: string
          maxLength: 500
        logoUrl:
          type: string
          format: uri
        website:
          type: string
          format: uri
        privacyPolicyUrl:
          type: string
          format: uri
        termsUrl:
          type: string
          format: uri
        developerName:
          type: string
          maxLength: 120
        allowedScopes:
          type: array
          items:
            type: string
        status:
          type: string
          enum:
            - ACTIVE
            - DISABLED
    PublicOAuth2ApplicationItemData:
      type: object
      properties:
        item:
          $ref: '#/components/schemas/PublicOAuth2Application'
    ErrorEnvelope:
      type: object
      required:
        - success
        - message
        - error
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: Subconta inativa
        error:
          type: object
          properties:
            code:
              type: string
              example: Bad Request
            statusCode:
              type: integer
              example: 400
        requestId:
          type: string
          example: req_abc123
    PublicOAuth2Application:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
          nullable: true
        logoUrl:
          type: string
          format: uri
          nullable: true
        website:
          type: string
          format: uri
          nullable: true
        privacyPolicyUrl:
          type: string
          format: uri
          nullable: true
        termsUrl:
          type: string
          format: uri
          nullable: true
        developerName:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - ACTIVE
            - DISABLED
        allowedScopes:
          type: array
          items:
            type: string
        lastUsedAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
        clients:
          type: array
          items:
            $ref: '#/components/schemas/PublicOAuth2Client'
    PublicOAuth2Client:
      type: object
      properties:
        id:
          type: string
        environment:
          type: string
          enum:
            - DEV
            - PRODUCTION
        clientId:
          type: string
          example: gp_oauth_dev_...
        clientSecretPreview:
          type: string
          example: gp_oauth_dev_...****
        status:
          type: string
        redirectUris:
          type: array
          items:
            $ref: '#/components/schemas/PublicOAuth2RedirectUri'
    PublicOAuth2RedirectUri:
      type: object
      properties:
        id:
          type: string
        uri:
          type: string
          format: uri
  responses:
    OAuthAppsItemSuccess:
      description: Aplicação OAuth consultada, criada ou atualizada.
      content:
        application/json:
          schema:
            type: object
            required:
              - success
              - message
              - data
            properties:
              success:
                type: boolean
              message:
                type: string
              data:
                $ref: '#/components/schemas/PublicOAuth2ApplicationItemData'
              requestId:
                type: string
    Unauthorized:
      description: Chave ausente, inválida ou revogada.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: Chave sem permissão para este endpoint.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    NotFound:
      description: Recurso não encontrado.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Chave `gp_live_...` criada em Integrações → Chaves de API no dashboard.

````