Skip to main content
Key: es-tbai-v1 Module: github.com/invopop/gobl

Correction Definitions

Auto-generation of corrective invoices or credit and debit notes is supported.

Extension Keys

One or all of the following extensions may be required as part of the correction options. See the Extensions section for possible values.
  • es-tbai-correction

Extensions

TicketBAI Region Code

Region codes are used by TicketBAI to differentiate between the different subdivisions of the Basque Country. This is used to determine the correct API endpoint to use when submitting documents.
CodeName
VIAraba
BIBizkaia
SSGipuzkoa

TicketBAI Product Key

Product keys are used by TicketBAI to differentiate between -exported- goods and services. It may be useful to classify all products regardless of wether they are exported or not. There is an additional exception case for goods that are resold without modification when the supplier is in the simplified tax regime. For must purposes this special case can be ignored. If no product key is provided, the default is “services”.
CodeName
goodsDelivery of goods
servicesProvision of services
resaleResale of goods without modification by vendor in the simplified regime

TicketBAI Exemption code

Codes used by TicketBAI for both “exempt”, “not-subject”, and reverse charge transactions. In the TicketBAI format these are separated, but in order to simplify GOBL and be more closely aligned with other countries we’ve combined them into one. The follow mappings will be made automatically by GOBL during normalization.
Tax KeyExemption Codes
exemptE1 (default), E6
exportE2 (default), E3, E4
intra-communityE5
reverse-chargeS2
outside-scopeOT, RL, VT, IE
CodeName
E1Exempt: pursuant to Article 20 of the Foral VAT Law
E2Exempt: pursuant to Article 21 of the Foral VAT Law
E3Exempt: pursuant to Article 22 of the Foral VAT Law
E4Exempt: pursuant to Articles 23 and 24 of the Foral VAT Law
E5Exempt: pursuant to Article 25 of the Foral VAT law
E6Exempt: pursuant to other reasons
OTNot subject: pursuant to Article 7 of the VAT Law - other cases of non-subject
RLNot subject: pursuant to localization rules
VTNot subject: sales made on behalf of third parties (amount not computable for VAT or IRPF purposes)
IENot subject in the TAI due to localization rules, but foreign tax, IPS/IGIC or VAT from another EU member state is passed on
S2Subject and not exempt: with reverse charge

TicketBAI Rectification Type Code

Corrected or rectified invoices that need to be sent in the TicketBAI format require a specific type code to be defined alongside the preceding invoice data.
CodeName
R1Rectified invoice: error based on law and Article 80 One, Two and Six of the Provincial Tax Law of VAT
R2Rectified invoice: error based on law and Article 80 Three of the Provincial Tax Law of VAT
R3Rectified invoice: error based on law and Article 80 Four of the Provincial Tax Law of VAT
R4Rectified invoice: Other
R5Rectified invoice: simplified invoices

TicketBAI VAT Regime Key

Identifies the VAT regime or operation classification applied to the transaction. Maps to the ClaveRegimenIvaOpTrascendencia field, with values taken from the TicketBAI XSD. The regime code is normally assigned per tax combo. If no regime code is provided, GOBL will try to assign a code from the following contexts:
Combo ContextRegime Code
Category IGIC08
Key export02
Has surcharge51
Otherwise01
CodeName
01General regime operation
02Export
03Special regime for used goods, art objects, antiques and collectibles
04Special regime for investment gold
05Special regime for travel agencies
06Special regime for VAT groups (Advanced Level)
07Special cash accounting regime
08Operations subject to IPSI/IGIC
09Billing of travel agency services acting as mediators in name and on behalf of others
10Collection of professional fees or industrial property rights on behalf of third parties
11Business premises rental operations subject to withholding
12Business premises rental operations not subject to withholding
13Business premises rental operations, both subject and not subject to withholding
14Invoice with pending VAT accrual in work certifications for Public Administration
15Invoice with pending VAT accrual in successive tract operations
17Operation under OSS or IOSS regimes
51Operations under the equivalence surcharge regime
52Operations under the simplified VAT regime
53Operations carried out by or for entities without a permanent establishment

