Build the Modelo 349 EC Sales List into AEAT XML
Skill: Convert intra-EU transaction records into the Modelo 349 presentation XML
Region: Spain (España)
Category: VAT — IVA (Modelo 349, declaración recapitulativa de operaciones intracomunitarias)
Does: Takes a period's intra-EU supplies and acquisitions of goods and services and produces the AEAT Modelo 349 presentation XML — one Declarado row per counterparty and operation key (clave de operación) carrying the VIES NIF-IVA and the importe, plus rectificaciones — the EC Sales List that reconciles with the Modelo 303 intracom boxes.
Standard: AEAT Modelo 349 — declaración recapitulativa (Orden EHA/769/2010 y modificaciones; presentación telemática XML por Servicio Web / formulario)
This XML is the telematic presentation body of the Modelo 349 recapitulative statement, not a standalone document deposited anywhere. The AI builds and totals the rows; the taxpayer must validate each counterparty's NIF-IVA against VIES, confirm the period and clave, and submit through the AEAT Sede Electrónica with an electronic certificate. Element names and the period regime depend on the active design — verify against the current diseño de registro del Modelo 349 before sending.
When this applies
- Any taxpayer who performs intra-Community operations (entregas/adquisiciones de bienes, prestaciones/adquisiciones de servicios B2B, ventas en consigna, operaciones triangulares, ventas a distancia) must file the Modelo 349 listing each EU counterparty by their VIES VAT number.
- Period: monthly as a rule; quarterly if intra-EU supplies of goods did not exceed €50,000 in the quarter or the four previous quarters; annual only in the limited legacy cases. Deadline: by the 20th of the following month/quarter (4T and December by 30 January).
- This is informative — it carries no payment. The amounts must reconcile with the Modelo 303 intra-EU boxes and the SII ledgers.
- Excluded: domestic operations, exports/imports to non-EU (those are exportaciones/DUA, not 349), and B2C distance sales declared under the OSS/IOSS one-stop-shop (Modelo 369) rather than the 349
M/Hlegacy keys.
Filing procedure
- Read the source. Accept a VAT ledger export, the SII intra-EU aggregates, an invoice CSV/JSON, or pasted totals. Identify each intra-EU operation: counterparty country + NIF-IVA, the operation type, the period amount, and whether it is a correction.
- Extract fields. For each counterparty + clave combination capture: counterparty name, NIF comunitario (country prefix + number), clave de operación, and the period importe. For rectificaciones also capture the original period (ejercicio + periodo) and the original declared amount. Missing or unverifiable NIF-IVA → ask, do not guess.
- Normalize. Aggregate all invoices for the same counterparty + same clave into a single row (one
Declaradoper counterparty/clave). Amounts in EUR, integer or 2-decimal per the design (dot decimal, no thousands separator). NIF-IVA uppercased, country prefix kept (e.g.FR,DE). - Classify the clave. Map each operation to its clave de operación (E, A, T, S, I, M, H…) using the code table.
- Build the rows. Emit one
RegistroDeclaradoper counterparty/clave; emitRegistroRectificacionrows for corrections to prior periods. - Total and reconcile. Sum the importes into the resumen; reconcile entregas (E) with Modelo 303 box for entregas intracomunitarias and adquisiciones (A) with the intracom acquisition boxes. Validate against the checklist.
Source → Modelo 349 field map
| From the source | → Target element / field |
|---|---|
| Declarant NIF | Declarante/NIFDeclarante |
| Declarant name | Declarante/NombreRazon |
| Exercise (year) | Declarante/Ejercicio |
| Period (01–12 / 1T–4T / 0A) | Declarante/Periodo |
| Counterparty country prefix + VAT number | Declarado/NIFOperadorIntracomunitario |
| Counterparty name | Declarado/NombreRazon |
| Operation key | Declarado/ClaveOperacion |
| Period amount (base) | Declarado/BaseImponible |
| Triangular operation flag | Declarado/OperacionIntracomTriangular |
| — for a correction: original year | Rectificacion/EjercicioRectificado |
| — original period | Rectificacion/PeriodoRectificado |
| — corrected (new) amount | Rectificacion/BaseImponible |
| — previously declared amount | Rectificacion/BaseImponibleAnterior |
| Total counterparties declared | Resumen/NumeroOperadores |
| Total of all importes | Resumen/ImporteOperaciones |
Every required output field appears above. Repeat Declarado once per counterparty/clave and Rectificacion once per corrected prior-period row.
Document structure
Modelo349
├── Declarante (header — once per declaration)
│ ├── NIFDeclarante
│ ├── NombreRazon
│ ├── Ejercicio (yyyy)
│ ├── Periodo (01–12 | 1T–4T | 0A annual)
│ └── Telefono / PersonaContacto (optional)
├── Declarados (current-period operations)
│ └── Declarado (one per counterparty + clave, repeatable)
│ ├── NIFOperadorIntracomunitario (country prefix + VIES number)
│ ├── NombreRazon
│ ├── ClaveOperacion (E, A, T, S, I, M, H…)
│ └── BaseImponible
├── Rectificaciones (corrections to prior periods, optional)
│ └── Rectificacion (repeatable)
│ ├── NIFOperadorIntracomunitario
│ ├── NombreRazon
│ ├── ClaveOperacion
│ ├── EjercicioRectificado
│ ├── PeriodoRectificado
│ ├── BaseImponible (new amount)
│ └── BaseImponibleAnterior (previously declared)
└── Resumen
├── NumeroOperadores (count of Declarado rows)
└── ImporteOperaciones (Σ BaseImponible)
A row may also carry OperacionIntracomTriangular to flag a triangular operation. Distance-sale keys M/H are legacy and largely superseded by the OSS (Modelo 369) for B2C.
Code tables
Clave de operación
| Code | Meaning |
|---|---|
E |
Entregas intracomunitarias de bienes (intra-EU supplies of goods) |
A |
Adquisiciones intracomunitarias de bienes (intra-EU acquisitions of goods) |
T |
Entregas en otro Estado miembro subsiguientes a adquisiciones intracom exentas en operación triangular |
S |
Prestaciones intracomunitarias de servicios (services supplied) |
I |
Adquisiciones intracomunitarias de servicios (services received) |
M |
Entregas de bienes posteriores a importaciones exentas (representante fiscal — legacy distance/import) |
H |
Entregas de bienes posteriores a importaciones exentas efectuadas por el representante fiscal |
R |
Transferencias de bienes en el marco de acuerdos de ventas en consigna (call-off stock — envío) |
D |
Devoluciones de bienes desde acuerdos de ventas en consigna |
C |
Sustituciones del destinatario en acuerdos de ventas en consigna |
Periodo
| Code | Meaning |
|---|---|
01–12 |
Monthly period (default obligation) |
1T–4T |
Quarterly period (intra-EU goods ≤ €50,000 in the quarter and previous four) |
0A |
Annual (legacy, limited cases) |
NIF comunitario (country prefix examples)
| Prefix | Member State |
|---|---|
ES |
España |
FR |
France |
DE |
Germany |
IT |
Italy |
PT |
Portugal |
NL |
Netherlands |
Each NIFOperadorIntracomunitario is the country prefix immediately followed by the national VAT number, validated against VIES.
Calculation rules
- Row aggregation: sum every invoice for the same counterparty + same clave into one
BaseImponiblefor the period (do not list invoices individually). Resumen/ImporteOperaciones= Σ of allDeclarado/BaseImponibleacross rows, 2 decimals.Resumen/NumeroOperadores= count ofDeclaradorows (each distinct counterparty/clave).- Rectificación: the row carries the corrected total in
BaseImponibleand the previously declared total inBaseImponibleAnterior; the net effect isBaseImponible − BaseImponibleAnterior. - 303 reconciliation: Σ clave
Eshould equal the Modelo 303 entregas intracomunitarias de bienes y servicios box; Σ claveAshould equal the adquisiciones intracomunitarias base (303 box 10/group); ΣS/Ireconcile with the corresponding service boxes. Flag any divergence. - Amounts in EUR, dot decimal, 2dp, no thousands separator. Never copy a printed total — recompute every sum.
Worked example (end-to-end)
Input — March 2026 intra-EU operations (pasted)
Declarante: Comercial Ejemplo SL NIF: B12345678
Ejercicio 2026, periodo 03 (mensual)
Operaciones del periodo:
- Venta de mercaderías a MAISON DUPONT (FR, NIF FR40123456789): 2 facturas, 12.000,00 € + 8.000,00 € → entrega intracom de bienes
- Compra de componentes a BAUTEILE GMBH (DE, NIF DE811234567): 1 factura 5.000,00 € → adquisición intracom de bienes
- Servicios de consultoría prestados a ROSSI SRL (IT, NIF IT12345670017): 3.000,00 € → prestación intracom de servicios
Rectificación de febrero 2026:
- MAISON DUPONT (FR40123456789), clave E: declarado 10.000,00 €, importe correcto 9.000,00 €
After extraction + normalization (intermediate)
Declarado rows (aggregated by counterparty + clave):
FR40123456789 MAISON DUPONT clave E 12000.00 + 8000.00 = 20000.00
DE811234567 BAUTEILE GMBH clave A 5000.00
IT12345670017 ROSSI SRL clave S 3000.00
Rectificacion rows:
FR40123456789 MAISON DUPONT clave E ejercicio 2026 periodo 02
BaseImponible 9000.00 / BaseImponibleAnterior 10000.00
Resumen: NumeroOperadores = 3 ; ImporteOperaciones = 20000.00 + 5000.00 + 3000.00 = 28000.00
Output — Modelo 349 presentation XML
<?xml version="1.0" encoding="UTF-8"?>
<Modelo349>
<Declarante>
<NIFDeclarante>B12345678</NIFDeclarante>
<NombreRazon>Comercial Ejemplo SL</NombreRazon>
<Ejercicio>2026</Ejercicio>
<Periodo>03</Periodo>
</Declarante>
<Declarados>
<Declarado>
<NIFOperadorIntracomunitario>FR40123456789</NIFOperadorIntracomunitario>
<NombreRazon>MAISON DUPONT</NombreRazon>
<ClaveOperacion>E</ClaveOperacion>
<BaseImponible>20000.00</BaseImponible>
</Declarado>
<Declarado>
<NIFOperadorIntracomunitario>DE811234567</NIFOperadorIntracomunitario>
<NombreRazon>BAUTEILE GMBH</NombreRazon>
<ClaveOperacion>A</ClaveOperacion>
<BaseImponible>5000.00</BaseImponible>
</Declarado>
<Declarado>
<NIFOperadorIntracomunitario>IT12345670017</NIFOperadorIntracomunitario>
<NombreRazon>ROSSI SRL</NombreRazon>
<ClaveOperacion>S</ClaveOperacion>
<BaseImponible>3000.00</BaseImponible>
</Declarado>
</Declarados>
<Rectificaciones>
<Rectificacion>
<NIFOperadorIntracomunitario>FR40123456789</NIFOperadorIntracomunitario>
<NombreRazon>MAISON DUPONT</NombreRazon>
<ClaveOperacion>E</ClaveOperacion>
<EjercicioRectificado>2026</EjercicioRectificado>
<PeriodoRectificado>02</PeriodoRectificado>
<BaseImponible>9000.00</BaseImponible>
<BaseImponibleAnterior>10000.00</BaseImponibleAnterior>
</Rectificacion>
</Rectificaciones>
<Resumen>
<NumeroOperadores>3</NumeroOperadores>
<ImporteOperaciones>28000.00</ImporteOperaciones>
</Resumen>
</Modelo349>
Normalisations shown: the two MAISON DUPONT invoices aggregated into one E row (12000.00 + 8000.00 = 20000.00); amounts 12.000,00 € → 12000.00 (dot decimal, 2dp); NIF-IVA kept with country prefix (FR40123456789); operation types mapped to claves (E, A, S); the February correction emitted as a Rectificacion carrying the new total 9000.00 and the prior 10000.00; resumen recomputed (NumeroOperadores = 3, ImporteOperaciones = 28000.00). Clave E total (20000.00) reconciles with the Modelo 303 entregas intracomunitarias box; clave A (5000.00) with the adquisiciones intracom box.
Validation checklist
- All counterparties and amounts extracted; AI asked about anything missing or ambiguous (no invented NIF-IVA or importes)
- Every
NIFOperadorIntracomunitariocarries the country prefix and is validated against VIES - One
Declaradorow per counterparty + clave; multiple invoices aggregated into a singleBaseImponible -
ClaveOperacionis a valid key (E, A, T, S, I, M, H, R, D, C) matching the operation type -
Periodocorrect (01–12monthly,1T–4Tquarterly only if intra-EU goods ≤ €50,000) andEjercicioisyyyy - Rectificaciones carry both
BaseImponible(new) andBaseImponibleAnterior(prior) plus the original ejercicio/periodo -
Resumen/NumeroOperadores= row count;Resumen/ImporteOperaciones= Σ BaseImponible (recomputed) - Clave
E/A/S/Itotals reconcile with the matching Modelo 303 intra-EU boxes and the SII ledgers - B2C distance sales routed to OSS (Modelo 369), not legacy
M/H, where applicable - Amounts in EUR, dot decimal, 2dp, no thousands separator; XML well-formed against the current diseño de registro
- Filed by the 20th of the following period (30 January for 4T / December) before submission
Last updated: 2026-06-13 — verify the current Modelo 349 diseño de registro, clave de operación list, and period thresholds against the AEAT specification before use.