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

# Update a payment link

> Change a payment link's title, description or success URL.

Authenticate with an API key that belongs to the link's organization and has Full access or the `products:payment_links:write` permission (**Payment links** under **Can create and change** in the dashboard). Only the Owner and Admin roles can grant it.

* `linkId` is the ID of a payment link in your organization, such as an item returned by [Get product payment links](https://docs.anyway.sh/api-reference/endpoint/get-product-payment-links.md).
* The body takes `title`, `description` and `successUrl`, all optional. Only the fields you send change.
* `successUrl` is an absolute HTTPS URL. Send an empty string to clear it; the customer then sees the Anyway receipt.
* Price, currency and billing can't be changed. To sell at a different price, [create a new payment link](https://docs.anyway.sh/api-reference/endpoint/create-product-payment-link.md).
* The response is the full updated link, whether it is active or not, with the same shape as an item from [Get product payment links](https://docs.anyway.sh/api-reference/endpoint/get-product-payment-links.md).
* Unknown fields are rejected with `400`. There is no `Idempotency-Key` for this endpoint.

| Status | Code | Meaning |
| - | - | - |
| `400` | | Validation failed: a `successUrl` that isn't an absolute HTTPS URL, an unknown field, or a value that is too long (`title` 255 characters, `description` 2000, `successUrl` 1000). |
| `401` | | The API key is missing or invalid. |
| `403` | `INSUFFICIENT_SCOPE` | The key lacks `products:payment_links:write`. |
| `404` | | The payment link doesn't exist or belongs to another organization. |
| `413` | `PAYLOAD_TOO_LARGE` | The request body is larger than 64 KiB. |


## OpenAPI

````yaml api-reference/openapi.json PATCH /v1/payment-links/{linkId}
openapi: 3.0.3
info:
  description: >-
    Organization-scoped commerce API for merchant backends: create and manage
    checkout sessions, and query commerce records.
  title: Anyway Merchant API
  contact: {}
  version: '1.0'
  x-source: anyway-backend-go
servers:
  - url: https://merchant-api-prod.anyway.sh
security: []
paths:
  /v1/payment-links/{linkId}:
    patch:
      tags:
        - products
      summary: Update a payment link
      description: >-
        Changes a payment link's title, description or success URL; only the
        fields you send change. The response is the full link, active or not.
        Requires Full access or the `products:payment_links:write` permission.
        Price, currency and billing can't be changed; create a new payment link
        instead. `successUrl` must be an absolute HTTPS URL; an empty string
        clears it. Unknown request fields return 400. There is no
        Idempotency-Key.
      parameters:
        - description: Payment link ID
          name: linkId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        description: Fields to change
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/product.UpdatePaymentLinkRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/response.ApiResponse-product_PaymentLinkResponse
        '400':
          description: >-
            Bad Request. A successUrl that is not an absolute HTTPS URL, an
            unknown field, or a value that is too long (title 255, description
            2000, successUrl 1000).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
        '403':
          description: >-
            Forbidden. The API key lacks the required permission
            (INSUFFICIENT_SCOPE).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
        '404':
          description: >-
            Not Found. The payment link does not exist or belongs to another
            organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
        '413':
          description: Request body larger than 64 KiB (`PAYLOAD_TOO_LARGE`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
      security:
        - APIKeyAuth: []
components:
  schemas:
    product.UpdatePaymentLinkRequest:
      type: object
      properties:
        title:
          type: string
          maxLength: 255
          description: New title shown on the pay page
        description:
          type: string
          maxLength: 2000
          description: New description shown on the pay page
        successUrl:
          type: string
          maxLength: 1000
          description: >-
            Absolute HTTPS URL to send the customer to after paying. Send an
            empty string to clear it.
    response.ApiResponse-product_PaymentLinkResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/product.PaymentLinkResponse'
        error:
          $ref: '#/components/schemas/response.ErrorDetail'
        message:
          type: string
        success:
          type: boolean
    response.ApiResponse-any:
      type: object
      properties:
        data: {}
        error:
          $ref: '#/components/schemas/response.ErrorDetail'
        message:
          type: string
        success:
          type: boolean
    product.PaymentLinkResponse:
      type: object
      properties:
        amount:
          type: number
          nullable: true
        createdAt:
          type: string
        currency:
          type: string
        flexibleAmount:
          type: boolean
        isActive:
          type: boolean
        name:
          type: string
        paymentLinkUrl:
          type: string
        pricingId:
          type: string
        pricingType:
          type: string
        provider:
          type: string
        title:
          type: string
        description:
          type: string
        minAmount:
          type: number
          nullable: true
        maxAmount:
          type: number
          nullable: true
        successUrl:
          type: string
          description: >-
            Where the customer is sent after paying. Empty when the Anyway
            receipt is used.
    response.ErrorDetail:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
  securitySchemes:
    APIKeyAuth:
      description: 'Merchant API key (format: ak_BASE64)'
      type: apiKey
      name: X-API-Key
      in: header

````

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