ES | EN

📄 MIPYME Documents

Create a new document

POST
URL del endpoint https://api-billing.koywe.com/V1/documents
Requiere autenticación

Autenticación

Envía la cabecera Authorization: Bearer <token> (obtenido en POST /auth) en los endpoints protegidos.

Parámetros

NombreUbicaciónTipoRequeridoDescripción
generate_stampqueryintegerGenerate the stamp image file (where applicable)

Cuerpo de la solicitud — campos

CampoTipoObligatoriedadDescripción
optionsobjectOpcional
options.draft_onlyintegerOpcionalAllows generating the document in draft mode only, without sending it to the SII.
The document remains stored as not issued, useful for testing, validation, or internal review before final issuance.
VALID ONLY FOR CHILE
options.draft_previewintegerOpcionalGenerates a preview of the document (base64) in draft mode without saving or sending it to the SII.
Allows reviewing the content, data, and layout of the document before final generation or issuance.
VALID ONLY FOR CHILE
options.send_emailenum(0, 1)OpcionalAutomatically email the generated document to receiver_email. 1 = send (default), 0 = do not send. VALID ONLY FOR COLOMBIA.
options.template_idintegerOpcionalIt corresponds to the ID of the print template for the document. If not provided, the default template will be used.
options.gross_valuesintegerOpcionalThis field is only valid for electronic receipts (document_type_id = 39, Chile) and allows the values to be entered as gross amounts (including VAT) for the line items, with the total being directly calculated as the multiplication of the item prices by the quantities. The total calculated in this way will be slightly different from the one obtained by rounding the net amounts and calculating VAT on the net total. The amounts will be adjusted and saved as net values in Koywe, but respecting the rounding applied to the gross amounts.
options.rounding_typestringOpcionalYou can input values as "net" or "gross".
Rounding on gross values will calculate the total value for each line including VAT, and then adjust the document's VAT totals to match the final amount.
Rounding on net values will calculate the multiplications of net values line by line, and then apply the VAT to the total net amount to get the VAT and the total.
options.company_webstringOpcionalYou can enter a website URL, which will replace the one registered in the Koywe account data and will be reflected in the automatic email sent to the recipient. It must start with http:// or https://.
options.company_emailstringOpcionalYou can enter an email, which will replace the one registered in the Koywe account data and will be reflected in the automatic email sent to the document recipient.
options.pdf_transfer_copyintegerOpcionalWhen set to 1, the response will include in electronic_document the field document_transfer_copy_pdf with the transfer copy (copia cedible) PDF in base64. VALID ONLY FOR CHILE.
headerobjectOpcional
header.account_idintegerOpcionalId of the associated account
header.document_type_idintegerSiempre obligatorioDocument type ID according to document type table.
Chile :
2 = Factura electrónica
32 = Factura exenta electrónica
37 = Boleta electrónica
41 = Boleta exenta electrónica
54 = Guía de despacho electrónica
17 = Nota de débito electrónica
16 = Nota de crédito electrónica
46 = Factura exportación electrónica
47 = Nota de débito de exportación electrónica
48 = Nota de crédito de exportación electrónica
header.document_sequence_codestringOpcionalIdentifies the document series, used to determine the document type and the branch or issuing point according to each country’s regulations. (ONLY Peru, Argentina and Colombia)
header.issue_datestring (date)Siempre obligatorioDocument issue date
Format: YYYY-MM-DD
header.document_numberintegerOpcionalAllows defining the folio to be used for issuing the document. By default, this field should NOT be used, so the folio is automatically assigned by the sequence.
header.issuer_tax_id_codestringOpcionalIssuer tax id code
header.issuer_tax_id_typestringOpcionalIssuer tax id type
header.issuer_legal_namestringOpcionalIssuer legal name
header.issuer_addressstringSiempre obligatorioIssuer address
header.issuer_districtstringSiempre obligatorioIssuer district name
header.issuer_citystringSiempre obligatorioIssuer city name
header.issuer_country_idstringOpcionalIssuer country id
header.issuer_phonestringSiempre obligatorioIssuer phone number
header.issuer_activitystringSiempre obligatorioIssuer economic activity
header.issuer_postalcodestringOpcionalIssuer postal code
header.receiver_tax_id_codestringObligatorio cuando: invoices, credit notes, debit notes, named receipts, and exempt named receipts, and optional for other documentsRequired for invoices, credit notes, debit notes, named receipts, and exempt named receipts, and optional for other documents.
RUT without dots, with a hyphen
Format: NNNNNNNN-X
header.receiver_tax_id_typestringOpcionalReceiver tax id type
header.receiver_legal_namestringObligatorio cuando: invoices, credit notes, debit notes, named receipts, and exempt named receiptsRequired for invoices, credit notes, debit notes, named receipts, and exempt named receipts. Optional for other documents.
Legal name of the document receiver.
header.receiver_addressstringSiempre obligatorioRequired for invoices, credit notes, debit notes, named receipts, and exempt named receipts. Optional for other documents.
Address of the document receiver.
header.receiver_districtstringSiempre obligatorioRequired for invoices, credit notes, debit notes, named receipts, and exempt named receipts. Optional for other documents.
District of the document receiver.
header.receiver_citystringSiempre obligatorioRequired for invoices, credit notes, debit notes, named receipts, and exempt named receipts. Optional for other documents.
City of the document receiver.
header.receiver_phonestringSiempre obligatorioRequired for invoices, credit notes, debit notes, named receipts, and exempt named receipts. Optional for other documents.
Phone of the document receiver.
header.receiver_activitystringSiempre obligatorioRequired for invoices, credit notes, and debit notes.
Optional for other documents.
Receiver activity of the document receiver.
Named receipts should NOT include this field.
header.receiver_postalcodestringOpcionalOptional postal code according to the national format.
header.receiver_state_idintegerOpcionalRefers to the recipient's state. Empty if it doesn't apply. This is a required field on some countries, check the examples for your country
header.receiver_county_idstringOpcionalRequired only for Colombia as it replaces receiver_city and receiver_district. Please check the county_id codes table in Colombia examples.
header.receiver_country_idintegerOpcionalRefers to the recipient's country. If not provided, the default is the same country as the issuer. It is mainly used for export documents.
header.receiver_emailstringOpcionalEmail for document sending.
header.payment_conditionsstringSiempre obligatorioPayment dates separated by commas
0 = cash
30 = 30 days
0,30 = 50% cash, 50% in 30 days
0,30,60 = 33% cash, 33% in 30 days, 34% in 60 days.
header.seller_idintegerOpcionalUser ID (Koywe) that will be assigned as the seller associated with the document.
header.currency_idintegerOpcionalOnly for export documents.
Valid values according to the table in annexes.
header.exchange_rate_valueintegerOpcionalOnly when currency_id is defined and its value is a foreign currency.
header.service_indicatorintegerOpcionalIt is optional to complete for export documents.
Valid values:
1 = Invoice for periodic household services.
2 = Invoice for other periodic services.
3 = Service Invoice
4 = Hospitality Services
5 = International Land Transport Service
header.sale_modalityintegerOpcionalOnly for export documents: optional.
Valid values:
1 = Sale agreed
2 = Under condition
3 = Free consignment
4 = Consignment with minimum sale
9 = No payment
header.sale_clauseintegerOpcionalOnly for export documents: optional.
Valid values:
1 = CIF
2 = CFR
3 = EXW
4 = FAS
5 = FOB
6 = S/CL
9 = DDP
10 = FCA
11 = CPT
12 = CIP
17 = DAT
18 = DAP
8 = Other
header.guide_typeintegerOpcionalRequired ONLY for dispatch guides.
1 = Operation constitutes sale
2 = Sales to be made
3 = Consignments
4 = Free delivery
5 = Internal transfers
6 = Other non-sale transfers
7 = Return guide
8 = Transfer for export (non-sale)
9 = Sale for export
header.transfer_typeintegerOpcionalRequired ONLY for dispatch guides that are not internal transfers.
1 = Dispatch on behalf of the recipient
2 = Dispatch on behalf of the issuer to recipient's facilities
3 = Dispatch on behalf of the issuer to other facilities
header.branch_office_codestringOpcionalThis field should only be completed for companies that use branches.
To issue from the head office, this field should NOT be entered.
The code entered must correspond to the 'internal code' entered in Koywe.
header.observationsstringOpcionalEnter a observations. The observations field allows you to include additional information. Its use is optional and can serve different purposes, providing flexibility to customize the document with complementary data that facilitate communication between issuer and recipient.
header.deployment_observationsintegerOpcional0 = do not include remark in XML or PDF
1 = include remark in XML and PDF
2 = include remark in PDF and do NOT include in XML
3 = include remark in XML and do NOT include in PDF
In all cases, regardless of its display, the remark will be saved in Koywe and will be visible in the document details on facto.cl.
If this option is not entered, the default value is considered to be 1, which will display the remark in the XML and PDF.
header.port_disembarkationstringOpcionalEnter a port disembarkation.
header.port_embarkationstringOpcionalEnter a port embarkation.
header.gross_weightstringOpcionalEnter a gross weight.
header.shipping_addressstringOpcionalEnter a shipping address.
header.additionalobjectOpcional
header.additional.mx_headerobjectOpcional
header.additional.mx_header.receiver_cfdi_usagestringOpcionalTax usage according to Mexican CFDI usage codes. You can find all receiver_cfdi_usage codes on Mexico code table page.
header.additional.mx_shippingobjectOpcional
header.additional.mx_shipping.distancestringOpcional
header.additional.mx_shipping.transport_codestringOpcional
header.additional.mx_shipping.transport_method_namestringOpcional
header.additional.mx_shipping.transport_tax_id_typestringOpcional
header.additional.mx_shipping.transport_tax_id_codestringOpcional
header.additional.mx_shipping.transport_licensestringOpcional
header.additional.mx_shipping.originobjectOpcional
header.additional.mx_shipping.origin.tax_id_typestringOpcional
header.additional.mx_shipping.origin.tax_id_codestringOpcional
header.additional.mx_shipping.origin.date_timestring (date-time)Opcional
header.additional.mx_shipping.origin.address_state_idstringOpcional
header.additional.mx_shipping.origin.address_country_idstringOpcional
header.additional.mx_shipping.origin.address_postalcodestringOpcional
header.additional.mx_shipping.destinationobjectOpcional
header.additional.mx_shipping.destination.tax_id_typestringOpcional
header.additional.mx_shipping.destination.tax_id_codestringOpcional
header.additional.mx_shipping.destination.date_timestring (date-time)Opcional
header.additional.mx_shipping.destination.address_state_idstringOpcional
header.additional.mx_shipping.destination.address_country_idstringOpcional
header.additional.mx_shipping.destination.address_postalcodestringOpcional
header.additional.mx_shipping.merchandiseobjectOpcional
header.additional.mx_shipping.merchandise.total_weightstringOpcional
header.additional.mx_shipping.merchandise.sct_permission_codestringOpcional
header.additional.mx_shipping.merchandise.sct_permission_numberstringOpcional
header.additional.mx_shipping.merchandise.vehicle_configurationstringOpcional
header.additional.mx_shipping.merchandise.vehicle_weightstringOpcional
header.additional.mx_shipping.merchandise.vehicle_license_platestringOpcional
header.additional.mx_shipping.merchandise.vehicle_yearstringOpcional
header.additional.mx_shipping.merchandise.insurance_companystringOpcional
header.additional.mx_shipping.merchandise.insurance_identifierstringOpcional
header.additional.mx_shipping.merchandise.detailsarray<object>Opcional
header.additional.mx_shipping.merchandise.details[].product_codestringOpcional
header.additional.mx_shipping.merchandise.details[].descriptionstringOpcional
header.additional.mx_shipping.merchandise.details[].quantitystringOpcional
header.additional.mx_shipping.merchandise.details[].weightstringOpcional
header.additional.mx_exportsobjectOpcional
header.additional.mx_exports.termsstringOpcional
header.additional.mx_exports.exchange_ratenumber (float)Opcional
header.additional.mx_exports.totalintegerOpcional
header.additional.mx_exports.originobjectOpcional
header.additional.mx_exports.origin.address_streetstringOpcional
header.additional.mx_exports.origin.address_city_idstringOpcional
header.additional.mx_exports.origin.address_county_idstringOpcional
header.additional.mx_exports.origin.address_state_idstringOpcional
header.additional.mx_exports.origin.address_country_idstringOpcional
header.additional.mx_exports.origin.address_postalcodestringOpcional
header.additional.mx_exports.destinationobjectOpcional
header.additional.mx_exports.destination.tax_id_typestringOpcional
header.additional.mx_exports.destination.tax_id_codestringOpcional
header.additional.mx_exports.destination.address_streetstringOpcional
header.additional.mx_exports.destination.address_state_idstringOpcional
header.additional.mx_exports.destination.address_country_idstringOpcional
header.additional.mx_exports.destination.address_postalcodestringOpcional
header.additional.mx_exports.merchandiseobjectOpcional
header.additional.mx_exports.merchandise.detailsarray<object>Opcional
header.additional.mx_exports.merchandise.details[].customs_codestringOpcional
header.additional.mx_exports.merchandise.details[].customs_quantitystringOpcional
header.additional.mx_exports.merchandise.details[].skustringOpcional
header.additional.mx_exports.merchandise.details[].customs_measure_unitstringOpcional
header.additional.mx_exports.merchandise.details[].customs_unit_valuestringOpcional
header.additional.mx_exports.merchandise.details[].customs_total_valuestringOpcional
header.additional.co_headerobjectOpcional
header.additional.co_header.reported_payment_codeintegerOpcionalReported payment code according to the DIAN payment codes of Colombia. You can find all reported_payment_code codes on the Colombia examples page. If this field is not sent, its default value will be "cash".
header.additional.pe_headerobjectOpcional
header.additional.pe_header.operation_typestringOpcionalOperation type according to Peruvian SUNAT operation codes. You can find all operation_type codes on Peru examples page.
header.additional.ar_headerobjectOpcional
header.additional.ar_header.invoice_conceptintegerOpcionalIndicates whether the invoice corresponds to products (1), services (2), or both (3).
header.additional.ar_header.items_quantityintegerOpcionalRepresents the total number of line items included in the invoice.
header.additional.ar_header.service_date_fromstringOpcionalIndicates the start date of the service period covered by the invoice.
header.additional.ar_header.service_date_tostringOpcionalIndicates the end date of the service period covered by the invoice.
header.additional.ar_header.receiver_vat_condition_idstringOpcionalIdentifies the VAT status of the receiver according to tax regulations.
header.additional.pe_retention_headerobjectOpcional
header.additional.pe_retention_header.pe_sunat_retention_system_codestringOpcional
header.additional.pe_retention_header.pe_sunat_retention_percentnumberOpcional
header.additional.pe_retention_header.pe_sunat_total_paidnumberOpcional
header.additional.pe_shippingobjectOpcional
header.additional.pe_shipping.handling_codestringOpcionalIt corresponds to the reason for the transfer, being a sale (1), a purchase (2), or other reasons (13).
header.additional.pe_shipping.special_instructionsintegerOpcionalThis field contains specific SUNAT transport indicators that define particular shipping or logistics conditions, such as total transfer, vehicle return, subcontracted transport, or freight payer details.
1 = SUNAT_Envio_IndicadorTrasladoTotal - Corresponds to the indicator for the total transfer of goods.

