Documentation
How AEAT Sync works — everything you need to get up and running Cómo funciona AEAT Sync — todo lo que necesitas para empezarAEAT Sync is the bridge between your business and Spain's tax authority (AEAT). Under Spain's VeriFactu regulation, every invoice your company issues must be digitally registered with AEAT in real time — with a secure, tamper-proof record. AEAT Sync does all of that for you automatically.
AEAT Sync es el puente entre tu empresa y la Agencia Tributaria (AEAT) de España. Según la regulación española VeriFactu, cada factura que emite tu empresa debe registrarse digitalmente con la AEAT en tiempo real — con un registro seguro e inalterable. AEAT Sync hace todo eso por ti automáticamente.
You focus on running your business. We handle the compliance.
Tú te centras en tu negocio. Nosotros nos encargamos del cumplimiento.
Automatic compliance
Every invoice is formatted to the AEAT VeriFactu XML spec, digitally signed and submitted — with zero manual work from you.
Cada factura se formatea según la especificación XML VeriFactu de la AEAT, se firma digitalmente y se envía — sin ningún trabajo manual de tu parte.
Hash chain integrity
Each invoice is cryptographically linked to the one before it. This creates an unbreakable audit trail that proves no invoice was deleted or altered.
Cada factura está enlazada criptográficamente con la anterior. Esto crea un rastro de auditoría inquebrantable que prueba que ninguna factura fue eliminada o alterada.
Real-time webhooks
Your system is notified the moment AEAT responds to an invoice submission — so you can update your records, trigger emails, or take any action instantly.
Tu sistema recibe una notificación en el momento en que la AEAT responde a un envío de factura — para que puedas actualizar tus registros, enviar emails o tomar cualquier acción al instante.
Your customer pays — your app tells us
When a payment completes in your system (whether that's Stripe, a bank transfer, or anything else), your app makes a single API call to AEAT Sync with the invoice details — customer name, amount, VAT rate, date.
POST https://api.aeatsync.io/api/v1/invoice
X-API-Key: your_api_key
{
"issuer_nif": "B12345678",
"issuer_name": "Your Company SL",
"issue_date": "2026-03-26",
"items": [{
"description": "Professional services",
"quantity": 1,
"unit_price": "1000.00",
"vat_rate": "21.00"
}]
}
We generate & sign the invoice
AEAT Sync builds the official VeriFactu XML document, assigns a sequential invoice number, computes the cryptographic hash, and links it to the previous invoice in your chain — all automatically.
AEAT Sync construye el documento XML VeriFactu oficial, asigna un número de factura secuencial, calcula el hash criptográfico y lo enlaza a la factura anterior de tu cadena — todo automáticamente.
We submit it to AEAT
The signed XML is sent to Spain’s tax authority over their secure VeriFactu web service. AEAT validates the submission and returns an acceptance or rejection.
El XML firmado se envía a la Agencia Tributaria española a través de su servicio web VeriFactu seguro. La AEAT valida el envío y devuelve una aceptación o un rechazo.
We notify your app via webhook
Once AEAT responds, we immediately POST the result to your webhook endpoint. Your app receives the invoice number, status, and the full hash — and can update your records, fire a confirmation email, or anything else.
Cuando la AEAT responde, enviamos inmediatamente el resultado a tu endpoint de webhook. Tu app recibe el número de factura, el estado y el hash completo — y puede actualizar tus registros, enviar un correo de confirmación o cualquier otra acción.
{
"event": "invoice.accepted",
"invoice_number": "A-000042",
"status": "accepted",
"hash": "a3f9d2...",
"issued_at": "2026-03-26T10:45:00Z"
}
Everything is stored & auditable here
Every invoice, its submission status, AEAT response, and the full hash chain is recorded in your AEAT Sync dashboard. You can view, search, and download the XML for any invoice at any time — your full audit trail is always a click away.
Cada factura, su estado de envío, la respuesta de la AEAT y la cadena de hash completa se registran en tu panel de AEAT Sync. Puedes ver, buscar y descargar el XML de cualquier factura en cualquier momento — tu rastro de auditoría completo siempre está a un clic de distancia.
Complete integration guide with code examples in Python, cURL, and Node.js. Covers hash chain mechanics, XML format, and webhook setup.
Guía completa de integración con ejemplos en Python, cURL y Node.js. Cubre mecánica de cadena de hash, formato XML y configuración de webhooks.
The most common setup is: Stripe charges your customer → Stripe fires a webhook to your server → your server calls AEAT Sync to register the invoice. Here's what that looks like:
Stripe processes the card and fires a payment_intent.succeeded event to your server.
Stripe procesa la tarjeta y envía un evento payment_intent.succeeded a tu servidor.
You extract the customer details, amount and description from the Stripe payload.
Extraes los detalles del cliente, el importe y la descripción del payload de Stripe.
One POST request to api.aeatsync.io/api/v1/invoice with the invoice data. That’s the only thing you need to add to your existing Stripe webhook handler.
Una sola petición POST a api.aeatsync.io/api/v1/invoice con los datos de la factura. Es lo único que necesitas añadir a tu manejador de webhook de Stripe existente.
We submit to AEAT, then fire a webhook back to your server with the final status. You can then update your invoice records or send the customer a receipt.
Enviamos a la AEAT y luego enviamos un webhook de vuelta a tu servidor con el estado final. Puedes entonces actualizar tus registros de facturas o enviar al cliente un recibo.
Every API request must include your key in the X-API-Key header. Keep it secret — treat it like a password.
Cada petición a la API debe incluir tu clave en la cabecera X-API-Key. Mantenla segura — trátala como una contraseña.
You can regenerate your key at any time from Settings. If you regenerate it, update it everywhere you use it.
Puedes regenerar tu clave en cualquier momento desde Configuración. Si la regeneras, actualízala en todos los lugares donde la uses.
Do I need to store the XML myself?
¿Necesito almacenar el XML yo mismo?
No. We store every XML document for you. You can download it from any invoice's detail page whenever you need it.
No. Almacenamos cada documento XML por ti. Puedes descargarlo desde la página de detalles de cualquier factura cuando lo necesites.
What happens if AEAT is down?
¿Qué pasa si la AEAT no está disponible?
We queue the submission and retry automatically. The invoice will show as pending until it's accepted.
Ponemos el envío en cola y reintentamos automáticamente. La factura aparecerá como pending hasta que sea aceptada.
Can I send test invoices without affecting AEAT?
¿Puedo enviar facturas de prueba sin afectar a la AEAT?
Yes. Use the Send test invoice button on your Dashboard — it creates a real invoice in the system but is clearly marked as a test.
Sí. Usa el botón Enviar factura de prueba en tu Panel — crea una factura real en el sistema pero está claramente marcada como prueba.
What is the hash chain?
¿Qué es la cadena de hash?
Each invoice includes a SHA-256 fingerprint of itself and the previous invoice. This creates a tamper-evident ledger — if any invoice is changed or deleted, the chain breaks immediately.
Cada factura incluye una huella SHA-256 de sí misma y de la factura anterior. Esto crea un libro de registro resistente a manipulaciones — si se cambia o elimina cualquier factura, la cadena se rompe inmediatamente.
If something isn’t working as expected, here are the best places to start:
Si algo no funciona como se espera, estos son los mejores lugares para empezar:
- Check the Invoices page — rejected invoices show the exact error from AEAT Revisa la página de Facturas — las facturas rechazadas muestran el error exacto de la AEAT
- Check the Webhooks page — failed deliveries can be replayed from there Revisa la página de Webhooks — las entregas fallidas se pueden reenviar desde allí
- Email support at [email protected] Envía un correo a [email protected]