API

Registra una compra y devuelve la operación creada junto con sus efectos de stock y contabilidad.

post/api/v1/purchases

Request

  • Base URL
    https://api.lapyme.com.ar
  • URL
    https://api.lapyme.com.ar/api/v1/purchases
  • Auth
    HTTP bearer

Headers

Idempotency-Keystring required

Clave única para evitar duplicados al reintentar la misma creación de compra.

X-Request-Idstring

ID opcional de la solicitud para trazabilidad. Si se omite, el servidor genera uno.

Request body

supplier_idstring uuid
voucher_typeinteger required
import_document_role'commercial_invoice' | 'customs_dispatch' | 'customs_dispatch_reversal'
import_source_purchase_idstring uuid

ID de la factura comercial asociada al despacho aduanero.

import_nationalization_status'pending_nationalization' | 'partially_nationalized' | 'fully_nationalized'
cost_target_purchase_idstring uuid nullable

Compra recibida a cuyo costo promedio suma este comprobante sin productos. null lo quita.

customs_dispatch_numberstring

Numero de despacho aduanero informado por el proveedor. Hasta 32 caracteres.

supplier_invoice_numberstring

Numero de comprobante del proveedor. Hasta 120 caracteres.

invoice_datestring date

Fecha del comprobante en formato YYYY-MM-DD.

account_datestring date

Fecha contable de la compra en formato YYYY-MM-DD.

due_datestring date

Fecha de vencimiento en formato YYYY-MM-DD.

payment_term_id'days_7' | 'days_15' | 'days_30' | 'days_45' | 'days_60' | 'days_90' | 'days_30_60' | 'days_30_60_90'
payment_term_daysinteger nullable

Cantidad de días hasta el vencimiento. Usá 0 para Contado. Se prefiere sobre paymentTermId.

vat_perception_amountinteger
national_tax_amountinteger
gross_income_tax_amountinteger
municipal_tax_amountinteger
internal_tax_amountinteger
other_tax_amountinteger
warehouse_idstring uuid nullable
products_receivedboolean
products_returnedboolean

If true, a supplier credit note returns product quantities from the selected warehouse. Requires warehouseId. Invalid on non-credit purchases.

update_product_variant_costboolean
subtotalinteger
tax_amountinteger
totalinteger
discountinteger
exempt_amountinteger
non_taxed_amountinteger
base_amountinteger
notesstring
currency'ARS' | 'USD' required
exchange_ratenumber
pdf_pathstring
vat_category'goods' | 'fixed_assets' | 'leases' | 'services'
status'draft' | 'confirmed'

Response

Compra creada exitosamente

request_idstring required

Changes

    • breaking

      for the header request parameter Idempotency-Key, the minLength was increased from 0 to 1

    • breaking

      for the header request parameter X-Request-Id, the minLength was increased from 0 to 1

    • breaking

      removed the enum value DOL of the request property

    • breaking

      removed the enum value PES of the request property

    • breaking

      the request property's minLength was increased from 0 to 1

    • breaking

      the // request property's minLength was increased from 0 to 1

    • breaking

      the request property's minLength was increased from 0 to 1

    • breaking

      the request property's minLength was increased from 0 to 1

    • warning

      for the header request parameter Idempotency-Key, the maxLength was set to 255

    • warning

      for the header request parameter X-Request-Id, the maxLength was set to 255

    • warning

      the request property's maxLength was set to 32

    • warning

      the // request property's maxLength was set to 255

    • warning

      the request property's maxLength was set to 1000

    • warning

      the request property's maxLength was set to 2000

    • warning

      the request property's maxLength was set to 120

    • info

      added the new optional request property

    • info

      added the new optional request property //

    • info

      added the new optional request property //

    • info

      added the new optional request property

    • info

      added the new ARS enum value to the request property

    • info

      added the new USD enum value to the request property

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      removed the non-success response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status