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

# Listar compras

> Lista las compras de la organización. Soporta filtros por fecha, importe y búsqueda de proveedor.



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/purchases
openapi: 3.1.0
info:
  title: La Pyme API
  description: >-
    Resources and workflows for purchases, sales, inventory, contacts, products,
    reports, and settings.
  version: 1.0.0
  contact:
    name: La Pyme Support
    email: hola@lapyme.com.ar
  license:
    name: Proprietary
    url: https://lapyme.com.ar/terminos
servers:
  - url: https://api.lapyme.com.ar
    description: Servidor de producción
security:
  - bearerAuth: []
tags:
  - name: API
    description: Public API operations for La Pyme integrations.
paths:
  /api/v1/purchases:
    get:
      tags:
        - API
      summary: Listar compras
      description: >-
        Lista las compras de la organización. Soporta filtros por fecha, importe
        y búsqueda de proveedor.
      operationId: listApiPurchases
      parameters:
        - name: cursor
          in: query
          description: Valor de next_cursor recibido en la respuesta anterior
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: Cantidad máxima de resultados por respuesta
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: query
          in: query
          description: >-
            Texto de búsqueda por proveedor, CUIT o número de factura del
            proveedor
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Alias de query
          required: false
          schema:
            type: string
        - name: date_from
          in: query
          description: Fecha inicial para el filtro
          required: false
          schema:
            type: string
            format: date
        - name: date_to
          in: query
          description: Fecha final para el filtro
          required: false
          schema:
            type: string
            format: date
        - name: date_attribute
          in: query
          description: Campo de fecha a usar para el filtro
          required: false
          schema:
            $ref: '#/components/schemas/ApiSharedEnume975a7c122'
        - name: amount_attribute
          in: query
          description: Campo monetario a usar para min/max
          required: false
          schema:
            type: string
            enum:
              - balance
              - total
            default: balance
        - name: min_balance
          in: query
          description: Importe mínimo para el filtro
          required: false
          schema:
            type: integer
        - name: max_balance
          in: query
          description: Importe máximo para el filtro
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: Compras obtenidas exitosamente
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiPurchaseListResponse'
        '400':
          description: Parámetros inválidos
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_purchase_list_1
                    error:
                      code: INVALID_REQUEST
                      message: Invalid parameters for listing purchases
                      retryable: false
                      type: invalid_request_error
                      details: []
        '401':
          description: API key faltante o inválida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: AUTHENTICATION_REQUIRED
                  value:
                    request_id: req_purchase_list_1
                    error:
                      code: AUTHENTICATION_REQUIRED
                      message: API key is required in the Authorization header
                      retryable: false
                      type: invalid_request_error
                      details: []
        '403':
          description: Scopes insuficientes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: FORBIDDEN
                  value:
                    request_id: req_purchase_list_1
                    error:
                      code: FORBIDDEN
                      message: Your API key does not have permission for this operation
                      retryable: false
                      type: invalid_request_error
                      details: []
        '429':
          description: Límite de solicitudes excedido para la organización
          headers:
            Retry-After:
              description: Segundos a esperar antes de volver a intentar la solicitud.
              schema:
                type: string
                example: '30'
            X-RateLimit-Limit:
              description: Límite de la ventana activa.
              schema:
                type: string
                example: '5000'
            X-RateLimit-Remaining:
              description: Solicitudes restantes en la ventana activa.
              schema:
                type: string
                example: '0'
            X-RateLimit-Reset:
              description: Segundos restantes hasta el reset de la ventana activa.
              schema:
                type: string
                example: '30'
            RateLimit-Limit:
              description: Límite de la ventana activa en formato estándar.
              schema:
                type: string
                example: '5000'
            RateLimit-Remaining:
              description: Solicitudes restantes en la ventana activa en formato estándar.
              schema:
                type: string
                example: '0'
            RateLimit-Reset:
              description: >-
                Segundos hasta el reset de la ventana activa en formato
                estándar.
              schema:
                type: string
                example: '30'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: RATE_LIMITED
                  value:
                    request_id: req_rate_limit_1
                    error:
                      type: rate_limit_error
                      code: RATE_LIMITED
                      message: >-
                        The organization request limit was reached. Try again
                        later.
                      retryable: true
                      details: []
        '500':
          description: Error interno del servidor
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INTERNAL_ERROR
                  value:
                    request_id: req_purchase_list_1
                    error:
                      code: INTERNAL_ERROR
                      message: Could not list purchases
                      retryable: false
                      type: invalid_request_error
                      details: []
      x-codeSamples:
        - lang: typescript
          label: La Pyme SDK
          source: |
            import { Lapyme } from "lapyme";

            const lapyme = new Lapyme({
              bearerAuth: process.env["LAPYME_API_KEY"] ?? "",
            });

            const purchases = await lapyme.purchases.listPurchases({
              limit: 20,
              dateFrom: new Date("2026-03-01"),
              dateTo: new Date("2026-03-31"),
            });