2 = SUNAT_Envio_IndicadorRetornoVehiculoEnvaseVacio – Corresponds to the indicator for the return of a vehicle carrying empty containers or packaging.

3 = SUNAT_Envio_IndicadorRetornoVehiculoVacio – Corresponds to the indicator for the return of an empty vehicle.

4 = SUNAT_Envio_IndicadorTransbordoProgramado – Corresponds to the indicator for a scheduled transshipment.

5 = SUNAT_Envio_IndicadorTrasporteSubcontratado – Subcontracted transport indicator: corresponds to the indicator for the total transfer of the DAM or DS.

6 = SUNAT_Envio_IndicadorPagadorFlete_Remitente – Indicator for freight payer: sender.

7 = SUNAT_Envio_IndicadorPagadorFlete_Subcontratador – Indicator for freight payer: subcontractor.

8 = SUNAT_Envio_IndicadorPagadorFlete_Tercero – Indicator for freight payer: third party.

9 = SUNAT_Envio_IndicadorTrasladoVehiculoM1L – Indicates whether the transport is carried out using a light vehicle classified under category M1 or L, according to SUNAT transport regulations.
header.additional.pe_shipping.handling_instructionsstringOpcionalDescription of the reason for transfer.
header.additional.pe_shipping.gross_weight_measurestringOpcionalRefers to the total gross weight of the shipment, including the weight of goods, packaging, and any containers.
header.additional.pe_shipping.gross_weight_measure_idstringOpcionalIdentifies the unit of measurement used for the gross weight, such as kilograms (KG) or tons (T). See more in the unit_measure table.
header.additional.pe_shipping.shipment_stageobjectOpcional
header.additional.pe_shipping.shipment_stage.transport_mode_codestringOpcionalDefines whether the transport is public (01) or private (02). Other values are not accepted.
header.additional.pe_shipping.shipment_stage.transit_periodstringOpcionalIndicates the estimated duration or time frame of the goods' transportation from origin to destination.
header.additional.pe_shipping.shipment_stage.driver_personobjectOpcional
header.additional.pe_shipping.shipment_stage.driver_person.driver_idstringOpcionalRefers to the DNI number of the driver responsible for the transport.
header.additional.pe_shipping.shipment_stage.driver_person.first_namestringOpcionalIndicates the driver's given name as registered for the transport operation.
header.additional.pe_shipping.shipment_stage.driver_person.family_namestringOpcionalIndicates the driver’s last name or surname as registered for the transport operation.
header.additional.pe_shipping.shipment_stage.driver_person.identity_document_referencestringOpcionalRefers to the driver’s license code or identification document number used to authorize the transport operation.
header.additional.pe_shipping.shipment_stage.carrier_partyobjectOpcional
header.additional.pe_shipping.shipment_stage.carrier_party.party_identificationstringOpcionalIdentifies the carrier entity responsible for the transportation service, typically using a tax identification number (e.g., RUC)
header.additional.pe_shipping.shipment_stage.carrier_party.party_legal_entity_namestringOpcionalSpecifies the legal name of the carrier company responsible for the transportation service.
header.additional.pe_shipping.shipment_stage.carrier_party.party_legal_entity_idstringOpcionalThe code of the ‘Authorized issuing entity – carrier’.
header.additional.pe_shipping.shipment_stage.carrier_party.agent_party_idstringOpcional
header.additional.pe_shipping.deliveryobjectOpcional
header.additional.pe_shipping.delivery.delivery_addressobjectOpcional
header.additional.pe_shipping.delivery.delivery_address.idstringOpcionalCode identifying the delivery location, usually corresponding to the geographical code (UBIGEO) assigned by the Peruvian authority.
header.additional.pe_shipping.delivery.delivery_address.city_subdivision_namestringOpcionalName of the urban subdivision or neighborhood (e.g., urbanization, residential area).
header.additional.pe_shipping.delivery.delivery_address.city_namestringOpcionalName of the province or city where the delivery point is located.
header.additional.pe_shipping.delivery.delivery_address.country_subentitystringOpcionalName of the department or region associated with the delivery address.
header.additional.pe_shipping.delivery.delivery_address.districtstringOpcionalName of the district where the delivery location is situated.
header.additional.pe_shipping.delivery.delivery_address.address_linestringOpcionalFull address or detailed description of the delivery point.
header.additional.pe_shipping.delivery.delivery_address.country_idstringOpcionalNumeric or alphanumeric code representing the country (e.g., “83” for Peru).
header.additional.pe_shipping.delivery.dispatchobjectOpcional
header.additional.pe_shipping.delivery.dispatch.idstringOpcionalCode identifying the dispatch location, usually corresponding to the geographical code (UBIGEO) assigned by the Peruvian authority.
header.additional.pe_shipping.delivery.dispatch.city_subdivision_namestringOpcionalName of the urban subdivision or neighborhood (e.g., urbanization, residential area) where the dispatch point is located.
header.additional.pe_shipping.delivery.dispatch.city_namestringOpcionalName of the province or city from which the goods are dispatched.
header.additional.pe_shipping.delivery.dispatch.country_subentitystringOpcionalName of the department or region associated with the dispatch address.
header.additional.pe_shipping.delivery.dispatch.districtstringOpcionalName of the district where the dispatch location is situated.
header.additional.pe_shipping.delivery.dispatch.address_linestringOpcionalFull address or detailed description of the dispatch point.
header.additional.pe_shipping.delivery.dispatch.country_idstringOpcionalNumeric or alphanumeric code representing the country (e.g., “83” for Peru).
header.additional.pe_shipping.transport_handling_unitobjectOpcional
header.additional.pe_shipping.transport_handling_unit.transport_equipment_idstringOpcionaldentifies the code or license plate number of the transport equipment (e.g., truck, trailer, or container) used to move the goods.
detailsarray<object>Opcional
details[].quantitynumber (float)Siempre obligatorioQuantity (can have up to 6 decimals, separate with a dot, not with a comma).
details[].skustringOpcionalUnique internal SKU that identifies the product
details[].line_descriptionstringSiempre obligatorioShort description to be included in the invoice as line title. Max 100 chars.
details[].unit_pricenumber (float)Siempre obligatorioUnit price (can have up to 6 decimals, separate with a dot, not with a comma). If using the 'gross_values' option, it must be the value including VAT.
details[].long_descriptionstringOpcionalAllows adding an additional long description to the detail description for the document.
details[].unit_measurestringSiempre obligatorioUnit that this line is measured in.
details[].modifier_amountnumberOpcionalAmount to discount or surcharge.
If it is a discount, use a negative value.
If this is used, do not use discount_or_surcharge_percentage.
details[].modifier_percentagenumber (float)OpcionalPercentage to discount or surcharge. If it is a discount, use a negative value. If this is used, do not use discount_or_surcharge_amount.
details[].total_taxesnumber (float)OpcionalTotal taxes for this line.
details[].total_amount_linenumber (float)Siempre obligatorioTotal amount for this line, including taxes and modifiers.
details[].taxesarray<object>Opcional
details[].taxes[].tax_type_idstringSiempre obligatorioIdentifier of the tax type.
details[].taxes[].tax_percentagenumber (float)Siempre obligatorioPercentage of the tax.
details[].taxes[].tax_amountnumber (float)Siempre obligatorioAmount of the tax.
details[].additionalobjectOpcional
details[].additional.mx_detailobjectOpcionalThese are additional fields you will need to use when adding details to your documents in Mexico
details[].additional.mx_detail.product_service_identifierstringOpcionalThis is the SAT code for the product or service you are buying/selling for tax purposes. Please see the SAT website for coding. If ommited, the generic code 01010101 will be used
details[].additional.mx_detail.measure_unit_codestringOpcionalThis is the SAT code for the measurement unit of this product or service. Please check the SAT website for codes. If ommited, the generic code E48 will be used
referencesarray<object>Opcional
references[].document_type_idintegerOpcionalDocument type of the referenced document.
references[].reference_typeintegerOpcionalChile: Otros documentos que no son documentos
tributarios electrónicos: (debe usarse código
referencia = 5)
801 = Orden de compra
802 = Nota de pedido
803 = Contrato
804 = Resolución
805 = Proceso ChileCompra
806 = Ficha ChileCompra
807 = DUS
808 = B/L (Conocimiento de embarque)
809 = AWB (Air Will Bill)
810 = MIC/DTA
811 = Carta de Porte
812 = Resolución del SNA donde califica
Servicios de Exportación
813 = Pasaporte
814 = Certificado de Depósito Bolsa Prod. Chile.
815 = Vale de Prenda Bolsa Prod.
references[].reference_numberstringOpcionalEnter the document_number to reference: use reference_number or reference_document_id, but never both together. In the case of a global reference, it must be 0.
references[].reference_document_idintegerOpcionalEnter the document_id to reference: use reference_document_id or reference_number, but never both together.
references[].reference_codeintegerSiempre obligatorio1 = cancel
2 = correct text
3 = correct quantity
4 = set
5 = reference to other non-tax documents
6 = reference to dispatch guide
7 = global reference to a type of document (allows reducing the amount for all documents of this type for this particular client).
references[].descriptionstringSiempre obligatorioReference description.
references[].reference_datestring (date)OpcionalIt should only be entered when using a reference that is not an electronic tax document. (YYYY-MM-DD).
references[].additionalobjectOpcional
references[].additional.pe_retention_detailsobjectOpcional
references[].additional.pe_retention_details.reference_paid_amountnumberOpcional
references[].additional.pe_retention_details.reference_total_invoice_amountnumberOpcional
references[].additional.pe_retention_details.reference_paid_datestring (date)Opcional
references[].additional.pe_retention_details.reference_payment_idstringOpcional
references[].additional.pe_retention_details.pe_reference_sunat_retention_amountnumberOpcional
references[].additional.pe_retention_details.pe_reference_sunat_retention_datestring (date)Opcional
references[].additional.pe_retention_details.calculation_ratenumberOpcional
references[].additional.pe_retention_details.currency_idstringOpcional
globals_discounts_surchargesarray<object>Opcional
globals_discounts_surcharges[].discount_surcharge_codestringSiempre obligatorioDA = Global discount on taxable
DE = Global discount on exempt
RA = Global surcharge on taxable
RE = Global surcharge on exempt
globals_discounts_surcharges[].discount_surcharge_valueinteger (float)Siempre obligatorioValue of the discount or surcharge.
globals_discounts_surcharges[].discount_surcharge_typestringSiempre obligatorio$ = Value will be applied as an amount
% = Value will be applied as a percentage of the amount
totalsobjectOpcional
totals.vat_credit_construction_companyintegerOpcional65% credit for construction companies. Article 21 of Decree Law No. 910/75.
This is the only code that operates in the opposite manner to the rest, as it is subtracted from the general VAT. It corresponds to VAT * 0.65.
NOT supported in the case of 'gross_values' (Chile).
totals.net_amountintegerSiempre obligatorioRequired, except in the case of gross values.
Total value of taxable items. It should NOT be entered if using the 'gross_values' option.
totals.taxes_amountintegerOpcionalSum of other taxes, can be negative if there are withholding taxes. NOT supported in the case of 'gross_values'.
totals.total_amountintegerSiempre obligatorioFinal value.
payment_linkobjectOpcional
payment_link.payment_urlstringOpcionalURL of the payment link for the document if you want to provide it yourself to be included in the document.

