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

# List invoices

> List invoices with pagination, filtering, and sorting. Results are automatically filtered by the authenticated merchant unless a different merchantId is provided. The metadata field is excluded from the response.



## OpenAPI

````yaml /api-reference/link-product-openapi.json get /invoices
openapi: 3.0.0
info:
  title: Link Product API
  description: RESTful API for managing payment links, customers, and invoices
  version: 1.0.0
servers:
  - url: https://api.sandbox.cheqpay.mx/lps
    description: Sandbox environment
  - url: https://prod.cheqpay.mx/lps
    description: Production environment
security: []
tags:
  - name: Payment Links
    description: Operations related to payment links
  - name: Invoices
    description: Invoice creation and retrieval
  - name: Products
    description: Product management operations
paths:
  /invoices:
    get:
      tags:
        - Invoices
      summary: List invoices
      description: >-
        List invoices with pagination, filtering, and sorting. Results are
        automatically filtered by the authenticated merchant unless a different
        merchantId is provided. The metadata field is excluded from the
        response.
      parameters:
        - name: page
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
          description: Page number (1-indexed)
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
          description: Number of items per page
        - name: merchantId
          in: query
          required: false
          schema:
            type: string
            pattern: ^[a-f\d]{24}$
          description: >-
            Merchant ID to filter by (defaults to authenticated merchant if not
            provided)
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - pending
              - paid
              - cancelled
              - refunded
              - failed
          description: Filter by invoice status
        - name: dateFrom
          in: query
          required: false
          schema:
            type: string
            format: date-time
          description: Filter invoices created from this date (ISO 8601 datetime)
        - name: dateTo
          in: query
          required: false
          schema:
            type: string
            format: date-time
          description: Filter invoices created until this date (ISO 8601 datetime)
        - name: sort
          in: query
          required: false
          schema:
            type: string
            enum:
              - createdAt
            default: createdAt
          description: Field to sort by
        - name: order
          in: query
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
          description: Sort order
      responses:
        '200':
          description: Invoices retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListInvoicesResponse'
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ListInvoicesResponse:
      type: object
      description: Paginated response containing invoices (metadata field excluded)
      required:
        - data
        - currentPage
        - totalPages
        - totalCount
        - limit
      properties:
        data:
          type: array
          description: Array of invoices (metadata field excluded)
          items:
            $ref: '#/components/schemas/Invoice'
        currentPage:
          type: integer
          description: Current page number
          example: 1
        totalPages:
          type: integer
          description: Total number of pages
          example: 5
        totalCount:
          type: integer
          description: Total number of invoices matching the filter
          example: 47
        limit:
          type: integer
          description: Number of items per page
          example: 10
    ValidationError:
      type: object
      description: Validation error response
      properties:
        message:
          type: string
          description: Error message
          example: Validation failed
    UnauthorizedError:
      type: object
      description: Unauthorized error response
      properties:
        message:
          type: string
          description: Error message
          example: Unauthorized
    InternalError:
      type: object
      description: Internal server error response
      properties:
        message:
          type: string
          description: Error message
          example: Internal server error
    Invoice:
      type: object
      description: Invoice details
      properties:
        _id:
          type: string
          description: Invoice ID
        customerId:
          type: string
          description: Customer ID
        merchantId:
          type: string
          pattern: ^[a-f\d]{24}$
          description: Merchant ID
        paymentOrderId:
          type: string
          description: Payment order ID
        paymentLinkId:
          type: string
          description: Payment link ID
        reference:
          type: string
          description: Merchant reference
        externalId:
          type: string
          description: Merchant reference
        orderNumber:
          type: string
          description: Order number
        invoiceNumber:
          type: string
          nullable: true
          description: >-
            Merchant-provided invoice number; shown to customers instead of
            orderNumber when present
        products:
          type: array
          items:
            $ref: '#/components/schemas/PaymentLinkProduct'
          description: Products in the invoice
        totals:
          type: object
          properties:
            total:
              type: number
              description: Total amount charged to the customer (subtotal + surcharge).
            subtotal:
              type: number
              description: Merchandise subtotal — the amount agreed before any surcharge.
            taxes:
              type: number
              description: Tax amount
            shipping:
              type: number
              description: Shipping amount
            fees:
              type: number
              description: Fees amount
            discounts:
              type: number
              description: Discount amount
            surcharge:
              type: number
              description: >-
                Surcharge applied on top of subtotal. Omitted when no surcharge
                applies.
            surchargeRate:
              type: number
              description: >-
                Snapshot of the merchant's surcharge rate (percent) at charge
                time. Omitted when no surcharge applies.
        billingAddress:
          $ref: '#/components/schemas/BillingAddress'
        shippingAddress:
          $ref: '#/components/schemas/Address'
        paymentMethod:
          $ref: '#/components/schemas/InvoicePaymentMethod'
        status:
          type: string
          enum:
            - pending
            - paid
            - cancelled
            - refunded
            - failed
            - abandoned
          description: Invoice status
        customFields:
          type: array
          items:
            $ref: '#/components/schemas/CustomFieldAnswer'
          description: >-
            Snapshot of the customer-submitted answers for the payment link's
            custom fields
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
    PaymentLinkProduct:
      type: object
      description: Product in a payment link
      required:
        - name
        - qty
        - price
        - total
      properties:
        id:
          type: string
          description: Product identifier (optional for new products)
        name:
          type: string
          description: Product name
        description:
          type: string
          description: Product description
        qty:
          type: number
          minimum: 1
          description: Product quantity
        price:
          type: number
          minimum: 0
          description: Product price
        total:
          type: number
          minimum: 0
          description: Total price for this product
        imageUrl:
          type: string
          description: Product image URL
        isQtyAdjustable:
          type: boolean
          description: Whether the quantity is adjustable by the customer
        minQty:
          type: number
          description: Minimum quantity if adjustable
        maxQty:
          type: number
          description: Maximum quantity if adjustable
    BillingAddress:
      allOf:
        - $ref: '#/components/schemas/Address'
        - type: object
          properties:
            isSameAsShipping:
              type: boolean
              description: Whether billing address is same as shipping
    Address:
      type: object
      description: Address information
      properties:
        firstName:
          type: string
          description: First name
        lastName:
          type: string
          description: Last name
        organizationName:
          type: string
          description: Organization name
        email:
          type: string
          format: email
          description: Email address
        phone:
          type: string
          description: Phone number
        addressLine1:
          type: string
          description: Street address
        addressLine2:
          type: string
          description: Additional address information (apartment, suite, unit, etc.)
        city:
          type: string
          description: City
        state:
          type: string
          description: State
        postalCode:
          type: string
          description: Postal code
        country:
          type: string
          pattern: ^[A-Z]{2}$
          description: Country code (2 letters)
    InvoicePaymentMethod:
      type: object
      description: Payment method details
      properties:
        type:
          type: string
          description: Payment method type
          enum:
            - card
            - saved
            - spei
            - cie_cash_net
        card:
          type: object
          description: Card details
          properties:
            bin:
              type: string
              description: Bank identification number
            brand:
              type: string
              description: Card brand
            country:
              type: string
              description: Card country
            expiryMonth:
              type: string
              description: Expiry month
            expiryYear:
              type: string
              description: Expiry year
            issuerBank:
              type: string
              description: Issuer bank
            last4:
              type: string
              description: Last 4 digits of card
            type:
              type: string
              description: Card type
        spei:
          type: object
          description: SPEI payment details
          properties:
            clabe:
              type: string
              description: CLABE number
        cieCashNet:
          type: object
          description: CIE Cash Net payment details
          properties:
            reference:
              type: string
              description: CIE reference number for cash payment at convenience stores
              example: CIE0000000001
            convenio:
              type: string
              description: BBVA account number for same-bank payments
              example: '0123456789'
            clabe:
              type: string
              description: Interbank account number (CLABE) for transfers from other banks
              example: '012345678901234567'
    CustomFieldAnswer:
      type: object
      description: >-
        Customer-submitted answer for a payment link custom field. `value` must
        match the field's `type`: string for
        text/number/email/phone/date/radio/select, boolean for switch, string
        array for checkbox.
      required:
        - label
        - type
      properties:
        label:
          type: string
          minLength: 1
          maxLength: 255
          description: Label of the matching custom field on the payment link
        type:
          type: string
          enum:
            - text
            - number
            - email
            - phone
            - date
            - switch
            - radio
            - checkbox
            - select
          description: Field type, must match the payment link definition
        value:
          oneOf:
            - type: string
            - type: boolean
            - type: array
              items:
                type: string
          description: Customer-submitted value
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for merchant authentication

````