components:
  schemas:
    ApiSharedEnume975a7c122:
      type: string
      enum:
        - invoiceDate
        - dueDate
      default: invoiceDate
    ApiPurchaseListResponse:
      type: object
      properties:
        request_id:
          type: string
        data:
          type: array
          items:
            type: object
            properties:
              object:
                type: string
                const: purchase
              id:
                type: string
                format: uuid
              voucher_type:
                type: string
              invoice_date:
                anyOf:
                  - type: string
                  - type: 'null'
                description: Fecha del comprobante en formato YYYY-MM-DD.
              account_date:
                anyOf:
                  - type: string
                  - type: 'null'
                description: Fecha contable de la compra en formato YYYY-MM-DD.
              due_date:
                anyOf:
                  - type: string
                  - type: 'null'
                description: Fecha de vencimiento en formato YYYY-MM-DD.
              total:
                anyOf:
                  - type: integer
                    minimum: 0
                  - type: 'null'
              balance:
                anyOf:
                  - type: integer
                  - type: 'null'
              warehouse_id:
                anyOf:
                  - type: string
                    format: uuid
                  - type: 'null'
              currency:
                type: string
              exchange_rate:
                type: string
              supplier_invoice_number:
                anyOf:
                  - type: string
                  - type: 'null'
                description: Numero de comprobante del proveedor. Hasta 120 caracteres.
              created_at:
                type: string
                format: date-time
              supplier:
                anyOf:
                  - $ref: '#/components/schemas/ApiSharedObjectf28d5cf256'
                  - type: 'null'
              tags:
                type: array
                items:
                  $ref: '#/components/schemas/ApiSharedObject8a94344083'
            required:
              - object
              - id
              - voucher_type
              - invoice_date
              - account_date
              - due_date
              - total
              - balance
              - warehouse_id
              - currency
              - exchange_rate
              - supplier_invoice_number
              - created_at
              - supplier
              - tags
            additionalProperties: false
        has_more:
          type: boolean
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
        object:
          $ref: '#/components/schemas/ApiSharedEnum8d46e1ec20'
        url:
          type: string
          description: Requested list path.
      required:
        - request_id
        - data
        - has_more
        - next_cursor
        - object
        - url
      additionalProperties: false
    ApiErrorEnvelope:
      type: object
      properties:
        request_id:
          type: string
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - api_error
                - authentication_error
                - authorization_error
                - business_error
                - external_dependency_error
                - idempotency_error
                - invalid_request_error
                - rate_limit_error
            code:
              type: string
            message:
              type: string
            retryable:
              type: boolean
            details:
              type: array
              items:
                $ref: '#/components/schemas/ApiSharedObjectc671832641'
          required:
            - type
            - code
            - message
            - retryable
            - details
          additionalProperties: false
      required:
        - request_id
        - error
      additionalProperties: false
    ApiSharedObjectf28d5cf256:
      type: object
      properties:
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
        name:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - id
        - name
      additionalProperties: false
    ApiSharedObject8a94344083:
      type: object
      properties:
        object:
          type: string
          const: tag
        id:
          type: string
          format: uuid
        scope:
          $ref: '#/components/schemas/ApiSharedEnum09f8155a9a'
        name:
          type: string
        slug:
          type: string
        color:
          anyOf:
            - $ref: '#/components/schemas/ApiSharedEnum599647cb76'
            - type: 'null'
        description:
          anyOf:
            - type: string
            - type: 'null'
        archived_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - object
        - id
        - scope
        - name
        - slug
        - color
        - description
        - archived_at
        - created_at
        - updated_at
      additionalProperties: false
    ApiSharedEnum8d46e1ec20:
      type: string
      enum:
        - list
      description: List-envelope discriminator.
    ApiSharedObjectc671832641:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        field:
          type: string
      required:
        - code
        - message
      additionalProperties: false
    ApiSharedEnum09f8155a9a:
      type: string
      enum:
        - customer
        - supplier
        - product
        - sale
        - purchase
        - purchase_order
        - transfer
    ApiSharedEnum599647cb76:
      type: string
      enum:
        - slate
        - red
        - orange
        - amber
        - yellow
        - lime
        - green
        - teal
        - cyan
        - blue
        - indigo
        - violet
        - pink
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Incluí tu API key en el header Authorization con el prefijo Bearer.

````