Facturas de compra
Actualiza una factura de compra
post/purchases/invoices/{id}
Request
- Base URL: https://api.datil.com (the document declares no server; this is the origin it was published from)
- URL: https://api.datil.com/purchases/invoices/{id}
- Auth: none declared
Path parameters
idstring required
Identificador único del documento, generado por Dátil.
Request body
Example request
{
"issue_date": "1791394186",
"due_date": "1791394186",
"series": "F001",
"sequence": "1",
"currency": "PEN",
"operation_type": "01",
"vendor_legal_name": "Jose Mario",
"vendor_commercial_name": "Jose Mario",
"vendor_tax_id": "20601595665",
"vendor_tax_id_type": "pe-ruc",
"vendor_email": "prueba@prueba.com",
"vendor_address": {
"line_1": "Calle A",
"locality": "Lima",
"administrative_district_level_1": "Miraflores",
"administrative_district_level_2": "Lima",
"city": "Lima",
"province": "Lima",
"tax_code": "0000",
"country": "PE"
},
"vendor_telephone": "1234567890",
"vendor_code": "1234",
"waybill_number": "1234",
"waybill_code": "1234",
"sales_order_number": "1234",
"purchase_order_number": "1234",
"line_items": [
{
"sku": "A001",
"item_classification_code": "1234",
"tariff_heading": "1234",
"description": "Servicio ABC",
"price_type_code": "01",
"unit_of_measurement": "KG",
"unit_code": "1",
"tax_included_unit_price": "118.00",
"unit_price": "100.00",
"quantity": "1",
"discount": "0.00",
"subtotal_without_discount": "100.00",
"subtotal": "100.00",
"tax": "18.00",
"total": "118.00",
"tax_lines": [
{
"tax_rate": "pe-igv",
"amount": "18.00",
"taxable_amount": "100.00",
"exemption_reason_code": "10"
}
],
"custom_fields": [
{
"name": "Cedula del Pasajero",
"value": "1234556",
"code": "3001"
}
]
}
],
"tax_lines": [
{
"tax_rate": "pe-igv",
"amount": "18.00",
"taxable_amount": "100.00",
"exemption_reason_code": "10"
}
],
"subtotal": "100.00",
"tax": "18.00",
"total": "118.00",
"note": "Gracias por tu compra.",
"payment_terms": [
{
"code": "Contado",
"currency": "PEN",
"amount": "100.00",
"due_date": "2021-08-01",
"description": "Pago a 90 días."
}
],
"detraction": {
"bank_account": "123",
"code": "001",
"rate": "9.00",
"amount": "1000.00"
},
"export": {
"incoterm": "EXW",
"freight_charge": "100.00",
"insurance_charge": "100.00",
"other_charges": "100.00",
"shipping_method": "Marítimo",
"port_of_loading": "Callao - Perú",
"port_of_destination": "Barranquilla - Colombia",
"country_of_origin": "Perú",
"gross_weight": "0.0",
"net_weight": "0.0",
"gross_weight_unit": "Kg",
"total_discount": "100.00"
},
"custom_fields": [
{
"name": "Cedula del Pasajero",
"value": "1234556",
"code": "3001"
}
],
"tax_clearance": {
"void_requests": [
{
"id": "81wxc0qk5cgz4a7z3550a3art3",
"type": "pe/void-request",
"series": "RA-20210315",
"sequence": 1,
"number": "RA-20210315-3",
"tax_clearance": {
"status": "cleared",
"status_description": "ACEPTADO",
"status_code": "0",
"ticket": "1234567890",
"date": "1791394186",
"message": "El documento ha sido aceptado.",
"ack_xml": "<xml></xml>",
"qr_data": "20602224886|6|F002|F002-29|1800.00|11800.00|02/10/2020|6|20877294591|",
"xml": "https://api.datil.com/documents/1234/xml",
"pdf": "https://api.datil.com/p/1234",
"warnings": [
{
"status_code": "0000",
"message": "Documento de pruebas"
}
]
}
}
],
"status": "cleared",
"status_description": "ACEPTADO",
"status_code": "0",
"ticket": "1234567890",
"date": "1791394186",
"message": "El documento ha sido aceptado.",
"ack_xml": "<xml></xml>",
"qr_data": "20602224886|6|F002|F002-29|1800.00|11800.00|02/10/2020|6|20877294591|",
"xml": "https://api.datil.com/documents/1234/xml",
"pdf": "https://api.datil.com/p/1234",
"warnings": [
{
"status_code": "0000",
"message": "Documento de pruebas"
}
]
},
"notes": [
{
"text": "Documento tributario",
"code": "2008"
}
],
"auto_advance": true
}Response
OK
Example response
{
"id": "81wxc0qk5cgz4a7z3550a3art3",
"issue_date": "2026-10-07T17:29:46Z",
"number": "F001-1",
"currency": {
"code": "PEN",
"name": "Soles Peruanos",
"symbol": "S/."
},
"country": {
"code": "PE",
"name": "Perú"
},
"type": "pe/sales-invoice",
"operation_type": "01",
"tax_clearance": {
"void_requests": [
{
"id": "81wxc0qk5cgz4a7z3550a3art3",
"type": "pe/void-request",
"series": "RA-20210315",
"sequence": 1,
"number": "RA-20210315-3",
"tax_clearance": {
"status": "cleared",
"status_description": "ACEPTADO",
"status_code": "0",
"ticket": "1234567890",
"date": "1791394186",
"message": "El documento ha sido aceptado.",
"ack_xml": "<xml></xml>",
"qr_data": "20602224886|6|F002|F002-29|1800.00|11800.00|02/10/2020|6|20877294591|",
"xml": "https://api.datil.com/documents/1234/xml",
"pdf": "https://api.datil.com/p/1234",
"warnings": [
{
"status_code": "0000",
"message": "Documento de pruebas"
}
]
}
}
],
"status": "cleared",
"status_description": "ACEPTADO",
"status_code": "0",
"ticket": "1234567890",
"date": "1791394186",
"message": "El documento ha sido aceptado.",
"ack_xml": "<xml></xml>",
"qr_data": "20602224886|6|F002|F002-29|1800.00|11800.00|02/10/2020|6|20877294591|",
"xml": "https://api.datil.com/documents/1234/xml",
"pdf": "https://api.datil.com/p/1234",
"warnings": [
{
"status_code": "0000",
"message": "Documento de pruebas"
}
]
},
"due_date": "2026-10-07T17:29:46Z",
"series": "F001",
"sequence": 1,
"customer_legal_name": "Jose Mario",
"customer_commercial_name": "Jose Mario",
"customer_tax_id": "20601595665",
"customer_tax_id_type": {
"type": "pe-ruc",
"code": "6",
"name": "RUC"
},
"customer_email": "prueba@prueba.com",
"customer_telephone": "1234567890",
"customer_address": {
"line_1": "Calle A",
"locality": "Lima",
"administrative_district_level_1": "Miraflores",
"administrative_district_level_2": "Lima",
"city": "Lima",
"province": "Lima",
"tax_code": "0000",
"country": {
"code": "PE",
"name": "Perú"
}
},
"customer_code": "1234",
"waybill_number": "1234",
"waybill_code": "1234",
"sales_order_number": "1234",
"purchase_order_number": "1234",
"vendor_legal_name": "Jose Mario",
"vendor_commercial_name": "Jose Mario",
"vendor_tax_id": "20601595665",
"vendor_tax_id_type": {
"type": "pe-ruc",
"code": "6",
"name": "RUC"
},
"vendor_address": {
"line_1": "Calle A",
"locality": "Lima",
"administrative_district_level_1": "Miraflores",
"administrative_district_level_2": "Lima",
"city": "Lima",
"province": "Lima",
"tax_code": "0000",
"country": {
"code": "PE",
"name": "Perú"
}
},
"line_items": [
{
"tax": 18,
"tax_included_unit_price": 118,
"unit_price": 100,
"quantity": 1,
"subtotal": 100,
"subtotal_without_discount": 100,
"tax_lines": [
{
"exemption_reason_code": "10",
"taxable_amount": 18,
"amount": 18,
"tax_rate": {
"type": "pe-igv",
"name": "IGV",
"category-code": "VAT",
"code": "1000",
"percentage": 18
}
}
],
"sku": "A001",
"item_classification_code": "1234",
"tariff_heading": "1234",
"description": "Servicio ABC",
"price_type_code": "01",
"unit_of_measurement": "KG",
"unit_code": "1",
"custom_fields": [
{
"name": "Cedula del Pasajero",
"value": "1234556",
"code": "3001"
}
]
}
],
"tax_lines": [
{
"exemption_reason_code": "10",
"taxable_amount": 18,
"amount": 18,
"tax_rate": {
"type": "pe-igv",
"name": "IGV",
"category-code": "VAT",
"code": "1000",
"percentage": 18
}
}
],
"subtotal": 100,
"tax": 18,
"total": 118,
"total_in_words": "Ciento dieciocho soles.",
"note": "Gracias por tu compra.",
"payment_terms": [
{
"code": "Contado",
"currency": {
"code": "PEN",
"name": "Soles Peruanos",
"symbol": "S/."
},
"amount": 100,
"due_date": "1791394186",
"description": "Pago a 90 días."
}
],
"credit_notes": [
{
"total": 10,
"id": "123456",
"number": "NC001-1",
"issue_date": "1791394186",
"tax_clearance_status": "cleared"
}
],
"void_requests": [
{
"id": "81wxc0qk5cgz4a7z3550a3art3",
"issue_date": "2022-01-01T00:00:00Z",
"series": "F001",
"number": "F001-1",
"currency": {
"code": "PEN",
"name": "Soles Peruanos",
"symbol": "S/."
},
"country": {
"code": "PE",
"name": "Perú"
},
"type": "pe/sales-invoice",
"recipient_legal_name": "Jose Mario",
"recipient_tax_id": "20601595665",
"recipient_tax_id_type": {
"type": "pe-ruc",
"code": "6",
"name": "RUC"
},
"recipient_email": "prueba@prueba.com",
"recipient_address": {
"line_1": "Calle A",
"locality": "Lima",
"administrative_district_level_1": "Miraflores",
"administrative_district_level_2": "Lima",
"city": "Lima",
"province": "Lima",
"tax_code": "0000",
"country": {
"code": "PE",
"name": "Perú"
}
},
"vendor_legal_name": "Jose Mario",
"vendor_commercial_name": "Jose Mario",
"vendor_tax_id": "20601595665",
"vendor_tax_id_type": {
"type": "pe-ruc",
"code": "6",
"name": "RUC"
},
"vendor_address": {
"line_1": "Calle A",
"locality": "Lima",
"administrative_district_level_1": "Miraflores",
"administrative_district_level_2": "Lima",
"city": "Lima",
"province": "Lima",
"tax_code": "0000",
"country": {
"code": "PE",
"name": "Perú"
}
},
"tax_clearance": {
"void_requests": [
{
"id": "81wxc0qk5cgz4a7z3550a3art3",
"type": "pe/void-request",
"series": "RA-20210315",
"sequence": 1,
"number": "RA-20210315-3",
"tax_clearance": {
"status": "cleared",
"status_description": "ACEPTADO",
"status_code": "0",
"ticket": "1234567890",
"date": "1791394186",
"message": "El documento ha sido aceptado.",
"ack_xml": "<xml></xml>",
"qr_data": "20602224886|6|F002|F002-29|1800.00|11800.00|02/10/2020|6|20877294591|",
"xml": "https://api.datil.com/documents/1234/xml",
"pdf": "https://api.datil.com/p/1234",
"warnings": [
{
"status_code": "0000",
"message": "Documento de pruebas"
}
]
}
}
],
"status": "cleared",
"status_description": "ACEPTADO",
"status_code": "0",
"ticket": "1234567890",
"date": "1791394186",
"message": "El documento ha sido aceptado.",
"ack_xml": "<xml></xml>",
"qr_data": "20602224886|6|F002|F002-29|1800.00|11800.00|02/10/2020|6|20877294591|",
"xml": "https://api.datil.com/documents/1234/xml",
"pdf": "https://api.datil.com/p/1234",
"warnings": [
{
"status_code": "0000",
"message": "Documento de pruebas"
}
]
},
"void_reason": "Error al emitir el documento."
}
],
"detraction": {
"bank_account": "123",
"code": "001",
"rate": 9,
"amount": 1000
},
"export": {
"freight_charge": 100,
"insurance_charge": 100,
"other_charges": 100,
"shipping_method": "Marítimo",
"port_of_loading": "Callao - Perú",
"port_of_destination": "Barranquilla - Colombia",
"country_of_origin": "Perú",
"gross_weight_unit": "Kg"
},
"custom_fields": [
{
"name": "Cedula del Pasajero",
"value": "1234556",
"code": "3001"
}
],
"notes": [
{
"text": "Documento tributario",
"code": "2008"
}
]
}Changes
No recorded changes to this operation across all 1 revision of this API.