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

# Atualizar link

> Envie só o que muda; ao menos um campo é obrigatório. Todos os campos da criação podem ser editados, mais o `status`.
Quando vem algum campo de preço, o link inteiro passa pelas regras do tipo. Trocar o tipo limpa os campos do tipo anterior.
Mudar o link não altera vendas já feitas.




## OpenAPI

````yaml /openapi.yaml put /v1/payment-links/{paymentLinkId}
openapi: 3.1.0
info:
  title: API Nasten
  version: '1.0'
  description: >
    API de pagamentos da Nasten: Pix, cartão, boleto, saques, clientes,

    produtos, links de pagamento, assinaturas e webhooks.


    **Autenticação.** Chame `POST /auth` com Basic
    (`base64(chave_publica:chave_secreta)`)

    para obter o Bearer token usado em todas as rotas `/v1/*`. O token vale 10
    minutos.


    **Valores.** Todo valor monetário é um inteiro em centavos.


    **Modo de teste.** O host é o mesmo. Com a chave de Desenvolvimento, as
    cobranças

    viram vendas de teste, sem dinheiro de verdade. Veja `POST
    /v1/sandbox/transactions/{transactionId}/pay`.


    **Erros.** O corpo padrão é `{ "success": false, "message": "...", "code":
    "NST-<status>-<hash>" }`.

    Erro de validação traz também `errors`. O `403` traz `error` e, quando há,
    `reason`.

    O `429` traz `error`, `retryAfterMs`, `limit`, `window` e o header
    `Retry-After`.

    Algumas rotas devolvem só `success` e `message`, como indicado em cada uma.

    Qualquer rota pode responder `503` em sobrecarga temporária (`Service
    temporarily unavailable. Please retry.`).


    **Limites.** `POST /auth`: 200 requisições por minuto por chave pública.

    Demais rotas: 1800 requisições por minuto por empresa.
  contact:
    name: Suporte Nasten
    email: tech@nasten.com.br
servers:
  - url: https://api.nasten.net
    description: Produção e modo de teste (o ambiente é definido pela chave)
security:
  - bearerAuth: []
tags:
  - name: Autenticação
  - name: Pix In
  - name: Cartão
  - name: Boleto
  - name: Modo de teste
  - name: Transações
  - name: Pix Out
  - name: Financeiro
  - name: Clientes
  - name: Produtos
  - name: Links de Pagamento
  - name: Assinaturas
  - name: Webhooks
paths:
  /v1/payment-links/{paymentLinkId}:
    parameters:
      - $ref: '#/components/parameters/PaymentLinkId'
    put:
      tags:
        - Links de Pagamento
      summary: Atualizar link
      description: >
        Envie só o que muda; ao menos um campo é obrigatório. Todos os campos da
        criação podem ser editados, mais o `status`.

        Quando vem algum campo de preço, o link inteiro passa pelas regras do
        tipo. Trocar o tipo limpa os campos do tipo anterior.

        Mudar o link não altera vendas já feitas.
      operationId: atualizarLink
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
                - type: object
                  minProperties: 1
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 255
                    amount:
                      type: integer
                      minimum: 0
                    paymentMethods:
                      type: array
                      uniqueItems: true
                      items:
                        $ref: '#/components/schemas/FormaDoLink'
                    returnUrl:
                      type:
                        - string
                        - 'null'
                      format: uri
                      description: null ou vazio volta à página de obrigado da Nasten
                    imageUrl:
                      type:
                        - string
                        - 'null'
                      maxLength: 2048
                      description: null ou vazio apaga
                    interestPassthrough:
                      type: boolean
                    allowedDoubleCard:
                      type: boolean
                    allowedCardPix:
                      type: boolean
                    status:
                      type: string
                      enum:
                        - approved
                        - cancelled
                      description: >-
                        approved (ativo) ou cancelled (desativado: a página sai
                        do ar na hora)
                - $ref: '#/components/schemas/CamposDoCheckoutDoLink'
                - $ref: '#/components/schemas/CamposDePrecoDoLink'
            example:
              status: cancelled
      responses:
        '200':
          description: Link atualizado, com `companyId`
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - data
                properties:
                  success:
                    type: boolean
                    const: true
                  data:
                    $ref: '#/components/schemas/LinkDePagamentoComEmpresa'
        '400':
          description: >-
            `Informe ao menos um campo para atualizar`, campo fora do formato
            (com `errors`), regras do tipo de preço, forma não liberada ou
            produto recusado ou banido.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErroDeValidacao'
        '401':
          $ref: '#/components/responses/NaoAutenticado'
        '404':
          description: >-
            `Link de pagamento não encontrado` ou `Produto não encontrado nesta
            empresa`. Vem só com `success` e `message`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErroSimples'
        '413':
          $ref: '#/components/responses/CorpoGrandeDemais'
        '415':
          $ref: '#/components/responses/TipoDeConteudoInvalido'
        '429':
          $ref: '#/components/responses/LimiteExcedido'
        '500':
          $ref: '#/components/responses/ErroInterno'
