Facturación

Crear nota de crédito

Changed on

Emite una nota de crédito (CFDI de egreso) a partir de un billing document existente.

Se usa para anular un billing document cuando el ejercicio fiscal ya está cerrado y no se puede cancelar directamente. Devuelve el billing document de la nota de crédito emitida. Falla con 404 si el documento de origen no existe.

post/billing-documents/credit-note

Request

  • Base URL
    https://api.trytoku.com
  • URL
    https://api.trytoku.com/billing-documents/credit-note
  • Auth
    API key in header x-api-key

Headers

x-account-keystring

Llave de API de una Account, para operar sobre esa Account en lugar de la principal.

Request body

amountnumber

Monto de la nota, si es por menos que el total del CFDI original. Si se omite, se toma de los conceptos enviados. Debe ser mayor que 0.

datestring date-time

Fecha de emisión en formato ISO 8601. Si se omite, se usa la del momento de la emisión.

payment_formstring required

Clave de forma de pago del SAT con la que se devuelve el monto: 03 transferencia electrónica, 01 efectivo, 99 por definir.

provider_external_idstring required

Identificador del CFDI original al que se relaciona la nota. Es el provider_external_id que devolvió su emisión.

reasonstring

Motivo de la nota, para tus propios registros.

Example request

{
  "amount": 500,
  "date": "2026-08-12T10:30:00",
  "items": [
    {
      "identification_number": "SKU-4471",
      "product_code": "84111506",
      "product_description": "Servicio de suscripción mensual",
      "quantity": 1,
      "tax_object": "02",
      "taxes": [
        {
          "base": 1500,
          "name": "IVA",
          "rate": 0.16,
          "total": 240
        }
      ],
      "unit_code": "E48",
      "unit_price": 1500
    }
  ],
  "payment_form": "03",
  "provider_external_id": "a1b2c3d4-5e6f-7890-abcd-ef1234567890",
  "reason": "Devolución parcial del pedido"
}

Response

Successful Response

billing_addressstring
billing_emailstring
checkout_session_idstring
discountnumber required
fiscal_billing_idstring required
foliostring required
id_accountstring required
id_billing_documentstring required
id_customerstring
id_invoicestring
id_transactionstring
issue_datestring date-time required
pdf_urlstring required
provider_external_idstring required
public_pdf_urlstring
public_xml_urlstring
related_fiscal_billing_idstring
status'ISSUED' | 'FAILED' | 'CANCELLED' | 'PENDING_CANCELLATION'

Estado de un comprobante fiscal mexicano ante el SAT. Nace ISSUED, que es el documento ya timbrado y vigente. Pedir su cancelación lo deja en PENDING_CANCELLATION mientras el receptor la acepta, y el documento sigue vigente durante esa espera: pasa a CANCELLED si la acepta, y vuelve a ISSUED si la ventana de aceptación vence sin respuesta.

FAILED está declarado pero ningún flujo lo emite: el comprobante se registra solo después de timbrarse, así que un timbrado fallido no deja documento.

sub_totalnumber required
tax_idstring required
tax_regimestring required
tax_zip_codestring required
totalnumber required
type'INVOICE' | 'CREDIT_NOTE' | 'COMPLEMENT'

Clase de comprobante fiscal mexicano (CFDI) que se emitió: INVOICE es la factura de ingreso que documenta la venta, COMPLEMENT el complemento de pago que acusa el pago de una factura PPD ya emitida, y CREDIT_NOTE la nota de crédito que rebaja o revierte un comprobante anterior, relacionada al CFDI original.

xml_urlstring required

Changes

    • breaking

      request body became required

    • breaking

      the request property's minItems was increased to 1

    • breaking

      the request property type changed from object to array

    • breaking

      the response's property type changed from integer to number for status

    • breaking

      the response's property type changed from string to no type for status

    • breaking

      the response's property type changed from integer to number for status

    • breaking

      the response's property type changed from integer to number for status

    • breaking

      the response's property type changed from string to no type for status

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      added the new CANCELLED enum value to the response property for the response status

    • warning

      added the new COMPLEMENT enum value to the response property for the response status

    • warning

      added the new CREDIT_NOTE enum value to the response property for the response status

    • warning

      added the new FAILED enum value to the response property for the response status

    • warning

      added the new INVOICE enum value to the response property for the response status

    • warning

      added the new ISSUED enum value to the response property for the response status

    • warning

      added the new PENDING_CANCELLATION enum value to the response property for the response status

    • info

      api operation id nota-de-crédito removed and replaced with create_credit_note

    • info

      api tag Facturación added

    • info

      added the new optional header request parameter x-account-key

    • info

      the request property format was generalized from float to no format

    • info

      the request property format was generalized from date to date-time

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      removed the non-success response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response's property default value 0 was removed for the status

    • info

      the response's property default value 0 was removed for the status

    • info

      the response's property default value 0 was removed for the status