Tax classification per line

Set exemption_reason on each line correctly. Includes the full mapping from BeeL API values to AEAT codes (S1/S2/N1/N2/E1–E6).


Every line carries an optional exemption_reason that tells AEAT how the operation is classified for IVA purposes. The BeeL API uses descriptive enum values (EXENTA_ART_25, NO_SUJETA_LOCALIZACION, ISP_ART_84_2_A, etc.); BeeL translates those to the AEAT codes (E5, N2, S2) before submission.

If you leave exemption_reason unset, BeeL classifies the line as sujeta y no exenta (S1) with the IVA rate you set in main_tax.percentage.

Allowed main_tax.percentage values

The VatPercentage enum accepts five values:

ValueRate nameNotes
0ExemptUse together with an exemption_reason (see below)
4Super-reducedBasic food, books, medicines
5RD-ley 11/2022 temporary reducedOlive and seed oils, pasta
10ReducedHospitality, transport, most foods
21StandardDefault for goods and services

The 5 % rate was added by RD-ley 11/2022 and is currently extended; it pairs with a 0.625 % recargo de equivalencia (see Equivalence surcharge). For IGIC/IPSI lines, use main_tax.type: "IGIC" or "IPSI" — those carry their own rate enum.

The four families

                        Operation is …

        ┌─────────────────────┼─────────────────────┐
   subject to IVA       not subject to IVA      exempt from IVA
   (sujeta)             (no sujeta)             (exenta)
        │                     │                     │
   ┌────┴────┐                │                     │
  S1        S2               N1 or N2          E1, E2, E3, E4, E5, E6
 normal    ISP              (location /        (legal exemption)
                            general rules)

Mapping table: BeeL API value ↔ AEAT code

AEAT codeBeeL exemption_reason valueWhen to use
S1 (default)omit the fieldDefault — subject to IVA, normal seller-collects
S2ISP_ART_84_2_A / ISP_ART_84_2_E / ISP_ART_84_2_FISP — buyer self-assesses the IVA (3 LIVA articles depending on cause)
N1NO_SUJETA_ART_7_9Not subject by general rules (internal transfers, etc.)
N2NO_SUJETA_LOCALIZACIONOperation localised outside Spain (intra-EU services, services to non-EU)
E1EXENTA_ART_20Educational, medical, social, insurance, residential rental
E2EXENTA_ART_21Exports of goods to non-EU territories
E3EXENTA_ART_22International transport, customs zone operations
E4EXENTA_ART_24Bonded warehouse operations
E5EXENTA_ART_25Intra-EU sales of goods to a business with valid VIES VAT-ID
E6EXENTA_ART_26Other LIVA exemptions (Art. 26)
(special)EXENTA_ART_140Specific cases under Art. 140 LIVA
(special regimes)REGIMEN_ART_129 / REGIMEN_ART_135 / REGIMEN_ART_141 / REGIMEN_ART_154 / REGIMEN_ART_163_DECIESSpecial LIVA regimes — should set the matching regime_key, not be reported as exempt
(other)OTROAny other case not covered above

When in doubt between NO_SUJETA_LOCALIZACION (N2) and EXENTA_ART_25 (E5) for intra-EU operations, the rule is simple: bienes → E5, servicios → N2. See International customers.

How you set it in the API

The exemption_reason lives directly on each line. There's also an optional exemption_reason_text to add free-text context.

B2B intra-EU services (N2)

{
  "lines": [
    {
      "description": "Consulting services to EU business",
      "quantity": 1,
      "unit": "service",
      "unit_price": 1000,
      "discount_percentage": 0,
      "main_tax": { "type": "IVA", "percentage": 0, "regime_key": "01" },
      "exemption_reason": "NO_SUJETA_LOCALIZACION",
      "exemption_reason_text": "Operation not subject to Spanish VAT under Art. 69 LIVA"
    }
  ]
}

B2B intra-EU goods (E5)

{
  "lines": [
    {
      "description": "Hardware supply to EU customer",
      "quantity": 1,
      "unit": "unit",
      "unit_price": 1000,
      "discount_percentage": 0,
      "main_tax": { "type": "IVA", "percentage": 0, "regime_key": "01" },
      "exemption_reason": "EXENTA_ART_25"
    }
  ]
}

Inversión del sujeto pasivo (S2)

{
  "lines": [
    {
      "description": "Construction services subject to reverse charge",
      "quantity": 1,
      "unit": "project",
      "unit_price": 1000,
      "discount_percentage": 0,
      "main_tax": { "type": "IVA", "percentage": 0, "regime_key": "01" },
      "exemption_reason": "ISP_ART_84_2_F"
    }
  ]
}

Pick the right ISP article — _A, _E, or _F — based on the specific scenario in Art. 84.2 LIVA.

Exempt educational service (E1)

{
  "lines": [
    {
      "description": "Training course",
      "quantity": 1,
      "unit": "course",
      "unit_price": 500,
      "discount_percentage": 0,
      "main_tax": { "type": "IVA", "percentage": 0, "regime_key": "01" },
      "exemption_reason": "EXENTA_ART_20"
    }
  ]
}

Rules BeeL enforces

RuleWhat happens if you break it
If exemption_reason is set, main_tax.percentage must be 0 and equivalence_surcharge_rate must not be setRejected at issuance
EXENTA_ART_25 (E5) requires the customer to have an alternative_id of type NIF_IVARejected — E5 is reserved for intra-EU B2B with VAT-ID
EXENTA_ART_21 (E2) typically pairs with regime_key: 02 (exportación) — BeeL doesn't auto-set itWarning only
ISP_* cannot pair with equivalence_surcharge_rateRejected — ISP forbids surcharge
Default (no exemption_reason) requires main_tax.percentage > 0Otherwise BeeL doesn't know how to classify a 0 % subject line

Decision tree

Where is the customer?
├─ In Spain
│  ├─ Operation is subject to IVA?
│  │  ├─ Yes, normal seller-collects-IVA  →  omit exemption_reason (S1)
│  │  ├─ Yes, ISP applies                 →  ISP_ART_84_2_A / _E / _F (S2)
│  │  └─ Yes, but exempted by law         →  EXENTA_ART_20 ... 26 (E1–E6)
│  └─ Not subject (out-of-scope op)       →  NO_SUJETA_ART_7_9 (N1)

├─ EU country (intra-community)
│  ├─ Customer is B2B with VIES VAT-ID
│  │  ├─ Selling goods                    →  EXENTA_ART_25 (E5)
│  │  └─ Selling services                 →  NO_SUJETA_LOCALIZACION (N2)
│  └─ Customer is B2C (no VIES)
│     ├─ Under 10 000 € OSS threshold     →  omit (S1) — apply Spanish IVA
│     └─ Over OSS threshold               →  NO_SUJETA_LOCALIZACION + main_tax.regime_key="17"

└─ Non-EU
   ├─ Selling goods (export)              →  EXENTA_ART_21 + main_tax.regime_key="02"
   └─ Selling services                    →  NO_SUJETA_LOCALIZACION

The full payload examples for each path live in International customers.