Saltar al contenido
Facturador

Crear pedido

POST /api/order-notes

Autenticación: Bearer del usuario del tenant (Authorization: Bearer <api_token>).

Registra un pedido, descuenta el stock de sus ítems y genera su PDF.

Quién puede usarlo: cualquier usuario autenticado (administrador o vendedor).

Campo Tipo Obligatorio Descripción / valores permitidos
customer_id integer Sí customer_id es el id de un cliente ya registrado (persona de tipo cliente).
establishment_id integer Sí al crear Establecimiento del pedido.
seller_id integer No Vendedor asignado. Si el usuario autenticado es vendedor, siempre se usa él mismo.
date_of_issue date Sí YYYY-MM-DD.
time_of_issue string No HH:MM:SS.
date_of_due date No Vencimiento.
delivery_date date No Fecha de entrega.
currency_type_id string Sí PEN o USD.
exchange_rate_sale numeric Sí Tipo de cambio, mínimo 0.01 (usa 1 en soles).
payment_method_type_id string No Forma de pago prevista.
total_* / subtotal / total numeric Sí Totales de cabecera: total_taxed (gravado), total_exonerated, total_unaffected, total_free, total_igv, total_taxes, total_value (sin IGV), subtotal y total (con IGV). Deben cuadrar con la suma de las líneas: la plataforma no recalcula los totales que envías.
items array Sí Líneas (mín. 1) con warehouse_id del que se reserva el stock. Al editar, incluye id en las líneas que se conservan.
shipping_address string No Dirección de entrega.
observation string No Observación.
additional_data array No Datos adicionales [{title, description}] (ambos obligatorios en cada elemento).
custom_fields_data array No Campos personalizados.

Además: prefix (usa PD).

Línea (items[]):

Campo Tipo Obligatorio Descripción / valores permitidos
item_id integer Sí Id del producto.
item object Sí Copia del producto tal como se guardará en el documento (al menos id, description, unit_type_id, internal_id, is_set, presentation). Se obtiene de los endpoints de productos de la API.
quantity numeric Sí Cantidad (> 0).
unit_value numeric Sí Valor unitario sin IGV.
unit_price numeric Sí Precio unitario con IGV.
affectation_igv_type_id string Sí Afectación IGV (catálogo SUNAT 07): 10 gravado, 20 exonerado, 30 inafecto.
price_type_id string Sí 01 precio unitario (incluye IGV), 02 valor referencial (gratuito).
percentage_igv numeric Sí Porcentaje de IGV (18, o 10 si aplica la Ley 31556).
total_base_igv / total_igv / total_taxes / total_value / total numeric Sí Totales de la línea: base imponible, IGV, impuestos, valor (sin IGV) y total (con IGV).
warehouse_id integer No Almacén del que sale el stock (por defecto el del establecimiento).
total_discount / total_charge / charges / discounts / attributes varios No Descuentos, cargos y atributos de la línea (usa 0 y [] si no aplica).
system_isc_type_id / total_base_isc / percentage_isc / total_isc / total_plastic_bag_taxes varios No ISC e ICBPER (usa null/0 si no aplica).

Errores: 422 si falta customer_id, exchange_rate_sale (mín. 0.01), currency_type_id o date_of_issue.

Respuesta: data con id, external_id, number_full, filename, print_ticket.

Cuerpo

Content-Type: application/json

{
  "prefix": "PD",
  "customer_id": 1,
  "establishment_id": 1,
  "seller_id": 5,
  "date_of_issue": "2026-11-07",
  "time_of_issue": "16:00:00",
  "date_of_due": "2026-11-07",
  "delivery_date": "2026-11-10",
  "currency_type_id": "PEN",
  "exchange_rate_sale": 1,
  "payment_method_type_id": "01",
  "total_prepayment": 0,
  "total_charge": 0,
  "total_discount": 0,
  "total_exportation": 0,
  "total_free": 0,
  "total_taxed": 30.0,
  "total_unaffected": 0,
  "total_exonerated": 0,
  "total_igv": 5.4,
  "total_igv_free": 0,
  "total_base_isc": 0,
  "total_isc": 0,
  "total_base_other_taxes": 0,
  "total_other_taxes": 0,
  "total_taxes": 5.4,
  "total_value": 30.0,
  "subtotal": 35.4,
  "total": 35.4,
  "items": [
    {
      "item_id": 120,
      "item": {
        "id": 120,
        "item_id": 120,
        "internal_id": "P0001",
        "description": "GASEOSA 500ML",
        "unit_type_id": "NIU",
        "currency_type_id": "PEN",
        "sale_unit_price": 3.5,
        "purchase_unit_price": 2.2,
        "sale_affectation_igv_type_id": "10",
        "purchase_affectation_igv_type_id": "10",
        "is_set": false,
        "has_igv": true,
        "presentation": null
      },
      "currency_type_id": "PEN",
      "quantity": 3,
      "unit_value": 10.0,
      "affectation_igv_type_id": "10",
      "total_base_igv": 30.0,
      "percentage_igv": 18,
      "total_igv": 5.4,
      "system_isc_type_id": null,
      "total_base_isc": 0,
      "percentage_isc": 0,
      "total_isc": 0,
      "total_base_other_taxes": 0,
      "percentage_other_taxes": 0,
      "total_other_taxes": 0,
      "total_plastic_bag_taxes": 0,
      "total_taxes": 5.4,
      "price_type_id": "01",
      "unit_price": 11.8,
      "total_value": 30.0,
      "total_discount": 0,
      "total_charge": 0,
      "total": 35.4,
      "attributes": [],
      "charges": [],
      "discounts": [],
      "warehouse_id": 1
    }
  ],
  "shipping_address": "AV. LOS PINOS 789, SURCO",
  "observation": "Entregar por la tarde",
  "additional_data": [
    {
      "title": "Referencia",
      "description": "Frente al parque"
    }
  ],
  "charges": [],
  "discounts": [],
  "prepayments": [],
  "guides": [],
  "related": [],
  "legends": []
}

Respuestas

200 — Creado

{
  "success": true,
  "data": {
    "id": 58,
    "external_id": "f6a7b8c9-d0e1-4f2a-b3c4-d5e6f7a8b9c0",
    "number_full": "PD-58",
    "filename": "PD-58-20261107",
    "print_ticket": "https://empresa.dominio/order-notes/print/f6a7b8c9-d0e1-4f2a-b3c4-d5e6f7a8b9c0/ticket"
  }
}

422 — Validación

{
  "success": false,
  "message": {
    "exchange_rate_sale": [
      "El campo exchange rate sale es obligatorio."
    ]
  }
}

Pruébalo

Prueba este endpoint con tu empresa y tu token: elige la URL en Servers, pega el token en Authorize y haz clic en Try it out.