Skip to main content
POST
/
api
/
v2
/
purchases
Crear compra con preview/commit (v2)
curl --request POST \
  --url https://api.lapyme.com.ar/api/v2/purchases \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "mode": "preview",
  "input": {
    "voucherType": 4503599627370496,
    "currency": "PES",
    "supplierId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "importDocumentRole": "commercial_invoice",
    "importSourcePurchaseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "importNationalizationStatus": "pending_nationalization",
    "despachoNumber": "<string>",
    "supplierInvoiceNumber": "<string>",
    "invoiceDate": "2023-12-25",
    "accountDate": "2023-12-25",
    "dueDate": "2023-12-25",
    "paymentTermId": "days_7",
    "percepIVA": 4503599627370495,
    "nacionales": 4503599627370495,
    "iibb": 4503599627370495,
    "iibbBreakdown": [
      {
        "provinceId": 0,
        "amount": 4503599627370495
      }
    ],
    "municipales": 4503599627370495,
    "internos": 4503599627370495,
    "otros": 4503599627370495,
    "warehouseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "productsReceived": true,
    "updateProductVariantCost": true,
    "items": [
      {
        "quantity": 1,
        "unitCost": 4503599627370495,
        "productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "name": "<string>",
        "subtotal": 4503599627370495,
        "total": 4503599627370495,
        "taxRateId": 4503599627370495,
        "isExempt": true,
        "discountPercentage": 50,
        "purchaseOrderItemId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "rubroIva": "bienes"
      }
    ],
    "subtotal": 4503599627370495,
    "taxAmount": 4503599627370495,
    "total": 4503599627370495,
    "discount": 4503599627370495,
    "exemptAmount": 4503599627370495,
    "noGravado": 4503599627370495,
    "importe": 4503599627370495,
    "ivaBreakdown": [
      {
        "taxRateId": 4503599627370495,
        "baseAmount": 4503599627370495,
        "taxAmount": 4503599627370495
      }
    ],
    "notes": "<string>",
    "exchangeRate": 1,
    "pdfPath": "<string>",
    "rubroIva": "bienes",
    "status": "draft"
  },
  "client": {
    "requestId": "<string>",
    "agent": {
      "vendor": "<string>",
      "name": "<string>",
      "sessionId": "<string>",
      "runId": "<string>"
    }
  },
  "meta": {}
}
'
{
  "requestId": "req_purchase_preview_1",
  "success": true,
  "mode": "preview",
  "data": {
    "normalizedPurchase": {
      "supplierId": "afafcbec-9d94-4174-8d5c-ec8d72780947",
      "voucherType": 1,
      "supplierInvoiceNumber": "0001-00000001",
      "invoiceDate": "2026-03-10",
      "accountDate": null,
      "dueDate": null,
      "paymentTermId": null,
      "importDocumentRole": null,
      "importSourcePurchaseId": null,
      "importNationalizationStatus": null,
      "despachoNumber": null,
      "warehouseId": null,
      "productsReceived": false,
      "updateProductVariantCost": true,
      "currency": "PES",
      "exchangeRate": 1,
      "subtotal": 8250,
      "taxAmount": 1733,
      "total": 9983,
      "discount": 0,
      "exemptAmount": 0,
      "noGravado": null,
      "importe": null,
      "percepIVA": null,
      "nacionales": null,
      "iibb": null,
      "municipales": null,
      "internos": null,
      "otros": null,
      "notes": null,
      "pdfPath": null,
      "items": [
        {
          "productId": "9c692e8b-0f9a-4f7c-8b99-061a2eb188ae",
          "productName": "2 Almohadas Microfibra Virgen 80x50 Gani Brise",
          "sku": "2X14032060080050",
          "name": null,
          "quantity": 1,
          "unitCost": 8250,
          "subtotal": 8250,
          "total": 9983,
          "taxRateId": 5,
          "isExempt": false,
          "discountPercentage": null,
          "purchaseOrderItemId": null,
          "rubroIva": null
        }
      ]
    },
    "projectedEffects": {
      "inventory": {
        "willReceiveProducts": false,
        "willCreateReceipt": false,
        "willIncreaseDirectStock": false,
        "warehouseId": null,
        "productLineCount": 1,
        "totalQuantity": 1,
        "purchaseOrderIds": []
      },
      "accounting": {
        "willCreateJournalEntry": true,
        "currency": "PES",
        "exchangeRate": 1
      }
    }
  },
  "warnings": [],
  "blockingIssues": []
}

Authorizations

Authorization
string
header
required

Incluí tu API key en el header Authorization con el prefijo Bearer

Headers

Idempotency-Key
string

Token opaco de idempotencia. Requerido cuando mode es commit; en preview puede omitirse.

Required string length: 1 - 255
X-Request-Id
string

Request id opcional para trazabilidad. Si también se envía client.requestId, la respuesta usa ese valor.

Required string length: 1 - 255

Body

application/json
mode
enum<string>
required
Available options:
preview,
commit
input
object
required
client
object
meta
object

Response

Preview o commit exitoso

requestId
string
required
success
enum<boolean>
required
Available options:
true
mode
enum<string>
required
Available options:
preview
data
object
required
warnings
object[]
required
blockingIssues
object[]
required