Servidor MCPHerramientas disponibles
Actualizar borrador CFDI
Reemplaza un borrador CFDI y vuelve a validar su contrato fiscal.
Herramienta MCP
update_cfdi_draftPropósito
Reemplaza un borrador CFDI y vuelve a validar su contrato fiscal.
- Usar cuando
- Un borrador CFDI necesita corrección antes del timbrado.
- No usar cuando
- Ya está timbrado o necesitas cambiar su estado.
- Permisos requeridos
- Efectos secundarios
- Efecto externo
- Idempotencia
- Idempotente
Esquema de entrada
JSON Schema{ "type": "object", "properties": { "idempotencyKey": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Unique retry key for this exact operation. Reuse it only when retrying the same request." }, "input": { "oneOf": [ { "type": "object", "properties": { "pdfCustomSection": { "$ref": "#/definitions/__schema0" }, "currency": { "$ref": "#/definitions/__schema1" }, "documentRef": { "$ref": "#/definitions/__schema2" }, "customerId": { "$ref": "#/definitions/__schema3" }, "items": { "$ref": "#/definitions/__schema4" }, "kind": { "$ref": "#/definitions/__schema8" }, "cfdiUse": { "$ref": "#/definitions/__schema9" }, "payment": { "$ref": "#/definitions/__schema10" } }, "required": [ "documentRef", "customerId", "items", "kind", "cfdiUse", "payment" ], "additionalProperties": false, "title": "CFDI I · income" }, { "type": "object", "properties": { "pdfCustomSection": { "$ref": "#/definitions/__schema0" }, "currency": { "$ref": "#/definitions/__schema1" }, "documentRef": { "$ref": "#/definitions/__schema2" }, "customerId": { "$ref": "#/definitions/__schema3" }, "items": { "$ref": "#/definitions/__schema4" }, "kind": { "$ref": "#/definitions/__schema13" }, "formCode": { "$ref": "#/definitions/__schema11" }, "methodCode": { "$ref": "#/definitions/__schema14" }, "relatedDocuments": { "$ref": "#/definitions/__schema15" } }, "required": [ "documentRef", "customerId", "items", "kind", "formCode", "relatedDocuments" ], "additionalProperties": false, "title": "CFDI E · credit_note" }, { "type": "object", "properties": { "pdfCustomSection": { "$ref": "#/definitions/__schema0" }, "currency": { "$ref": "#/definitions/__schema1" }, "documentRef": { "$ref": "#/definitions/__schema2" }, "customerId": { "$ref": "#/definitions/__schema3" }, "items": { "$ref": "#/definitions/__schema4" }, "kind": { "$ref": "#/definitions/__schema18" } }, "required": [ "documentRef", "customerId", "items", "kind" ], "additionalProperties": false, "title": "CFDI T · transfer" }, { "type": "object", "properties": { "pdfCustomSection": { "$ref": "#/definitions/__schema0" }, "currency": { "$ref": "#/definitions/__schema1" }, "documentRef": { "$ref": "#/definitions/__schema2" }, "kind": { "$ref": "#/definitions/__schema19" }, "employeeId": { "$ref": "#/definitions/__schema20" }, "payroll": { "$ref": "#/definitions/__schema21" } }, "required": [ "documentRef", "kind", "employeeId", "payroll" ], "additionalProperties": false, "title": "CFDI N · payroll" }, { "type": "object", "properties": { "pdfCustomSection": { "$ref": "#/definitions/__schema0" }, "documentRef": { "$ref": "#/definitions/__schema2" }, "kind": { "$ref": "#/definitions/__schema23" }, "customerId": { "$ref": "#/definitions/__schema24" }, "payment": { "$ref": "#/definitions/__schema25" } }, "required": [ "documentRef", "kind", "customerId", "payment" ], "additionalProperties": false, "title": "CFDI P · payment_complement" } ] } }, "required": [ "idempotencyKey", "input" ], "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { "__schema0": { "type": "string" }, "__schema1": { "type": "string", "minLength": 3, "maxLength": 3 }, "__schema2": { "type": "string", "pattern": "^cfdi:", "description": "CFDI draft returned by search_documents" }, "__schema3": { "type": "string", "minLength": 1 }, "__schema4": { "minItems": 1, "type": "array", "items": { "$ref": "#/definitions/__schema5" } }, "__schema5": { "oneOf": [ { "$ref": "#/definitions/__schema6" }, { "$ref": "#/definitions/__schema7" } ] }, "__schema6": { "type": "object", "properties": { "kind": { "type": "string", "const": "product" }, "productId": { "type": "string", "minLength": 1, "description": "Existing Exac product ID" }, "quantity": { "type": "number", "exclusiveMinimum": 0 }, "unitPrice": { "type": "number", "minimum": 0, "description": "Unit price in pesos" }, "discount": { "type": "number", "minimum": 0 }, "taxIncluded": { "type": "boolean" } }, "required": [ "kind", "productId", "quantity", "unitPrice" ], "additionalProperties": false }, "__schema7": { "type": "object", "properties": { "kind": { "type": "string", "const": "custom" }, "description": { "type": "string", "minLength": 1 }, "quantity": { "type": "number", "exclusiveMinimum": 0 }, "unitPrice": { "type": "number", "minimum": 0, "description": "Unit price in pesos" }, "satProductCode": { "type": "string", "minLength": 1, "description": "SAT product/service code" }, "satUnitCode": { "type": "string", "minLength": 1, "description": "SAT unit code" }, "discount": { "type": "number", "minimum": 0 }, "taxIncluded": { "type": "boolean" }, "taxRate": { "type": "number", "minimum": 0, "maximum": 1 }, "taxability": { "type": "string", "enum": [ "standard", "zero", "exempt" ] } }, "required": [ "kind", "description", "quantity", "unitPrice", "satProductCode", "satUnitCode" ], "additionalProperties": false }, "__schema8": { "type": "string", "const": "income" }, "__schema9": { "type": "string", "enum": [ "G01", "D06", "I07", "I06", "I01", "I05", "D09", "G02", "D04", "I04", "I03", "D08", "G03", "D03", "D02", "D01", "D05", "I02", "CN01", "I08", "CP01", "D10", "D07", "S01" ], "description": "Active SAT CFDI-use code.", "x-exac-sat-catalog": "cfdi-uses" }, "__schema10": { "oneOf": [ { "type": "object", "properties": { "timing": { "type": "string", "const": "single_payment" }, "formCode": { "$ref": "#/definitions/__schema11" }, "conditions": { "type": "string", "maxLength": 1000 } }, "required": [ "timing", "formCode" ], "additionalProperties": false }, { "type": "object", "properties": { "timing": { "type": "string", "const": "deferred_or_installments" }, "formCode": { "type": "string", "const": "99" }, "dueDate": { "description": "Calendar date in YYYY-MM-DD format", "allOf": [ { "$ref": "#/definitions/__schema12" } ] }, "settlementTerms": { "type": "object", "properties": { "installmentCount": { "type": "integer", "minimum": 1, "maximum": 60 }, "firstDue": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "transaction_date" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "months_after_transaction" }, "months": { "type": "integer", "minimum": 1, "maximum": 60 } }, "required": [ "kind", "months" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "fixed_date" }, "date": { "type": "string" } }, "required": [ "kind", "date" ], "additionalProperties": false } ] }, "recurrence": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "anchor_day" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "day_of_month" }, "day": { "type": "integer", "minimum": 1, "maximum": 31 } }, "required": [ "kind", "day" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "last_day" } }, "required": [ "kind" ], "additionalProperties": false } ] } }, "required": [ "installmentCount", "firstDue", "recurrence" ], "additionalProperties": false }, "conditions": { "type": "string", "maxLength": 1000 } }, "required": [ "timing", "formCode" ], "additionalProperties": false } ] }, "__schema11": { "type": "string", "enum": [ "12", "13", "14", "15", "17", "23", "24", "25", "26", "27", "28", "29", "30", "31", "99", "02", "06", "01", "05", "04", "03", "08" ], "description": "Active SAT payment-form code.", "x-exac-sat-catalog": "payment-forms" }, "__schema12": { "type": "string", "format": "date", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" }, "__schema13": { "type": "string", "const": "credit_note" }, "__schema14": { "type": "string", "enum": [ "PPD", "PUE" ], "description": "Active SAT payment-method code. Defaults to PUE when omitted.", "x-exac-sat-catalog": "payment-methods" }, "__schema15": { "minItems": 1, "type": "array", "items": { "$ref": "#/definitions/__schema16" } }, "__schema16": { "type": "object", "properties": { "relationship": { "type": "string", "enum": [ "07", "03", "06", "01", "02", "04", "05" ], "description": "Active SAT CFDI relationship-type code.", "x-exac-sat-catalog": "relationship-types" }, "documents": { "minItems": 1, "type": "array", "items": { "$ref": "#/definitions/__schema17" }, "description": "Related CFDI UUIDs" } }, "required": [ "relationship", "documents" ], "additionalProperties": false }, "__schema17": { "type": "string", "minLength": 1 }, "__schema18": { "type": "string", "const": "transfer" }, "__schema19": { "type": "string", "const": "payroll" }, "__schema20": { "type": "string", "minLength": 1 }, "__schema21": { "type": "object", "properties": { "paidOn": { "$ref": "#/definitions/__schema12" }, "periodStartedOn": { "allOf": [ { "$ref": "#/definitions/__schema12" } ] }, "periodEndedOn": { "allOf": [ { "$ref": "#/definitions/__schema12" } ] }, "paidDays": { "type": "number", "exclusiveMinimum": 0 }, "employee": { "type": "object", "properties": { "curp": { "type": "string", "minLength": 1 }, "employeeNumber": { "type": "string", "minLength": 1 }, "socialSecurityNumber": { "type": "string", "minLength": 1 }, "employmentStartedOn": { "$ref": "#/definitions/__schema12" }, "contractType": { "type": "string", "enum": [ "10", "99", "01", "02", "03", "04", "05", "06", "07", "08", "09" ], "description": "Active SAT payroll contract-type code.", "x-exac-sat-catalog": "payroll-contract-types" }, "regimeType": { "type": "string", "enum": [ "10", "11", "12", "13", "99", "02", "03", "04", "05", "06", "07", "08", "09" ], "description": "Active SAT payroll regime-type code.", "x-exac-sat-catalog": "payroll-regime-types" }, "paymentFrequency": { "type": "string", "enum": [ "10", "99", "01", "02", "03", "04", "05", "06", "07", "08", "09" ], "description": "Active SAT payroll payment-frequency code.", "x-exac-sat-catalog": "payroll-payment-frequencies" }, "stateCode": { "type": "string", "enum": [ "AGU", "BCN", "BCS", "CAM", "CHP", "CHH", "COA", "COL", "CMX", "DUR", "GUA", "GRO", "HID", "JAL", "MEX", "MIC", "MOR", "NAY", "NLE", "OAX", "PUE", "QUE", "ROO", "SLP", "SIN", "SON", "TAB", "TAM", "TLA", "VER", "YUC", "ZAC" ], "description": "Active SAT federal-entity code.", "x-exac-sat-catalog": "federal-entities" }, "positionRisk": { "type": "string", "enum": [ "1", "2", "3", "4", "5", "99" ], "description": "Active SAT payroll position-risk code.", "x-exac-sat-catalog": "payroll-position-risks" }, "integratedDailySalary": { "type": "number", "exclusiveMinimum": 0 } }, "required": [ "curp", "employeeNumber", "employmentStartedOn", "contractType", "regimeType", "paymentFrequency", "stateCode" ], "additionalProperties": false }, "earnings": { "minItems": 1, "type": "array", "items": { "$ref": "#/definitions/__schema22" } }, "deductions": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1, "description": "SAT deduction type code" }, "amount": { "type": "number", "exclusiveMinimum": 0 } }, "required": [ "type", "amount" ], "additionalProperties": false } }, "otherPayments": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "999", "001", "002", "003", "004", "005", "006", "007", "008", "009" ], "description": "Active SAT payroll other-payment code.", "x-exac-sat-catalog": "payroll-other-payment-types" }, "amount": { "type": "number", "exclusiveMinimum": 0 }, "employmentSubsidy": { "type": "number", "minimum": 0 } }, "required": [ "type", "amount" ], "additionalProperties": false } } }, "required": [ "paidOn", "employee", "earnings" ], "additionalProperties": false }, "__schema22": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "001", "002", "003", "004", "005", "006", "009", "010", "011", "012", "013", "014", "015", "019", "020", "021", "022", "023", "024", "025", "026", "027", "028", "029", "030", "031", "032", "033", "034", "035", "036", "037", "038", "039", "044", "045", "046", "047", "048", "049", "050", "051", "052", "053" ], "description": "Active SAT payroll earning-type code.", "x-exac-sat-catalog": "payroll-earning-types" }, "taxableAmount": { "type": "number", "minimum": 0 }, "exemptAmount": { "type": "number", "minimum": 0 } }, "required": [ "type", "taxableAmount", "exemptAmount" ], "additionalProperties": false }, "__schema23": { "type": "string", "const": "payment_complement" }, "__schema24": { "type": "string", "minLength": 1 }, "__schema25": { "type": "object", "properties": { "formCode": { "$ref": "#/definitions/__schema11" }, "paidLocalDateTime": { "type": "string", "pattern": "^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d{1,9}))?$" }, "documents": { "minItems": 1, "type": "array", "items": { "$ref": "#/definitions/__schema26" } } }, "required": [ "formCode", "documents" ], "additionalProperties": false }, "__schema26": { "type": "object", "properties": { "uuid": { "$ref": "#/definitions/__schema27" }, "amount": { "$ref": "#/definitions/__schema28" }, "installment": { "$ref": "#/definitions/__schema29" }, "previousBalance": { "$ref": "#/definitions/__schema30" }, "series": { "$ref": "#/definitions/__schema31" }, "folio": { "$ref": "#/definitions/__schema32" }, "currency": { "$ref": "#/definitions/__schema33" }, "exchangeRate": { "$ref": "#/definitions/__schema34" }, "taxes": { "$ref": "#/definitions/__schema35" } }, "required": [ "uuid", "amount", "installment", "previousBalance", "taxes" ], "additionalProperties": false }, "__schema27": { "type": "string", "minLength": 1 }, "__schema28": { "type": "number", "exclusiveMinimum": 0 }, "__schema29": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991, "description": "1-based payment sequence" }, "__schema30": { "type": "number", "exclusiveMinimum": 0, "description": "Balance before payment; then use prior remaining balance" }, "__schema31": { "type": "string" }, "__schema32": { "type": "string" }, "__schema33": { "type": "string", "minLength": 3, "maxLength": 3 }, "__schema34": { "type": "number", "exclusiveMinimum": 0 }, "__schema35": { "anyOf": [ { "$ref": "#/definitions/__schema36" }, { "$ref": "#/definitions/__schema37" } ], "description": "Use auto for known CFDIs; otherwise send taxObject and rows" }, "__schema36": { "type": "string", "const": "auto", "description": "Let Exac calculate payment-level taxes from a related CFDI already known to the organization" }, "__schema37": { "type": "object", "properties": { "taxObject": { "$ref": "#/definitions/__schema38" }, "entries": { "$ref": "#/definitions/__schema39" } }, "required": [ "taxObject", "entries" ], "additionalProperties": false, "description": "Taxes for an external CFDI Exac cannot inspect" }, "__schema38": { "type": "string", "enum": [ "01", "02", "03", "04", "05", "06", "07", "08" ], "description": "SAT ObjetoImpDR from the related CFDI" }, "__schema39": { "type": "array", "items": { "$ref": "#/definitions/__schema40" }, "description": "Payment-level tax rows from the related CFDI" }, "__schema40": { "type": "object", "properties": { "base": { "$ref": "#/definitions/__schema41" }, "type": { "$ref": "#/definitions/__schema42" }, "rate": { "$ref": "#/definitions/__schema43" }, "factor": { "$ref": "#/definitions/__schema44" }, "withholding": { "$ref": "#/definitions/__schema45" } }, "required": [ "base", "type", "rate" ], "additionalProperties": false }, "__schema41": { "type": "number", "minimum": 0 }, "__schema42": { "type": "string", "enum": [ "IVA", "ISR", "IEPS" ] }, "__schema43": { "type": "number", "minimum": 0 }, "__schema44": { "type": "string", "enum": [ "Tasa", "Cuota", "Exento" ] }, "__schema45": { "type": "boolean" } }}Esquema de salida
JSON Schema{ "type": "object", "properties": { "data": { "type": "object", "properties": { "documentRef": { "type": "string", "pattern": "^(cfdi|withholding|sales_receipt|quote|expense|declaration|tax_compliance_opinion|sales_receipt_refund):.+$" }, "status": { "type": "string", "enum": [ "draft", "valid", "canceled" ] } }, "required": [ "documentRef", "status" ], "additionalProperties": false }, "error": { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "code": { "type": "string", "enum": [ "validation_error", "unauthenticated", "forbidden", "not_found", "method_not_allowed", "conflict", "idempotency_conflict", "operation_in_progress", "recovery_required", "rate_limited", "provider_unavailable", "internal" ] }, "message": { "type": "string" }, "details": { "type": "object", "properties": { "issues": { "type": "array", "items": { "type": "object", "properties": { "path": { "type": "array", "items": { "anyOf": [ { "type": "string" }, { "type": "number" } ] } }, "message": { "type": "string" }, "code": { "type": "string" } }, "required": [ "path", "message" ], "additionalProperties": false } }, "retryable": { "type": "boolean" }, "retryAfterSeconds": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 } }, "additionalProperties": false } }, "required": [ "code", "message" ], "additionalProperties": false } }, "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "oneOf": [ { "required": [ "data" ] }, { "required": [ "error" ] } ]}