components:
  parameters:
    PaymentLinkId:
      in: path
      name: paymentLinkId
      required: true
      description: Id do link (cuid)
      schema:
        type: string
        pattern: ^c[a-z0-9]+$
      example: clpaylink1234567890abcdef
  schemas:
    FormaDoLink:
      type: string
      enum:
        - pix
        - credit_card
        - boleto
        - google_pay
        - apple_pay
        - samsung_pay
    CamposDoCheckoutDoLink:
      type: object
      properties:
        externalReference:
          type:
            - string
            - 'null'
          maxLength: 255
          description: >-
            Referência sua, devolvida em paymentLink.externalReference de cada
            venda. Vazio ou null apaga.
          example: pedido-1042
        productId:
          type:
            - string
            - 'null'
          description: >-
            Produto da sua empresa ligado ao link (cuid). Não pode estar
            apagado, recusado nem banido. Vazio ou null desliga.
        title:
          type:
            - string
            - 'null'
          maxLength: 120
          description: Título do checkout. Vazio usa o name.
        description:
          type:
            - string
            - 'null'
          maxLength: 80
          description: Texto curto abaixo do título
        checkoutStyle:
          anyOf:
            - $ref: '#/components/schemas/EstiloDoCheckout'
            - type: 'null'
    CamposDePrecoDoLink:
      type: object
      properties:
        pricingType:
          type: string
          enum:
            - one_time
            - recurring
            - free
          default: one_time
        recurringInterval:
          type:
            - string
            - 'null'
          enum:
            - weekly
            - monthly
            - bimonthly
            - quarterly
            - semiannual
            - annual
            - null
          description: Só assinatura, e obrigatório nela
        initialFee:
          type:
            - integer
            - 'null'
          minimum: 1
          description: Só assinatura. Taxa em centavos somada à primeira cobrança.
        trialDays:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 365
          description: Só assinatura. Exige initialFee.
        maxCharges:
          type:
            - integer
            - 'null'
          minimum: 2
          maximum: 360
          description: Só assinatura. Sem o campo, cobra até ser cancelada.
        cancelDiscountPercent:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 100
          description: Só assinatura. Vai junto com cancelDiscountIntervals.
        cancelDiscountIntervals:
          type:
            - integer
            - 'null'
          minimum: 0
          maximum: 120
          description: 'Só assinatura. Em quantas cobranças o desconto vale. 0: para sempre.'
        accessDays:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 3650
          description: Só link grátis. Quantos dias o acesso dura.
        waitlistEnabled:
          type: boolean
          default: false
          description: Liga a lista de espera
        questions:
          type:
            - array
            - 'null'
          maxItems: 10
          items:
            $ref: '#/components/schemas/PerguntaDoLinkEntrada'
    LinkDePagamentoComEmpresa:
      allOf:
        - $ref: '#/components/schemas/LinkDePagamento'
        - type: object
          properties:
            companyId:
              type: string
    ErroDeValidacao:
      allOf:
        - $ref: '#/components/schemas/Erro'
        - type: object
          properties:
            errors:
              type: array
              description: Detalhe campo a campo, quando a falha é de validação
              items:
                type: object
                properties:
                  path:
                    type: string
                    example: customer.document
                  message:
                    type: string
                    example: Documento inválido
    ErroSimples:
      type: object
      description: Formato de algumas rotas, sem `code`.
      required:
        - success
        - message
      properties:
        success:
          type: boolean
          const: false
        message:
          type: string
    EstiloDoCheckout:
      type: object
      additionalProperties: false
      description: Aparência do checkout. Chave desconhecida responde 400.
      properties:
        backgroundColor:
          type: string
          pattern: ^#[0-9A-Fa-f]{6}$
          example: '#FFFFFF'
        buttonColor:
          type: string
          pattern: ^#[0-9A-Fa-f]{6}$
          example: '#E70000'
        fontFamily:
          type: string
          minLength: 1
          maxLength: 60
          pattern: ^[A-Za-z0-9 ]+$
          description: Nome como aparece no Google Fonts
          example: Inter
        borderStyle:
          type: string
          enum:
            - rounded
            - pill
            - rectangular
    PerguntaDoLinkEntrada:
      type: object
      additionalProperties: false
      required:
        - title
      properties:
        id:
          type: string
          minLength: 1
          maxLength: 40
          description: Sem ele, a Nasten gera um. Dois iguais respondem 400.
        title:
          type: string
          minLength: 1
          maxLength: 120
          example: Qual é o seu Instagram?
        placeholder:
          type:
            - string
            - 'null'
          maxLength: 120
          example: '@seuperfil'
        optional:
          type: boolean
          default: false
    LinkDePagamento:
      allOf:
        - $ref: '#/components/schemas/LinkDePagamentoResumo'
        - type: object
          properties:
            returnUrl:
              type:
                - string
                - 'null'
              format: uri
            updatedAt:
              type: string
              format: date-time
            interestPassthrough:
              type: boolean
            allowedDoubleCard:
              type: boolean
            allowedCardPix:
              type: boolean
    Erro:
      type: object
      required:
        - success
        - message
        - code
      properties:
        success:
          type: boolean
          const: false
        message:
          type: string
          description: Descrição do problema. Algumas mensagens vêm em inglês.
          example: Descrição do erro
        code:
          type: string
          description: >-
            Código no formato NST-<status>-<hash>. Identifica a rota e o status,
            não a chamada. Cite ao acionar o suporte.
          example: NST-400-3f7a
    ErroDeLimite:
      allOf:
        - $ref: '#/components/schemas/Erro'
        - type: object
          properties:
            error:
              type: string
              const: Too Many Requests
            retryAfterMs:
              type: integer
              description: Milissegundos até poder repetir
              example: 42000
            limit:
              type: integer
              description: Limite da janela
              example: 1800
            window:
              type: string
              description: Tamanho da janela por extenso em inglês
              example: 1 minute
    LinkDePagamentoResumo:
      type: object
      properties:
        id:
          type: string
          example: clpaylink1234567890abcdef
        name:
          type: string
          example: Pedido 1042
        imageUrl:
          type:
            - string
            - 'null'
        createdAt:
          type: string
          format: date-time
        paymentMethods:
          type: array
          items:
            $ref: '#/components/schemas/FormaDoLink'
        amount:
          type: integer
          description: >-
            Centavos. 0 no link grátis. Na assinatura, o preço de cada
            renovação.
          example: 50000
        status:
          type: string
          enum:
            - approved
            - cancelled
        productId:
          type:
            - string
            - 'null'
        title:
          type:
            - string
            - 'null'
        description:
          type:
            - string
            - 'null'
        checkoutStyle:
          anyOf:
            - $ref: '#/components/schemas/EstiloDoCheckout'
            - type: 'null'
        product:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
            name:
              type: string
            imageUrl:
              type:
                - string
                - 'null'
        externalReference:
          type:
            - string
            - 'null'
          example: pedido-1042
        pricingType:
          type: string
          enum:
            - free
            - one_time
            - recurring
        recurringInterval:
          type:
            - string
            - 'null'
          enum:
            - weekly
            - monthly
            - bimonthly
            - quarterly
            - semiannual
            - annual
            - null
        initialFee:
          type:
            - integer
            - 'null'
        trialDays:
          type:
            - integer
            - 'null'
        maxCharges:
          type:
            - integer
            - 'null'
        cancelDiscountPercent:
          type:
            - integer
            - 'null'
        cancelDiscountIntervals:
          type:
            - integer
            - 'null'
        accessDays:
          type:
            - integer
            - 'null'
        waitlistEnabled:
          type: boolean
        questions:
          type: array
          items:
            $ref: '#/components/schemas/PerguntaDoLink'
    PerguntaDoLink:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
        placeholder:
          type:
            - string
            - 'null'
        optional:
          type: boolean
  responses:
    NaoAutenticado:
      description: >
        Token ausente, malformado ou expirado (`Token inválido ou expirado`), ou
        token sem sessão válida (`Token expired or invalid`).

        Gere outro token em POST /auth e repita.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Erro'
          example:
            success: false
            message: Token inválido ou expirado
            code: NST-401-rcp9
    CorpoGrandeDemais:
      description: '`O corpo da requisição passa do tamanho máximo aceito.`'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Erro'
    TipoDeConteudoInvalido:
      description: '`Content-Type não aceito. Envie o corpo como application/json.`'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Erro'
    LimiteExcedido:
      description: >-
        Limite de requisições excedido (1800 por minuto por empresa nas rotas
        /v1/*, 200 por minuto por chave em /auth).
      headers:
        Retry-After:
          description: Segundos até poder repetir
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErroDeLimite'
    ErroInterno:
      description: >-
        Falha inesperada (`Internal server error`) ou resposta que não passou na
        conferência do servidor. Repita com backoff e, persistindo, envie o
        `code` ao suporte.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Erro'
          example:
            success: false
            message: Internal server error
            code: NST-500-9e2b
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Token obtido em POST /auth. Vale 10 minutos.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.