Ejemplo JSON del cuerpo

{
    "options": {
        "draft_only": 0,
        "draft_preview": 0,
        "send_email": 1,
        "template_id": 0,
        "gross_values": "1",
        "rounding_type": "net",
        "company_web": "https://www.company.com/",
        "company_email": "[email protected]",
        "pdf_transfer_copy": 1
    },
    "header": {
        "account_id": "141",
        "document_type_id": "2",
        "document_sequence_code": "F001",
        "issue_date": "string",
        "document_number": 0,
        "issuer_tax_id_code": "string",
        "issuer_tax_id_type": "string",
        "issuer_legal_name": "string",
        "issuer_address": "string",
        "issuer_district": "string",
        "issuer_city": "string",
        "issuer_country_id": "string",
        "issuer_phone": "string",
        "issuer_activity": "string",
        "issuer_postalcode": "string",
        "receiver_tax_id_code": "11111111-1",
        "receiver_tax_id_type": "string",
        "receiver_legal_name": "string",
        "receiver_address": "string",
        "receiver_district": "string",
        "receiver_city": "string",
        "receiver_phone": "string",
        "receiver_activity": "string",
        "receiver_postalcode": "string",
        "receiver_state_id": 0,
        "receiver_county_id": "string",
        "receiver_country_id": 0,
        "receiver_email": "string",
        "payment_conditions": "string",
        "seller_id": 0,
        "currency_id": 0,
        "exchange_rate_value": 0,
        "service_indicator": 0,
        "sale_modality": 0,
        "sale_clause": 0,
        "guide_type": 0,
        "transfer_type": 0,
        "branch_office_code": "string",
        "observations": "string",
        "deployment_observations": 0,
        "port_disembarkation": "string",
        "port_embarkation": "string",
        "gross_weight": "string",
        "shipping_address": "string",
        "additional": {
            "mx_header": {
                "receiver_cfdi_usage": "string"
            },
            "mx_shipping": {
                "distance": "100",
                "transport_code": "01",
                "transport_method_name": "Autotransporte",
                "transport_tax_id_type": "MX-RFC",
                "transport_tax_id_code": "EKU9003173C9",
                "transport_license": "a234567890",
                "origin": {
                    "tax_id_type": "...",
                    "tax_id_code": "...",
                    "date_time": "...",
                    "address_state_id": "...",
                    "address_country_id": "...",
                    "address_postalcode": "..."
                },
                "destination": {
                    "tax_id_type": "...",
                    "tax_id_code": "...",
                    "date_time": "...",
                    "address_state_id": "...",
                    "address_country_id": "...",
                    "address_postalcode": "..."
                },
                "merchandise": {
                    "total_weight": "...",
                    "sct_permission_code": "...",
                    "sct_permission_number": "...",
                    "vehicle_configuration": "...",
                    "vehicle_weight": "...",
                    "vehicle_license_plate": "...",
                    "vehicle_year": "...",
                    "insurance_company": "...",
                    "insurance_identifier": "...",
                    "details": "..."
                }
            },
            "mx_exports": {
                "terms": "FOB",
                "exchange_rate": 20.6708,
                "total": 1624,
                "origin": {
                    "address_street": "...",
                    "address_city_id": "...",
                    "address_county_id": "...",
                    "address_state_id": "...",
                    "address_country_id": "...",
                    "address_postalcode": "..."
                },
                "destination": {
                    "tax_id_type": "...",
                    "tax_id_code": "...",
                    "address_street": "...",
                    "address_state_id": "...",
                    "address_country_id": "...",
                    "address_postalcode": "..."
                },
                "merchandise": {
                    "details": "..."
                }
            },
            "co_header": {
                "reported_payment_code": 0
            },
            "pe_header": {
                "operation_type": "string"
            },
            "ar_header": {
                "invoice_concept": 0,
                "items_quantity": 0,
                "service_date_from": "string",
                "service_date_to": "string",
                "receiver_vat_condition_id": "string"
            },
            "pe_retention_header": {
                "pe_sunat_retention_system_code": "string",
                "pe_sunat_retention_percent": 0,
                "pe_sunat_total_paid": 0
            },
            "pe_shipping": {
                "handling_code": "string",
                "special_instructions": 0,
                "handling_instructions": "string",
                "gross_weight_measure": "string",
                "gross_weight_measure_id": "string",
                "shipment_stage": {
                    "transport_mode_code": "...",
                    "transit_period": "...",
                    "driver_person": "...",
                    "carrier_party": "..."
                },
                "delivery": {
                    "delivery_address": "...",
                    "dispatch": "..."
                },
                "transport_handling_unit": {
                    "transport_equipment_id": "..."
                }
            }
        }
    },
    "details": [
        {
            "quantity": 0,
            "sku": "string",
            "line_description": "string",
            "unit_price": 0,
            "long_description": "string",
            "unit_measure": "string",
            "modifier_amount": 0,
            "modifier_percentage": 0,
            "total_taxes": 0,
            "total_amount_line": 0,
            "taxes": [
                {
                    "tax_type_id": "...",
                    "tax_percentage": "...",
                    "tax_amount": "..."
                }
            ],
            "additional": {
                "mx_detail": {
                    "product_service_identifier": "...",
                    "measure_unit_code": "..."
                }
            }
        }
    ],
    "references": [
        {
            "document_type_id": 0,
            "reference_type": 0,
            "reference_number": "string",
            "reference_document_id": 0,
            "reference_code": 0,
            "description": "string",
            "reference_date": "string",
            "additional": {
                "pe_retention_details": {
                    "reference_paid_amount": "...",
                    "reference_total_invoice_amount": "...",
                    "reference_paid_date": "...",
                    "reference_payment_id": "...",
                    "pe_reference_sunat_retention_amount": "...",
                    "pe_reference_sunat_retention_date": "...",
                    "calculation_rate": "...",
                    "currency_id": "..."
                }
            }
        }
    ],
    "globals_discounts_surcharges": [
        {
            "discount_surcharge_code": "string",
            "discount_surcharge_value": 0,
            "discount_surcharge_type": "string"
        }
    ],
    "totals": {
        "vat_credit_construction_company": 0,
        "net_amount": 0,
        "taxes_amount": 0,
        "total_amount": 0
    },
    "payment_link": {
        "payment_url": "string"
    }
}

Respuestas

Document created successfully