📄 MIPYME Documents
Update a specific document
PUT
URL del endpoint
https://api-billing.koywe.com/V1/documents/{document_id}
Requiere autenticación
Autenticación
Envía la cabecera Authorization: Bearer <token> (obtenido en POST /auth) en los endpoints protegidos.
Parámetros
| Nombre | Ubicación | Tipo | Requerido | Descripción |
|---|---|---|---|---|
document_id | path | string | ✓ | — |
Cuerpo de la solicitud — campos
| Campo | Tipo | Obligatoriedad | Descripción |
|---|---|---|---|
document_id | integer | Opcional | Document ID. |
document_status | integer | Opcional | Indicates the status of the document. 0 = Draft (Chile only), 1 = issued, 2 = cancelled (Mexico only). Changing this value through PATCH operations will issue or cancel the document. |
header | object | Opcional | — |
header.account_id | integer | Opcional | Account ID. |
header.document_type_id | integer | Siempre obligatorio | Document type ID according to document type table. |
header.document_type_taxbureau | string | Opcional | Type of document at the tax bureau. |
header.document_number | integer | Opcional | Document number. |
header.received_issued_flag | integer | Opcional | 0 = received 1 = issued |
header.taxbureau_validation_status | integer | Opcional | Document status at the tax bureau. |
header.issue_date | string (date) | Siempre obligatorio | Document issue date. |
header.issuer_tax_id_code | string | Opcional | Tax ID code according to tax id table. Required when the document requires the receiver to be specified. |
header.issuer_tax_id_type | string | Opcional | Tax ID type according to tax id table. Required when the document requires the receiver to be specified. |
header.issuer_legal_name | string | Opcional | Issuer legal name |
header.issuer_address | string | Siempre obligatorio | Issuer address |
header.issuer_district | string | Siempre obligatorio | Identifier for the district of the document issuer |
header.issuer_city | string | Siempre obligatorio | Identifier for the city of the document issuer |
header.issuer_state_id | integer | Opcional | Refers to the issuer's state. Empty if it doesn't apply. This is a required field on some countries, check the examples for your country |
header.issuer_country_id | integer | Opcional | Identifier for the country of the document issuer |
header.issuer_phone | string | Siempre obligatorio | Issuer phone number |
header.issuer_activity | string | Siempre obligatorio | Represents the activity or business operation of the document issuer |
header.customer_supplier_id | integer | Opcional | Returns the customer or supplier ID |
header.receiver_tax_id_code | string | Opcional | The tax identification code of the document receiver |
header.receiver_tax_id_type | string | Opcional | Tax ID type according to tax id table. Required when the document requires the receiver to be specified. |
header.receiver_legal_name | string | Opcional | Receiver legal name |
header.receiver_address | string | Siempre obligatorio | Required address |
header.receiver_district | string | Siempre obligatorio | The location code of the document receiver |
header.receiver_city | string | Siempre obligatorio | The city of the document receiver |
header.receiver_state_id | integer | Opcional | Refers 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_country_id | integer | Opcional | Country ID according to ID table |
header.receiver_phone | string | Siempre obligatorio | The phone of the document receiver |
header.receiver_activity | string | Siempre obligatorio | The activity of the document receiver |
header.receiver_postalcode | string | Opcional | Optional postal code according to the national format. |
header.payment_conditions | string | Opcional | Payment due dates separated by comma. Example: 0 = same day 30 = 30 days 0,30 = 50% on issuance date, 50% 30 days later 0,30,60 = 33% on issuance, 33% 30 days, 34% 60 days |
header.currency_id | number | Siempre obligatorio | Currency ID according to currency table |
header.exchange_rate_value | integer | Opcional | Only when currency_id is defined and its value is a foreign currency. |
header.sale_modality | integer | Opcional | Only 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_clause | integer | Opcional | Only 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.transportation_doc_type | number | Opcional | Waybills only. 1 = Operation constitutes a sale 2 = Ventas por efectuar 3 = Consignaciones 4 = Entrega gratuita 5 = Traslados internos 6 = Otros traslados no venta 7 = Guía de devolución 8 = Traslado para exportación (no venta) 9 = Venta para exportación |
header.transportation_doc_billing | number | Opcional | Waybills only. 1 = Despacho por cuenta del receptor 2 = Despacho por cuenta del emisor a instalaciones del receptor 3 = Despacho por cuenta del emisor a otras instalaciones |
header.document_status | number | Opcional | 0 = draft 1 = document_issued 2 = document sent to counterparty 3 = document accepted by counterparty |
details | array<object> | Opcional | — |
details[].quantity | number | Siempre obligatorio | Quantity of this product or service included in this line |
details[].line_description | string | Opcional | Short description to be included in the invoice as line title. Max 100 chars |
details[].unit_measure | string | Opcional | Unit that this line is measured in |
details[].unit_price | number | Siempre obligatorio | Price per unit |
details[].long_description | string | Opcional | Long description to be included in the invoice as line title. Max 100 chars |
details[].modifier_amount | number | Opcional | — |
details[].total_taxes | number | Opcional | Total of all taxes included for this detail |
details[].modifier_percentage | number | Opcional | Positive or negative percentage to be applied before calculating the line total. Example: -6.5 for a 6.5% discount |
details[].total_amount_line | number | Siempre obligatorio | Total of the line, including net price and taxes |
totals | object | Opcional | — |
totals.net_amount | number | Siempre obligatorio | Total of all net values from each of the detail lines. |
totals.taxes_amount | number | Opcional | Total of all other taxes |
totals.total_amount | number | Siempre obligatorio | Document grand total |
electronic_document | object | Opcional | — |
electronic_document.document_xml | string | Opcional | Base64 encoded XML |
electronic_document.document_pdf | string | Opcional | Base64 encoded PDF |
electronic_document.stamp_img | string | Opcional | Base64 encoded stamp image |
electronic_document.document_transfer_copy_pdf | string | Opcional | Base64 encoded transfer copy PDF (copia cedible). Present when pdf_transfer_copy option was used on create or GET. VALID ONLY FOR CHILE. |
payment_link | object | Opcional | — |
payment_link.payment_url | string | Opcional | URL of the payment link for the document |
result | object | Opcional | — |
result.status | integer | Opcional | Represents the current status of the result |
result.error_message | string | Opcional | URL of the payment link for the document |
Ejemplo JSON del cuerpo
{
"document_id": 0,
"document_status": 0,
"header": {
"account_id": 0,
"document_type_id": 0,
"document_type_taxbureau": "string",
"document_number": 0,
"received_issued_flag": 0,
"taxbureau_validation_status": 0,
"issue_date": "string",
"issuer_tax_id_code": "string",
"issuer_tax_id_type": "string",
"issuer_legal_name": "string",
"issuer_address": "string",
"issuer_district": "string",
"issuer_city": "string",
"issuer_state_id": 0,
"issuer_country_id": 0,
"issuer_phone": "string",
"issuer_activity": "string",
"customer_supplier_id": 0,
"receiver_tax_id_code": "string",
"receiver_tax_id_type": "string",
"receiver_legal_name": "string",
"receiver_address": "string",
"receiver_district": "string",
"receiver_city": "string",
"receiver_state_id": 0,
"receiver_country_id": 0,
"receiver_phone": "string",
"receiver_activity": "string",
"receiver_postalcode": "string",
"payment_conditions": "string",
"currency_id": 0,
"exchange_rate_value": 0,
"sale_modality": 0,
"sale_clause": 0,
"transportation_doc_type": 0,
"transportation_doc_billing": 0,
"document_status": 0
},
"details": [
{
"quantity": 0,
"line_description": "string",
"unit_measure": "string",
"unit_price": 0,
"long_description": "string",
"modifier_amount": 0,
"total_taxes": 0,
"modifier_percentage": 0,
"total_amount_line": 0
}
],
"totals": {
"net_amount": 0,
"taxes_amount": 0,
"total_amount": 0
},
"electronic_document": {
"document_xml": "string",
"document_pdf": "string",
"stamp_img": "string",
"document_transfer_copy_pdf": "string"
},
"payment_link": {
"payment_url": "string"
},
"result": {
"status": 0,
"error_message": "string"
}
}
Respuestas
Document updated successfully
Cannot update a signed document