# Get link details

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /payment-links/{id}:
    get:
      summary: Get link details
      deprecated: false
      description: >-
        Returns a single-use payment link, its payments, and an aggregated
        `paymentStatus` field that tells whether the link has any completed
        payment.
      tags:
        - PaymentLinks
        - PaymentLinks
      parameters:
        - name: id
          in: path
          description: ''
          required: true
          example: ''
          schema:
            type: string
      responses:
        '200':
          description: Link found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  paymentLink:
                    $ref: '#/components/schemas/PaymentLinkWithPayments'
                required:
                  - success
                  - paymentLink
                x-apidog-orders:
                  - success
                  - paymentLink
                x-apidog-ignore-properties: []
              example:
                success: true
                paymentLink:
                  id: 01KDKKVSH6NDQPBZ5E1F54G8Q6
                  externalReference: 1b4db7eb-4057-5ddf-91e0-36dec72071f5
                  title: Payment Title
                  description: Payment Description
                  amount: 129.9
                  currency: USD
                  status: INACTIVE
                  isMultiUse: false
                  isActive: true
                  isExpired: false
                  expiresAt: '2025-01-31T23:59:59.000Z'
                  url: >-
                    https://app.sxdigitalpay.com/quote/[merchantShortName]/[paymentLinkId]
                  shortUrl: https://sxpay.me/[paymentLinkShortId]
                  metadata: null
                  callbackUrl: https://merchant.com/checkout/success
                  webhookUrl: https://merchant.com/webhooks/sxpay
                  paymentStatus: COMPLETED
                  paymentsSummary:
                    total: 2
                    byStatus:
                      PENDING: 1
                      COMPLETED: 1
                  payments:
                    - id: 01KDKKX5W57ZJGR0RAVERADSZ4
                      status: PENDING
                      createdAt: '2024-12-05T18:25:00.000Z'
                      completedAt: null
                      availableAt: null
                      customer:
                        name: Jane Doe
                        email: jane@example.com
                      quote:
                        amount: 129.9
                        currency: USD
                        paymentMethod: CREDIT_CARD
                        installments: 1
                        totalBRL: 658.35
                    - id: 01KDKKXTCFV7KVJV14XBM9ASEG
                      status: COMPLETED
                      createdAt: '2024-12-05T18:15:00.000Z'
                      completedAt: '2024-12-05T18:18:00.000Z'
                      availableAt: '2024-12-07T12:00:00.000Z'
                      customer: null
                      quote:
                        amount: 129.9
                        currency: USD
                        paymentMethod: PIX
                        installments: 1
                        totalBRL: 658.35
                  createdAt: '2024-12-05T18:20:00.000Z'
          headers:
            X-RateLimit-Limit:
              schema:
                type: string
            X-RateLimit-Remaining:
              schema:
                type: string
            X-RateLimit-Reset:
              schema:
                type: string
          x-apidog-name: ''
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema: &ref_0
                $ref: '#/components/schemas/Error'
              examples:
                '2':
                  summary: missing
                  value:
                    error: API Key not found
                '3':
                  summary: invalid
                  value:
                    error: Invalid API Key
          headers: {}
          x-apidog-name: Unauthorized
        '403':
          description: Merchant is not active.
          content:
            application/json:
              schema: *ref_0
              example:
                error: Inactive Merchant
          headers: {}
          x-apidog-name: Forbidden
        '404':
          description: Resource not found.
          content:
            application/json:
              schema: *ref_0
              examples:
                '5':
                  summary: linkMissing
                  value:
                    error: Payment link not found
                '6':
                  summary: merchantMissing
                  value:
                    error: Merchant not found
          headers: {}
          x-apidog-name: NotFound
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema: *ref_0
              example:
                error: Too many requests. Try again in 60 seconds.
          headers:
            X-RateLimit-Limit:
              schema:
                type: string
            X-RateLimit-Remaining:
              schema:
                type: string
            X-RateLimit-Reset:
              schema:
                type: string
            Retry-After:
              schema:
                type: string
          x-apidog-name: TooManyRequests
      security:
        - ApiKeyAuth: []
          x-apidog:
            schemeGroups:
              - id: reX-0TM86gkbmZyxiLkac
                schemeIds:
                  - ApiKeyAuth
            required: true
            use:
              id: reX-0TM86gkbmZyxiLkac
            scopes:
              reX-0TM86gkbmZyxiLkac:
                ApiKeyAuth: []
      x-apidog-folder: PaymentLinks
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1147027/apis/api-25254365-run
components:
  schemas:
    PaymentLinkWithPayments:
      allOf:
        - $ref: '#/components/schemas/PaymentLinkWithWebhook'
        - type: object
          properties:
            paymentStatus: &ref_1
              $ref: '#/components/schemas/PaymentLinkPaymentStatus'
            paymentsSummary:
              $ref: '#/components/schemas/PaymentsSummary'
            payments:
              type: array
              items:
                $ref: '#/components/schemas/Payment'
          x-apidog-orders:
            - paymentStatus
            - paymentsSummary
            - payments
          x-apidog-ignore-properties: []
      required:
        - paymentStatus
        - payments
        - paymentsSummary
      x-apidog-folder: ''
    Payment:
      type: object
      properties:
        id:
          type: string
        status:
          $ref: '#/components/schemas/PaymentStatus'
        createdAt:
          type: string
          format: date-time
        completedAt:
          type: string
          format: date-time
          nullable: true
        availableAt:
          type: string
          format: date-time
          nullable: true
        customer:
          oneOf:
            - $ref: '#/components/schemas/PaymentCustomer'
            - type: 'null'
        quote:
          oneOf:
            - $ref: '#/components/schemas/PaymentQuote'
            - type: 'null'
      required:
        - id
        - status
        - createdAt
      x-apidog-orders:
        - id
        - status
        - createdAt
        - completedAt
        - availableAt
        - customer
        - quote
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    PaymentQuote:
      type: object
      properties:
        amount:
          type: number
        currency:
          type: string
        paymentMethod:
          $ref: '#/components/schemas/PaymentMethod'
        installments:
          type: integer
        totalBRL:
          type: number
          nullable: true
      x-apidog-orders:
        - amount
        - currency
        - paymentMethod
        - installments
        - totalBRL
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    PaymentMethod:
      type: string
      enum:
        - PIX
        - CREDIT_CARD
      x-apidog-folder: ''
    PaymentCustomer:
      type: object
      properties:
        name:
          type: string
        email:
          type: string
          format: email
      required:
        - name
        - email
      x-apidog-orders:
        - name
        - email
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    PaymentStatus:
      type: string
      enum:
        - PENDING
        - COMPLETED
        - DISPUTED
        - REFUNDED
      x-apidog-folder: ''
    PaymentsSummary:
      type: object
      description: Aggregated counts of payments grouped by their current status.
      properties:
        total:
          type: integer
          description: Total number of payments for the link.
        byStatus:
          type: object
          additionalProperties:
            type: integer
          description: >-
            Keys are payment status values (PENDING, COMPLETED, DISPUTED,
            REFUNDED).
          properties: {}
          x-apidog-orders: []
          x-apidog-ignore-properties: []
      required:
        - total
        - byStatus
      x-apidog-orders:
        - total
        - byStatus
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    PaymentLinkPaymentStatus:
      type: string
      description: >-
        Aggregated view of payments for the link (NOT_STARTED = no payments;
        PENDING = payments exist but none completed; COMPLETED = at least one
        completed payment, even if later disputed or refunded).
      enum:
        - NOT_STARTED
        - PENDING
        - COMPLETED
      x-apidog-folder: ''
    PaymentLinkWithWebhook:
      allOf:
        - $ref: '#/components/schemas/PaymentLinkBase'
        - type: object
          properties:
            webhookUrl:
              type: string
              format: uri
              nullable: true
            paymentStatus: *ref_1
          x-apidog-orders:
            - webhookUrl
            - paymentStatus
          x-apidog-ignore-properties: []
      x-apidog-folder: ''
    PaymentLinkBase:
      type: object
      properties:
        id:
          type: string
        externalReference:
          type: string
          nullable: true
        title:
          type: string
        description:
          type: string
          nullable: true
        amount:
          type: number
          format: double
          description: Amount in the merchant's currency.
        currency:
          type: string
          description: Merchant currency (e.g., USD, EUR, GBP).
        status:
          $ref: '#/components/schemas/PaymentLinkStatus'
        isMultiUse:
          type: boolean
          description: Always false for this API.
        isActive:
          type: boolean
          description: True only if status is ACTIVE and expiresAt has not passed.
        isExpired:
          type: boolean
        expiresAt:
          type: string
          format: date-time
          nullable: true
        url:
          type: string
          format: uri
          description: >-
            The complete URL of the quotation page to which the user should be
            directed to proceed with the payment.
        shortUrl:
          type: string
          format: uri
          description: Short URL for the `url` field.
        metadata:
          description: JSON object stored with the link.
          type: object
          additionalProperties: true
          properties: {}
          x-apidog-orders: []
          x-apidog-ignore-properties: []
          nullable: true
        callbackUrl:
          type: string
          format: uri
          description: Optional redirect URL after a successful payment.
          nullable: true
        createdAt:
          type: string
          format: date-time
      required:
        - id
        - title
        - amount
        - currency
        - status
        - isMultiUse
        - isActive
        - isExpired
        - url
        - shortUrl
      x-apidog-orders:
        - id
        - externalReference
        - title
        - description
        - amount
        - currency
        - status
        - isMultiUse
        - isActive
        - isExpired
        - expiresAt
        - url
        - shortUrl
        - metadata
        - callbackUrl
        - createdAt
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    PaymentLinkStatus:
      type: string
      enum:
        - ACTIVE
        - INACTIVE
        - EXPIRED
      x-apidog-folder: ''
    Error:
      type: object
      properties:
        error:
          type: string
      required:
        - error
      x-apidog-orders:
        - error
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes:
    ApiKeyAuth:
      type: apikey
      in: header
      name: x-api-key
      description: >-
        API key provisioned per merchant. Authorization: Bearer <api-key> is
        also accepted.
    WebhookSignature:
      type: apikey
      in: header
      name: x-sxpay-signature
      description: >
        HMAC-SHA256 signature calculated over "{timestamp}.{rawBody}" using the
        link's webhookSecret. Includes header x-sxpay-timestamp (epoch ms) for
        replay protection. These headers are only sent when a webhookSecret is
        configured for the link.
servers:
  - url: https://sandbox.sxdigitalpay.com/api/v1
    description: Sandbox
  - url: https://app.sxdigitalpay.com/api/v1
    description: Prod
security:
  - ApiKeyAuth: []
    x-apidog:
      schemeGroups:
        - id: aSabarTaLKMkoazJDLTtw
          schemeIds:
            - ApiKeyAuth
      required: true
      use:
        id: aSabarTaLKMkoazJDLTtw
      scopes:
        aSabarTaLKMkoazJDLTtw:
          ApiKeyAuth: []

```
