> ## 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 órdenes de compra

> Lista las órdenes de compra de la organización. Soporta búsqueda por proveedor o número de orden y filtros por fecha y estado.



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/purchase-orders
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/purchase-orders:
    get:
      tags:
        - API
      summary: Listar órdenes de compra
      description: >-
        Lista las órdenes de compra de la organización. Soporta búsqueda por
        proveedor o número de orden y filtros por fecha y estado.
      operationId: listApiPurchaseOrders
      parameters:
        - name: query
          in: query
          description: Texto de búsqueda por proveedor o número de orden
          required: false
          schema:
            type: string
        - 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: date_from
          in: query
          description: Fecha inicial de la orden
          required: false
          schema:
            type: string
            format: date
        - name: date_to
          in: query
          description: Fecha final de la orden
          required: false
          schema:
            type: string
            format: date
        - name: status
          in: query
          description: >-
            Estado o lista de estados separados por coma: draft, sent,
            partially_received, received, closed, cancelled
          required: false
          schema:
            $ref: '#/components/schemas/ApiSharedEnumf2073aa092'
      responses:
        '200':
          description: Órdenes de compra obtenidas exitosamente
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiPurchaseOrderListResponse'
        '400':
          description: Parámetros inválidos
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: Parámetros inválidos
                      retryable: false
                      details: []
        '401':
          description: API key faltante o inválida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: API key faltante o inválida
                      retryable: false
                      details: []
        '403':
          description: Scopes insuficientes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: Scopes insuficientes
                      retryable: false
                      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: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: Error interno del servidor
                      retryable: false
                      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 purchaseOrders = await
            lapyme.purchaseOrders.listPurchaseOrders({
              limit: 20,
              status: "draft",
            });
components:
  schemas:
    ApiSharedEnumf2073aa092:
      type: string
      enum:
        - draft
        - sent
        - partially_received
        - received
        - closed
        - cancelled
    ApiPurchaseOrderListResponse:
      type: object
      properties:
        request_id:
          type: string
        data:
          type: array
          items:
            type: object
            properties:
              object:
                type: string
                const: purchase_order
              id:
                type: string
                format: uuid
              order_number:
                type: integer
              formatted_order_number:
                anyOf:
                  - type: string
                  - type: 'null'
              status:
                $ref: '#/components/schemas/ApiSharedEnumf2073aa092'
              order_date:
                type: string
                format: date
              expected_date:
                anyOf:
                  - type: string
                    format: date
                  - type: 'null'
              currency:
                type: string
              supplier:
                anyOf:
                  - $ref: '#/components/schemas/ApiSharedObject8aeeceaf0f'
                  - type: 'null'
              warehouse:
                anyOf:
                  - $ref: '#/components/schemas/ApiSharedObject8aeeceaf0f'
                  - type: 'null'
              created_at:
                type: string
                format: date-time
              tags:
                type: array
                items:
                  $ref: '#/components/schemas/ApiSharedObject8a94344083'
            required:
              - object
              - id
              - order_number
              - formatted_order_number
              - status
              - order_date
              - expected_date
              - currency
              - supplier
              - warehouse
              - created_at
              - tags
            additionalProperties: false
      required:
        - request_id
        - data
      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
    ApiSharedObject8aeeceaf0f:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
      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
    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.

````