Invoices
Issuing an invoice validates its contents, assigns the next series number, resolves taxes and stores the finished document in one operation. An issued invoice cannot be edited.
To correct an issued invoice, create an amendment. FiscalRail keeps the original immutable, issues the required full credit note and optional replacement atomically, and links every document through the same amendment object. Both generated documents persist the original as preceding_invoice, so each remains self-describing independently of the amendment lookup. A document can be amended once; apply any later change to its replacement. Use issued_by_mistake only when the underlying operation never happened; it voids the original without issuing another invoice.
Read Correcting invoices for the reason-selection workflow, generated documents and retry strategy.
Supply an optional Idempotency-Key header when issuing an invoice if the request might need to be retried. See Idempotency.
Use supply_period when the supply date differs from the issue date or the invoice covers a range. Set start_date and end_date to the same value for a single day. The top-level issue_date belongs to the document being returned; preceding_invoice.issue_date identifies the corrected document.
lines[].description describes the goods or services supplied. For structured regimes such as Spain, FiscalRail resolves each lines[].taxes[].description from the selected tax and rule. Custom taxes under the global regime require the tax description in the request.
Under the global regime, a customer snapshot may have a null address. Spanish ordinary invoices require the customer's address; issuance fails with a customer.address validation error if the selected customer does not have one.
The Invoice object
id
string
object
string
invoice.live
boolean
account
string
kind
enum
invoice
credit_note
code
string
series
string
issue_date
string
supply_period
object or null
Show child propertiesHide child properties
start_date
string
end_date
string
preceding_invoice
object or null
Show child propertiesHide child properties
id
string or null
code
string
issue_date
string
currency
string
EUR.supplier
object
Show child propertiesHide child properties
source
object
Show child propertiesHide child properties
type
enum
account
The account that supplied the issuer details.
customer
The customer that supplied the recipient details.
id
string
type.name
string
tax_id
object
Show child propertiesHide child properties
country
string
type
string
value
string
email
string or null
phone
string or null
address
object or null
Show child propertiesHide child properties
line_1
string
line_2
string or null
city
string
postal_code
string
state
string or null
country
string
customer
object or null
Show child propertiesHide child properties
source
object
Show child propertiesHide child properties
type
enum
account
The account that supplied the issuer details.
customer
The customer that supplied the recipient details.
id
string
type.name
string
tax_id
object
Show child propertiesHide child properties
country
string
type
string
value
string
email
string or null
phone
string or null
address
object or null
Show child propertiesHide child properties
line_1
string
line_2
string or null
city
string
postal_code
string
state
string or null
country
string
lines
array of objects
Show child propertiesHide child properties
index
integer
description
string
quantity
string
unit_price
string
subtotal
string
taxes
array of objects
Show child propertiesHide child properties
tax
string
rule
string
effect
enum
added
The tax amount is added to the invoice total.
withheld
The tax amount is withheld from the amount payable to the supplier.
treatment
enum
taxable
Tax applies to the line at the stated rate.
exempt
The line is exempt from the tax.
reverse_charge
The customer accounts for the tax under reverse charge.
not_subject
The line is outside the scope of the tax.
description
string
rate
string or null
taxable_base
string
tax_totals
array of objects
Show child propertiesHide child properties
tax
string
rule
string
effect
enum
added
The tax amount is added to the invoice total.
withheld
The tax amount is withheld from the amount payable to the supplier.
treatment
enum
taxable
Tax applies to the line at the stated rate.
exempt
The line is exempt from the tax.
reverse_charge
The customer accounts for the tax under reverse charge.
not_subject
The line is outside the scope of the tax.
description
string
rate
string or null
taxable_base
string
amount
string
totals
object
Show child propertiesHide child properties
subtotal
string
tax
string
total_with_tax
string
withheld_tax
string
payable
string
created_at
string
tax_regime
object
Show child propertiesHide child properties
key
string
global.key
string
es.es
object
Show child propertiesHide child properties
qr
object
Show child propertiesHide child properties
content
string
image_url
string
verifactu
object
Show child propertiesHide child properties
registrations
array of objects
Show child propertiesHide child properties
id
string
object
string
verifactu_registration.live
boolean
invoice
string
kind
enum
alta
Registers a newly issued invoice.
anulacion
Cancels the registration of an invoice issued by mistake.
status
enum
pending
The registration is queued, being submitted, or awaiting a retry.
accepted
AEAT accepted the registration without errors.
accepted_with_errors
AEAT accepted the registration but reported issues that may require review.
rejected
AEAT rejected the registration.
submitted_at
string or null
csv
string or null
error
object or null
amendments
array of objects
Show child propertiesHide child properties
id
string
object
string
invoice_amendment.live
boolean
reason
enum
refund
Fully credits the original; provide a lower-value replacement for a partial refund.
discount
Fully credits the original; provide a lower-value replacement with unchanged quantities and tax treatment.
incorrect_customer_details
Replaces customer details while preserving the customer identity, lines and totals.
incorrect_lines
Replaces the lines while preserving the customer and tax treatment.
incorrect_tax
Replaces tax treatment or rates while preserving the customer and non-tax line details.
customer_identification
Adds or replaces customer tax identity while preserving lines and totals.
issued_by_mistake
Voids an invoice for an operation that never happened; no credit note or replacement is issued.
original
object
Show child propertiesHide child properties
id
string or null
code
string
issue_date
string
credit_note
object or null
Show child propertiesHide child properties
id
string or null
code
string
issue_date
string
replacement
object or null
Show child propertiesHide child properties
id
string or null
code
string
issue_date
string
created_at
string
{
"id": "inv_14Vxtqg6oXpAY5WdWoq4wW",
"object": "invoice",
"live": true,
"account": "acct_14Vxtqg2nwvPR75TpsGH8N",
"kind": "invoice",
"code": "INV-00001",
"series": "inv_ser_14Vxtqg4QFd6rL8cUoK3sZ",
"issue_date": "2026-07-31",
"supply_period": null,
"preceding_invoice": null,
"currency": "EUR",
"supplier": {
"source": {
"type": "account",
"id": "acct_14Vxtqg2nwvPR75TpsGH8N"
},
"name": "Example supplier",
"tax_id": {
"country": "ES",
"type": "es_nif",
"value": "B02850360"
},
"email": null,
"phone": null,
"address": {
"line_1": "Example street 1",
"line_2": null,
"city": "Madrid",
"postal_code": "28001",
"state": null,
"country": "ES"
}
},
"customer": {
"source": {
"type": "customer",
"id": "cus_14Vxtqg6oXpAY5WdWoq4wW"
},
"name": "Acme SL",
"tax_id": {
"country": "ES",
"type": "es_nif",
"value": "B87654323"
},
"email": "billing@example.com",
"phone": null,
"address": {
"line_1": "Gran Via 1",
"line_2": null,
"city": "Madrid",
"postal_code": "28013",
"state": "Madrid",
"country": "ES"
}
},
"lines": [
{
"index": 1,
"description": "Consulting",
"quantity": "8.0",
"unit_price": "75.00",
"subtotal": "600.00",
"taxes": [
{
"tax": "vat",
"rule": "general",
"effect": "added",
"treatment": "taxable",
"description": "IVA 21%",
"rate": "21%",
"taxable_base": "600.00"
}
]
}
],
"tax_totals": [
{
"tax": "vat",
"rule": "general",
"effect": "added",
"treatment": "taxable",
"description": "IVA 21%",
"rate": "21%",
"taxable_base": "600.00",
"amount": "126.00"
}
],
"totals": {
"subtotal": "600.00",
"tax": "126.00",
"total_with_tax": "726.00",
"withheld_tax": "0.00",
"payable": "726.00"
},
"created_at": "2026-07-31T09:30:00Z",
"amendments": [],
"tax_regime": {
"key": "es",
"es": {
"qr": {
"content": "https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?nif=B02850360&numserie=INV-00001&fecha=31-07-2026&importe=726.00",
"image_url": "https://api.fiscalrail.com/v1/invoices/inv_14Vxtqg6oXpAY5WdWoq4wW/qr.svg?signature=example"
},
"verifactu": {
"registrations": [
{
"id": "es_inv_reg_14Vxtqg8mKp2Rs7Dc4Hn6Y",
"object": "verifactu_registration",
"live": true,
"invoice": "inv_14Vxtqg6oXpAY5WdWoq4wW",
"kind": "alta",
"status": "accepted",
"submitted_at": "2026-07-31T09:30:03Z",
"csv": "ABCD1234",
"error": null
}
]
}
}
}
}
The Invoice Amendment object
id
string
object
string
invoice_amendment.live
boolean
reason
enum
refund
Fully credits the original; provide a lower-value replacement for a partial refund.
discount
Fully credits the original; provide a lower-value replacement with unchanged quantities and tax treatment.
incorrect_customer_details
Replaces customer details while preserving the customer identity, lines and totals.
incorrect_lines
Replaces the lines while preserving the customer and tax treatment.
incorrect_tax
Replaces tax treatment or rates while preserving the customer and non-tax line details.
customer_identification
Adds or replaces customer tax identity while preserving lines and totals.
issued_by_mistake
Voids an invoice for an operation that never happened; no credit note or replacement is issued.
original
object
Show child propertiesHide child properties
id
string or null
code
string
issue_date
string
credit_note
object or null
Show child propertiesHide child properties
id
string or null
code
string
issue_date
string
replacement
object or null
Show child propertiesHide child properties
id
string or null
code
string
issue_date
string
created_at
string
{
"id": null,
"object": "invoice_amendment",
"live": null,
"reason": null,
"original": {
"id": null,
"code": null,
"issue_date": null
},
"credit_note": {
"id": null,
"code": null,
"issue_date": null
},
"replacement": {
"id": null,
"code": null,
"issue_date": null
},
"created_at": null
}
Issue an invoice
/v1/invoicesAtomically validates, numbers and issues an immutable invoice. Omit
customer to issue a simplified invoice. For Spanish accounts, its total
including VAT cannot exceed 400.00 EUR. Spanish accounts resolve tax
references from tax and rule; supplied resolved tax fields are not
authoritative. A Spanish ordinary invoice requires the selected customer
to have an address. Global invoices may snapshot a null customer address.
Supply an optional Idempotency-Key to make retries safe.
Idempotency-Key
string
customer
object or null
series
string
issue_date
string
supply_period
object
Show child propertiesHide child properties
start_date
string
required
end_date
string
required
start_date.lines
array of objects
required
Show child propertiesHide child properties
description
string
required
quantity
number or string
1.unit_price
number or string
required
taxes
array of objects
required
tax and rule values when available.Show child propertiesHide child properties
tax
string
required
vat.rule
string
required
general.effect
enum
added
The tax amount is added to the invoice total.
withheld
The tax amount is withheld from the amount payable to the supplier.
treatment
enum
taxable
Tax applies to the line at the supplied rate.
exempt
The line is exempt from the tax.
reverse_charge
The customer accounts for the tax under reverse charge.
not_subject
The line is outside the scope of the tax.
description
string
rate
number or string
taxable_base
number or string
201
An Invoice object.
JSON
curl --request POST \
'https://api.fiscalrail.com/v1/invoices' \
--header "Authorization: Bearer ak_test_..." \
--header "Idempotency-Key: 2f294ef2-9a60-4c7e-a573-5e18fa8348e2" \
--json '{
"customer": "cus_14Vxtqg6oXpAY5WdWoq4wW",
"lines": [
{
"description": "Consulting",
"quantity": "8",
"unit_price": "75.00",
"taxes": [
{
"tax": "vat",
"rule": "general"
}
]
}
]
}'
{
"id": "inv_14Vxtqg6oXpAY5WdWoq4wW",
"object": "invoice",
"live": true,
"account": "acct_14Vxtqg2nwvPR75TpsGH8N",
"kind": "invoice",
"code": "INV-00001",
"series": "inv_ser_14Vxtqg4QFd6rL8cUoK3sZ",
"issue_date": "2026-07-31",
"supply_period": null,
"preceding_invoice": null,
"currency": "EUR",
"supplier": {
"source": {
"type": "account",
"id": "acct_14Vxtqg2nwvPR75TpsGH8N"
},
"name": "Example supplier",
"tax_id": {
"country": "ES",
"type": "es_nif",
"value": "B02850360"
},
"email": null,
"phone": null,
"address": {
"line_1": "Example street 1",
"line_2": null,
"city": "Madrid",
"postal_code": "28001",
"state": null,
"country": "ES"
}
},
"customer": {
"source": {
"type": "customer",
"id": "cus_14Vxtqg6oXpAY5WdWoq4wW"
},
"name": "Acme SL",
"tax_id": {
"country": "ES",
"type": "es_nif",
"value": "B87654323"
},
"email": "billing@example.com",
"phone": null,
"address": {
"line_1": "Gran Via 1",
"line_2": null,
"city": "Madrid",
"postal_code": "28013",
"state": "Madrid",
"country": "ES"
}
},
"lines": [
{
"index": 1,
"description": "Consulting",
"quantity": "8.0",
"unit_price": "75.00",
"subtotal": "600.00",
"taxes": [
{
"tax": "vat",
"rule": "general",
"effect": "added",
"treatment": "taxable",
"description": "IVA 21%",
"rate": "21%",
"taxable_base": "600.00"
}
]
}
],
"tax_totals": [
{
"tax": "vat",
"rule": "general",
"effect": "added",
"treatment": "taxable",
"description": "IVA 21%",
"rate": "21%",
"taxable_base": "600.00",
"amount": "126.00"
}
],
"totals": {
"subtotal": "600.00",
"tax": "126.00",
"total_with_tax": "726.00",
"withheld_tax": "0.00",
"payable": "726.00"
},
"created_at": "2026-07-31T09:30:00Z",
"amendments": [],
"tax_regime": {
"key": "es",
"es": {
"qr": {
"content": "https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?nif=B02850360&numserie=INV-00001&fecha=31-07-2026&importe=726.00",
"image_url": "https://api.fiscalrail.com/v1/invoices/inv_14Vxtqg6oXpAY5WdWoq4wW/qr.svg?signature=example"
},
"verifactu": {
"registrations": [
{
"id": "es_inv_reg_14Vxtqg8mKp2Rs7Dc4Hn6Y",
"object": "verifactu_registration",
"live": true,
"invoice": "inv_14Vxtqg6oXpAY5WdWoq4wW",
"kind": "alta",
"status": "accepted",
"submitted_at": "2026-07-31T09:30:03Z",
"csv": "ABCD1234",
"error": null
}
]
}
}
}
}
Amend or void an invoice
/v1/invoices/{invoice_id}/amendmentsAtomically records an amendment and issues the required immutable
documents. Most reasons fully credit the original and optionally issue
a replacement. issued_by_mistake creates no invoice and, for Spanish
accounts, sends a VERI*FACTU cancellation record. Supply an optional
Idempotency-Key to make retries safe. A document can be amended once;
apply any later amendment to its replacement invoice.
invoice_id
string
required
Idempotency-Key
string
reason
enum
required
refund
Fully credits the original; provide a lower-value replacement for a partial refund.
discount
Fully credits the original; provide a lower-value replacement with unchanged quantities and tax treatment.
incorrect_customer_details
Replaces customer details while preserving the customer identity, lines and totals.
incorrect_lines
Replaces the lines while preserving the customer and tax treatment.
incorrect_tax
Replaces tax treatment or rates while preserving the customer and non-tax line details.
customer_identification
Adds or replaces customer tax identity while preserving lines and totals.
issued_by_mistake
Voids an invoice for an operation that never happened; no credit note or replacement is issued.
replacement
object
issued_by_mistake.Show child propertiesHide child properties
customer
object or null
series
string
issue_date
string
supply_period
object
Show child propertiesHide child properties
start_date
string
required
end_date
string
required
start_date.lines
array of objects
required
Show child propertiesHide child properties
description
string
required
quantity
number or string
1.unit_price
number or string
required
taxes
array of objects
required
tax and rule values when available.Show child propertiesHide child properties
tax
string
required
vat.rule
string
required
general.effect
enum
added
The tax amount is added to the invoice total.
withheld
The tax amount is withheld from the amount payable to the supplier.
treatment
enum
taxable
Tax applies to the line at the supplied rate.
exempt
The line is exempt from the tax.
reverse_charge
The customer accounts for the tax under reverse charge.
not_subject
The line is outside the scope of the tax.
description
string
rate
number or string
taxable_base
number or string
201
An Invoice Amendment object.
JSON
curl --request POST \
'https://api.fiscalrail.com/v1/invoices/inv_14Vxtqg6oXpAY5WdWoq4wW/amendments' \
--header "Authorization: Bearer ak_test_..." \
--header "Idempotency-Key: 2f294ef2-9a60-4c7e-a573-5e18fa8348e2" \
--json '{
"reason": "discount",
"replacement": {
"customer": "cus_14Vxtqg6oXpAY5WdWoq4wW",
"lines": [
{
"description": "Consulting",
"quantity": "8",
"unit_price": "70.00",
"taxes": [
{
"tax": "vat",
"rule": "general"
}
]
}
]
}
}'
{
"id": null,
"object": "invoice_amendment",
"live": null,
"reason": null,
"original": {
"id": null,
"code": null,
"issue_date": null
},
"credit_note": {
"id": null,
"code": null,
"issue_date": null
},
"replacement": {
"id": null,
"code": null,
"issue_date": null
},
"created_at": null
}
Retrieve an invoice
/v1/invoices/{id}Returns an issued invoice by its opaque ID. The returned document is an immutable snapshot.
id
string
required
200
An Invoice object.
JSON
curl --request GET \
'https://api.fiscalrail.com/v1/invoices/inv_14Vxtqg6oXpAY5WdWoq4wW' \
--header "Authorization: Bearer ak_test_..."
{
"id": "inv_14Vxtqg6oXpAY5WdWoq4wW",
"object": "invoice",
"live": true,
"account": "acct_14Vxtqg2nwvPR75TpsGH8N",
"kind": "invoice",
"code": "INV-00001",
"series": "inv_ser_14Vxtqg4QFd6rL8cUoK3sZ",
"issue_date": "2026-07-31",
"supply_period": null,
"preceding_invoice": null,
"currency": "EUR",
"supplier": {
"source": {
"type": "account",
"id": "acct_14Vxtqg2nwvPR75TpsGH8N"
},
"name": "Example supplier",
"tax_id": {
"country": "ES",
"type": "es_nif",
"value": "B02850360"
},
"email": null,
"phone": null,
"address": {
"line_1": "Example street 1",
"line_2": null,
"city": "Madrid",
"postal_code": "28001",
"state": null,
"country": "ES"
}
},
"customer": {
"source": {
"type": "customer",
"id": "cus_14Vxtqg6oXpAY5WdWoq4wW"
},
"name": "Acme SL",
"tax_id": {
"country": "ES",
"type": "es_nif",
"value": "B87654323"
},
"email": "billing@example.com",
"phone": null,
"address": {
"line_1": "Gran Via 1",
"line_2": null,
"city": "Madrid",
"postal_code": "28013",
"state": "Madrid",
"country": "ES"
}
},
"lines": [
{
"index": 1,
"description": "Consulting",
"quantity": "8.0",
"unit_price": "75.00",
"subtotal": "600.00",
"taxes": [
{
"tax": "vat",
"rule": "general",
"effect": "added",
"treatment": "taxable",
"description": "IVA 21%",
"rate": "21%",
"taxable_base": "600.00"
}
]
}
],
"tax_totals": [
{
"tax": "vat",
"rule": "general",
"effect": "added",
"treatment": "taxable",
"description": "IVA 21%",
"rate": "21%",
"taxable_base": "600.00",
"amount": "126.00"
}
],
"totals": {
"subtotal": "600.00",
"tax": "126.00",
"total_with_tax": "726.00",
"withheld_tax": "0.00",
"payable": "726.00"
},
"created_at": "2026-07-31T09:30:00Z",
"amendments": [],
"tax_regime": {
"key": "es",
"es": {
"qr": {
"content": "https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?nif=B02850360&numserie=INV-00001&fecha=31-07-2026&importe=726.00",
"image_url": "https://api.fiscalrail.com/v1/invoices/inv_14Vxtqg6oXpAY5WdWoq4wW/qr.svg?signature=example"
},
"verifactu": {
"registrations": [
{
"id": "es_inv_reg_14Vxtqg8mKp2Rs7Dc4Hn6Y",
"object": "verifactu_registration",
"live": true,
"invoice": "inv_14Vxtqg6oXpAY5WdWoq4wW",
"kind": "alta",
"status": "accepted",
"submitted_at": "2026-07-31T09:30:03Z",
"csv": "ABCD1234",
"error": null
}
]
}
}
}
}
List invoices
/v1/invoicesReturns issued invoices in reverse chronological ID order. Use only
one cursor parameter at a time.
q
string
customer
string
issue_date_from
string
issue_date_to
string
limit
integer
25.starting_after
string
ending_before
string
200
A list of Invoice objects.
JSON
curl --request GET \
'https://api.fiscalrail.com/v1/invoices?limit=25' \
--header "Authorization: Bearer ak_test_..."
{
"object": "list",
"has_more": null,
"data": [
{
"id": "inv_14Vxtqg6oXpAY5WdWoq4wW",
"object": "invoice",
"live": true,
"account": "acct_14Vxtqg2nwvPR75TpsGH8N",
"kind": "invoice",
"code": "INV-00001",
"series": "inv_ser_14Vxtqg4QFd6rL8cUoK3sZ",
"issue_date": "2026-07-31",
"supply_period": null,
"preceding_invoice": null,
"currency": "EUR",
"supplier": {
"source": {
"type": "account",
"id": "acct_14Vxtqg2nwvPR75TpsGH8N"
},
"name": "Example supplier",
"tax_id": {
"country": "ES",
"type": "es_nif",
"value": "B02850360"
},
"email": null,
"phone": null,
"address": {
"line_1": "Example street 1",
"line_2": null,
"city": "Madrid",
"postal_code": "28001",
"state": null,
"country": "ES"
}
},
"customer": {
"source": {
"type": "customer",
"id": "cus_14Vxtqg6oXpAY5WdWoq4wW"
},
"name": "Acme SL",
"tax_id": {
"country": "ES",
"type": "es_nif",
"value": "B87654323"
},
"email": "billing@example.com",
"phone": null,
"address": {
"line_1": "Gran Via 1",
"line_2": null,
"city": "Madrid",
"postal_code": "28013",
"state": "Madrid",
"country": "ES"
}
},
"lines": [
{
"index": 1,
"description": "Consulting",
"quantity": "8.0",
"unit_price": "75.00",
"subtotal": "600.00",
"taxes": [
{
"tax": "vat",
"rule": "general",
"effect": "added",
"treatment": "taxable",
"description": "IVA 21%",
"rate": "21%",
"taxable_base": "600.00"
}
]
}
],
"tax_totals": [
{
"tax": "vat",
"rule": "general",
"effect": "added",
"treatment": "taxable",
"description": "IVA 21%",
"rate": "21%",
"taxable_base": "600.00",
"amount": "126.00"
}
],
"totals": {
"subtotal": "600.00",
"tax": "126.00",
"total_with_tax": "726.00",
"withheld_tax": "0.00",
"payable": "726.00"
},
"created_at": "2026-07-31T09:30:00Z",
"amendments": [],
"tax_regime": {
"key": "es",
"es": {
"qr": {
"content": "https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?nif=B02850360&numserie=INV-00001&fecha=31-07-2026&importe=726.00",
"image_url": "https://api.fiscalrail.com/v1/invoices/inv_14Vxtqg6oXpAY5WdWoq4wW/qr.svg?signature=example"
},
"verifactu": {
"registrations": [
{
"id": "es_inv_reg_14Vxtqg8mKp2Rs7Dc4Hn6Y",
"object": "verifactu_registration",
"live": true,
"invoice": "inv_14Vxtqg6oXpAY5WdWoq4wW",
"kind": "alta",
"status": "accepted",
"submitted_at": "2026-07-31T09:30:03Z",
"csv": "ABCD1234",
"error": null
}
]
}
}
}
}
]
}