ES | EN

📄 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

NombreUbicaciónTipoRequeridoDescripción
document_idpathstring

Cuerpo de la solicitud — campos

CampoTipoObligatoriedadDescripción
document_idintegerOpcionalDocument ID.
document_statusintegerOpcionalIndicates 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.
headerobjectOpcional
header.account_idintegerOpcionalAccount ID.
header.document_type_idintegerSiempre obligatorioDocument type ID according to document type table.
header.document_type_taxbureaustringOpcionalType of document at the tax bureau.
header.document_numberintegerOpcionalDocument number.
header.received_issued_flagintegerOpcional0 = received
1 = issued
header.taxbureau_validation_statusintegerOpcionalDocument status at the tax bureau.
header.issue_datestring (date)Siempre obligatorioDocument issue date.
header.issuer_tax_id_codestringOpcionalTax ID code according to tax id table. Required when the document requires the receiver to be specified.
header.issuer_tax_id_typestringOpcionalTax ID type according to tax id table. Required when the document requires the receiver to be specified.
header.issuer_legal_namestringOpcionalIssuer legal name
header.issuer_addressstringSiempre obligatorioIssuer address
header.issuer_districtstringSiempre obligatorioIdentifier for the district of the document issuer
header.issuer_citystringSiempre obligatorioIdentifier for the city of the document issuer
header.issuer_state_idintegerOpcionalRefers 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_idintegerOpcionalIdentifier for the country of the document issuer
header.issuer_phonestringSiempre obligatorioIssuer phone number
header.issuer_activitystringSiempre obligatorioRepresents the activity or business operation of the document issuer
header.customer_supplier_idintegerOpcionalReturns the customer or supplier ID
header.receiver_tax_id_codestringOpcionalThe tax identification code of the document receiver
header.receiver_tax_id_typestringOpcionalTax ID type according to tax id table. Required when the document requires the receiver to be specified.
header.receiver_legal_namestringOpcionalReceiver legal name
header.receiver_addressstringSiempre obligatorioRequired address
header.receiver_districtstringSiempre obligatorioThe location code of the document receiver
header.receiver_citystringSiempre obligatorioThe city of the document receiver
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_country_idintegerOpcionalCountry ID according to ID table
header.receiver_phonestringSiempre obligatorioThe phone of the document receiver
header.receiver_activitystringSiempre obligatorioThe activity of the document receiver
header.receiver_postalcodestringOpcionalOptional postal code according to the national format.
header.payment_conditionsstringOpcionalPayment 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_idnumberSiempre obligatorioCurrency ID according to currency table
header.exchange_rate_valueintegerOpcionalOnly when currency_id is defined and its value is a foreign currency.
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.transportation_doc_typenumberOpcionalWaybills 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_billingnumberOpcionalWaybills 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_statusnumberOpcional0 = draft
1 = document_issued
2 = document sent to counterparty
3 = document accepted by counterparty
detailsarray<object>Opcional
details[].quantitynumberSiempre obligatorioQuantity of this product or service included in this line
details[].line_descriptionstringOpcionalShort description to be included in the invoice as line title. Max 100 chars
details[].unit_measurestringOpcionalUnit that this line is measured in
details[].unit_pricenumberSiempre obligatorioPrice per unit
details[].long_descriptionstringOpcionalLong description to be included in the invoice as line title. Max 100 chars
details[].modifier_amountnumberOpcional
details[].total_taxesnumberOpcionalTotal of all taxes included for this detail
details[].modifier_percentagenumberOpcionalPositive or negative percentage to be applied before calculating the line total. Example: -6.5 for a 6.5% discount
details[].total_amount_linenumberSiempre obligatorioTotal of the line, including net price and taxes
totalsobjectOpcional
totals.net_amountnumberSiempre obligatorioTotal of all net values from each of the detail lines.
totals.taxes_amountnumberOpcionalTotal of all other taxes
totals.total_amountnumberSiempre obligatorioDocument grand total
electronic_documentobjectOpcional
electronic_document.document_xmlstringOpcionalBase64 encoded XML
electronic_document.document_pdfstringOpcionalBase64 encoded PDF
electronic_document.stamp_imgstringOpcionalBase64 encoded stamp image
electronic_document.document_transfer_copy_pdfstringOpcionalBase64 encoded transfer copy PDF (copia cedible). Present when pdf_transfer_copy option was used on create or GET. VALID ONLY FOR CHILE.
payment_linkobjectOpcional
payment_link.payment_urlstringOpcionalURL of the payment link for the document
resultobjectOpcional
result.statusintegerOpcionalRepresents the current status of the result
result.error_messagestringOpcionalURL 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