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

# Definir redirect URIs

> Substitui a lista de redirect URIs do client (match exato no authorize).

Permissão: `oauth-apps/clients/redirect-uris`. A lista enviada **substitui** a anterior por completo.

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT 'https://api.goatpay.com.br/v1/oauth-apps/clients/redirect-uris/clx_app_01/DEV' \
    -H 'X-API-Key: gp_live_SUA_CHAVE' \
    -H 'Content-Type: application/json' \
    -d '{
      "uris": [
        "http://localhost:3000/oauth/callback",
        "http://127.0.0.1:3847/callback"
      ]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "success": true,
    "message": "Redirect URIs atualizados com sucesso",
    "data": {
      "item": {
        "id": "clx_app_01",
        "name": "ERP Parceiro",
        "clients": [
          {
            "environment": "DEV",
            "clientId": "gp_oauth_dev_...",
            "redirectUris": [
              { "id": "clx_uri_a", "uri": "http://localhost:3000/oauth/callback" },
              { "id": "clx_uri_b", "uri": "http://127.0.0.1:3847/callback" }
            ]
          }
        ]
      }
    },
    "requestId": "req_oauth_uris"
  }
  ```
</ResponseExample>

### Parâmetros

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

<ParamField path="environment" type="string" required>
  `DEV` ou `PRODUCTION`.
</ParamField>

### Corpo da requisição

<ParamField body="uris" type="array" required>
  Lista de URIs (máx. 20). DEV aceita `http://localhost`; produção exige HTTPS. Schemes custom (`myapp://callback`) são permitidos se registrados explicitamente — match exato, sem wildcards.
</ParamField>

<Note>
  O `redirect_uri` em [GET /oauth/authorize](/api-reference/endpoint/oauth/authorize) deve corresponder **exatamente** a uma URI cadastrada.
</Note>


## OpenAPI

````yaml PUT /oauth-apps/clients/redirect-uris/{applicationId}/{environment}
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/clients/redirect-uris/{applicationId}/{environment}:
    put:
      tags:
        - oauth-apps
      summary: Definir redirect URIs
      description: >-
        Substitui URIs do client (match exato no authorize). Permissão
        `oauth-apps/clients/redirect-uris`.
      operationId: oauthAppsClientsRedirectUris
      parameters:
        - name: applicationId
          in: path
          required: true
          schema:
            type: string
        - name: environment
          in: path
          required: true
          schema:
            type: string
            enum:
              - DEV
              - PRODUCTION
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetOAuth2RedirectUris'
      responses:
        '200':
          $ref: '#/components/responses/OAuthAppsItemSuccess'
        '400':
          description: URI inválida para o ambiente.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    SetOAuth2RedirectUris:
      type: object
      required:
        - uris
      properties:
        uris:
          type: array
          items:
            type: string
            format: uri
    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.

````