Activity Code (Bizkaia)

Economic activity code (epígrafe) for individual issuers submitting through Bizkaia’s LROE Modelo 140 register. Not required for organisations, who file through Modelo 240.
Pattern: ^\d{1,7}$

Identity Type Code

Identity code used to identify the type of identity document used by the customer when there is no tax identifier available. Maps to the IDType value under IDOtro in the TicketBAI XML. The regular Party Tax Identity is preferred over using a specific identity type code, and will be mapped automatically as follows:
  • Spanish Tax IDs will be mapped to the NIF field.
  • EU Tax IDs will be mapped to the IDOtro field with code 02.
  • Non-EU Tax IDs will be mapped to the IDOtro field with code 04.
The following identity key values will be mapped automatically to an extension by the addon:
Identity KeyExtension Code
passport03
foreign04
resident05
other06
Example identity of a UK passport:
{
	"identities": [
		{
			"key": "passport",
			"country": "GB",
			"code": "123456789"
		}
	]
}
Will be normalized to:
{
	"identities": [
		{
			"key": "passport",
			"country": "GB",
			"code": "123456789",
			"ext": {
				"es-tbai-identity-type": "03"
			}
		}
	]
}
CodeName
02NIF-VAT Identity (VIES)
03Passport
04Foreign Identity Document
05Residential Certificate
06Other Identity Document

TicketBAI Simplified Invoice Flag

Flag that maps to the FacturaSimplificada field in TicketBAI documents. Set automatically to S by GOBL during normalization when the simplified tag is present. When absent, the invoice is treated as N (not simplified).
CodeName
SYes
NNo

Validation Rules

FieldTestValidation Code / Message
Invoice
  • Can convert to [EUR]
GOBL-ES-TBAI-BILL-INVOICE-09
Invoice must be in EUR or provide exchange rate for conversion
tax
  • Present
GOBL-ES-TBAI-BILL-INVOICE-01
Invoice tax is required
tax.ext
  • Ext require [es-tbai-region]
GOBL-ES-TBAI-BILL-INVOICE-02
Invoice tax extension ‘es-tbai-region’ is required
customer
  • Non-simplified
  • Present
GOBL-ES-TBAI-BILL-INVOICE-03
Invoice customer is required for non-simplified invoices
customer
  • Non-simplified
  • Has tax_id or identity-type identity
GOBL-ES-TBAI-BILL-INVOICE-08
Invoice customer must have a tax_id or an identity with ext ‘es-tbai-identity-type’
preceding
  • Invoice type in [credit-note, corrective, debit-note]
  • Present
GOBL-ES-TBAI-BILL-INVOICE-04
Invoice preceding documents are required for credit-note, corrective, debit-note invoices
preceding[*].issue_date
  • Present
GOBL-ES-TBAI-BILL-INVOICE-05
Invoice preceding issue date is required
preceding[*].ext
  • Ext require [es-tbai-correction]
GOBL-ES-TBAI-BILL-INVOICE-06
Invoice preceding ext ‘es-tbai-correction’ is required
notes
  • Has general note
GOBL-ES-TBAI-BILL-INVOICE-07
Invoice must have a note with key ‘general’
supplier.ext
  • Bizkaia individual
  • Ext require [es-tbai-bi-activity]
GOBL-ES-TBAI-BILL-INVOICE-10
Invoice supplier extension ‘es-tbai-bi-activity’ is required for Bizkaia individuals
supplier.ext
  • Ext ‘es-tbai-bi-activity’ matches pattern ’^\d$‘
GOBL-ES-TBAI-BILL-INVOICE-11
Invoice supplier extension ‘es-tbai-bi-activity’ must be a valid Bizkaia activity code (epígrafe)
FieldTestValidation Code / Message
ext
  • Exempt vat/igic
  • Ext require [es-tbai-exemption]
GOBL-ES-TBAI-TAX-COMBO-01
Extension ‘es-tbai-exemption’ is required for exempt tax combos