> ## Documentation Index
> Fetch the complete documentation index at: https://invopop-link-fix.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Facturae guide

> Generate Facturae XML invoices for B2G in Spain.

export const esFacturaeWorkflow = {
  "name": "Facturae generate invoice",
  "description": "Generate a Facturae XML invoice",
  "schema": "bill/invoice",
  "steps": [{
    "id": "dc2d4780-0be4-11f1-99f1-2d47ed7bc202",
    "name": "Add sequential code",
    "provider": "sequence.enumerate",
    "summary": "Dynamic · Facturae · 000001",
    "config": {
      "name": "Facturae",
      "padding": 6,
      "start": 1
    }
  }, {
    "id": "e2d8e3f0-0be4-11f1-99f1-2d47ed7bc202",
    "name": "Sign envelope",
    "provider": "silo.close"
  }, {
    "id": "ef9897c0-0be4-11f1-99f1-2d47ed7bc202",
    "name": "Generate Facturae XML",
    "provider": "gov-es.facturae.generate"
  }],
  "rescue": []
};

export const WorkflowDiagram = ({workflow}) => {
  const stateColors = {
    processing: "yellow",
    sent: "blue",
    received: "blue",
    registered: "green",
    completed: "green",
    error: "red"
  };
  const StateChip = ({state, label}) => <Badge size="sm" color={stateColors[state] || "gray"} icon="square-small" iconType="solid">
      {label.charAt(0).toUpperCase() + label.slice(1)}
    </Badge>;
  const providerIcons = {
    "silo.state": "https://silo.invopop.com/images/status.svg",
    "silo.close": "https://silo.invopop.com/images/check-badge.svg",
    "silo.if": "https://assets.invopop.com/apps/silo/if.svg",
    "silo.folder": "https://silo.invopop.com/images/folder.svg",
    "silo.modify": "https://silo.invopop.com/images/modify.svg",
    "silo.correct": "https://silo.invopop.com/images/replace.svg",
    "silo.sleep": "https://assets.invopop.com/icons/sleep.svg",
    silo: "https://assets.invopop.com/apps/silo/icon.svg",
    "sequence.enumerate": "https://sequence.invopop.com/images/enumerate.svg",
    "transform.job.create": "https://transform.invopop.com/images/jobs.svg",
    webhook: "https://webhook.invopop.com/icon.svg",
    lookup: "https://lookup.invopop.com/icon.png",
    dropbox: "https://dropbox.invopop.com/icon.png",
    pdf: "https://pdf.invopop.com/file-pdf.svg",
    peppol: "https://assets.invopop.com/apps/peppol/icon.svg",
    ubl: "https://assets.invopop.com/apps/ubl/logo.svg",
    cii: "https://assets.invopop.com/apps/cii/logo.svg",
    "gov-fr": "https://assets.invopop.com/flags/fr.svg",
    "chorus-pro": "https://assets.invopop.com/apps/chroruspro/icon.svg",
    "gov-es": "https://assets.invopop.com/apps/gov-es/icon.svg",
    "gov-es.sii": "https://assets.invopop.com/apps/sii/icon.svg",
    "gov-es.ticketbai": "https://assets.invopop.com/apps/ticketbai/icon.svg",
    "gov-es.facturae": "https://assets.invopop.com/apps/facturae/icon.svg",
    verifactu: "https://assets.invopop.com/apps/verifactu/icon.svg",
    "gov-pl": "https://assets.invopop.com/apps/ksef/icon.svg",
    "gov-sa": "https://assets.invopop.com/apps/zatca/icon.svg",
    "gov-ar": "https://assets.invopop.com/apps/arca/icon.svg",
    "at-pt": "https://assets.invopop.com/apps/at-pt/icon.svg",
    "sat-mx": "https://assets.invopop.com/apps/sat-mexico/icon.svg",
    "sw-sapien": "https://assets.invopop.com/apps/sw-sapien/icon.svg",
    "sdi-it": "https://assets.invopop.com/apps/sdi-italy/icon.svg",
    "ticket-it": "https://assets.invopop.com/apps/agenzia-entrate/icon.svg",
    "nfe-br": "https://assets.invopop.com/apps/notas-fiscais-eletronicas-brazil/icon.svg",
    chargebee: "https://assets.invopop.com/apps/chargebee/icon.svg",
    stripe: "https://assets.invopop.com/apps/stripe/icon.svg",
    email: "https://assets.invopop.com/apps/email/icon.svg",
    cron: "https://assets.invopop.com/apps/cron/icon.svg",
    ilyda: "https://assets.invopop.com/apps/ilyda/icon.svg",
    invoicexpress: "https://assets.invopop.com/apps/invoicexpress/icon.svg",
    plemsi: "https://assets.invopop.com/flags/co.svg"
  };
  const iconFor = provider => {
    const parts = (provider || "").split(".");
    for (let i = parts.length; i > 0; i--) {
      const url = providerIcons[parts.slice(0, i).join(".")];
      if (url) return url;
    }
    return null;
  };
  const StepIcon = ({provider}) => {
    const url = iconFor(provider);
    return <span title={provider} className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-gray-950/10 bg-white dark:border-white/10 dark:bg-white/5">
        {url ? <img src={url} alt="" className="h-4 w-4" /> : null}
      </span>;
  };
  const renderSummary = summary => {
    const nodes = [];
    const re = /`([^`]+)`(\{[^}]*\})?/g;
    let last = 0;
    let m;
    let k = 0;
    while ((m = re.exec(summary)) !== null) {
      if (m.index > last) nodes.push(summary.slice(last, m.index));
      const attrs = m[2] || "";
      if (attrs.indexOf(".state") >= 0) {
        const state = (attrs.match(/\.state\s+\.([\w-]+)/) || [])[1] || m[1];
        nodes.push(<StateChip key={k++} state={state} label={m[1]} />);
      } else if (attrs) {
        nodes.push(<span key={k++} className="text-sm font-medium text-gray-700 dark:text-gray-300">
            {m[1]}
          </span>);
      } else {
        nodes.push(<code key={k++} className="text-sm rounded bg-gray-100 px-1 font-mono text-sm dark:bg-white/10">
            {m[1]}
          </code>);
      }
      last = m.index + m[0].length;
    }
    if (last < summary.length) nodes.push(summary.slice(last));
    return nodes;
  };
  const NoteRow = ({text}) => <div className="mt-4 mb-1 font-mono text-sm leading-5 text-gray-400 dark:text-gray-500">{"// " + text}</div>;
  const renderSteps = (steps, counter) => (steps || []).map(step => {
    counter.n += 1;
    const n = counter.n;
    const branches = (step.next || []).filter(b => b.steps && b.steps.length > 0);
    return <div key={step.id || "step-" + n}>
          {step.notes ? <NoteRow text={step.notes} /> : null}
          <div className="mt-2.5 flex items-center">
            <span className="absolute left-0 w-10 text-center font-mono text-sm text-gray-400 select-none dark:text-gray-500">
              {n}
            </span>
            <div className="flex min-w-0 flex-1 items-center gap-2 rounded-xl border border-gray-950/5 bg-white px-2 py-2 dark:border-white/10 dark:bg-gray-900">
              <StepIcon provider={step.provider} />
              <span className="text-sm shrink-0 font-medium text-gray-900 dark:text-gray-100">{step.name}</span>
              {step.summary ? <span className="text-sm min-w-0 truncate text-gray-500 dark:text-gray-400">{renderSummary(step.summary)}</span> : null}
            </div>
          </div>
          {branches.length > 0 ? <div className="ml-5 border-l border-gray-200 -my-1 py-1 pl-6 dark:border-white/10">
              {branches.map((branch, bi) => <div key={branch.code || branch.status || bi}>
                  <div className="mt-4">
                    <span className="rounded-md bg-gray-200/70 px-2 py-1 font-mono text-sm text-gray-600 dark:bg-white/10 dark:text-gray-300">
                      {branch.code || branch.status}
                    </span>
                  </div>
                  {renderSteps(branch.steps, counter)}
                </div>)}
            </div> : null}
        </div>;
  });
  const counter = {
    n: 0
  };
  const wf = workflow || ({});
  return <div className="not-prose relative my-5 rounded-2xl border border-gray-950/5 bg-gray-50 py-3 pr-4 pb-5 pl-12 dark:border-white/10 dark:bg-white/[0.03]">
      {renderSteps(wf.steps, counter)}
      {wf.rescue && wf.rescue.length > 0 ? <div className="mt-6 border-t border-dashed border-gray-300 dark:border-white/10">
          <NoteRow text="If any step fails" />
          {renderSteps(wf.rescue, counter)}
        </div> : null}
    </div>;
};

## Introduction

**Facturae** is Spain's official XML invoice format for **Business-to-Government (B2G)** transactions. The current version is **Facturae 3.2.2**, and invoices are submitted to public administrations through the [FACe](https://face.gob.es/) platform.

Facturae is required when invoicing any Spanish public administration body (central government, regional governments, local councils, etc.). Unlike other Spanish tax reporting systems (VERI\*FACTU, SII), Facturae does not require supplier registration — you simply generate the XML and submit it.

## Prerequisites

To generate Facturae invoices, ensure you have:

* An invoice with:
  * Supplier details (company name, tax ID, full address). Check the [Spanish](https://docs.gobl.org/regimes/es) regime for specifics.
  * Line items with name, price, and applicable taxes.

## Facturae setup

To generate Facturae invoices, follow these instructions in the [Invopop Console](https://console.invopop.com):

<Steps>
  <Step title="Connect the Spain app">
    1. Navigate to **Configuration** → **Apps**.
    2. Locate **Spain** in the app discovery list.
    3. Click **Connect** to activate.

    No additional configuration is needed.
  </Step>

  <Step title="Configure invoice workflow">
    <Card iconType="duotone" title="Facturae Generate Invoice" icon="code-branch" href="https://console.invopop.com/redirect/workflows/new?template=es-facturae" horizontal>
      Add to my workspace →
    </Card>

    <Tabs>
      <Tab title="Workflow">
        <WorkflowDiagram workflow={esFacturaeWorkflow} />
      </Tab>

      <Tab title="Code">
        Copy and paste into a new [Empty Invoice workflow](https://console.invopop.com/redirect/workflows/new?template=empty-invoice) code view.

        ```json Example Facturae invoice workflow theme={null}
        {
            "name": "Facturae generate invoice",
            "description": "Generate a Facturae XML invoice",
            "schema": "bill/invoice",
            "steps": [
                {
                    "id": "dc2d4780-0be4-11f1-99f1-2d47ed7bc202",
                    "name": "Add sequential code",
                    "provider": "sequence.enumerate",
                    "summary": "Dynamic · Facturae · 000001",
                    "config": {
                        "name": "Facturae",
                        "padding": 6,
                        "start": 1
                    }
                },
                {
                    "id": "e2d8e3f0-0be4-11f1-99f1-2d47ed7bc202",
                    "name": "Sign envelope",
                    "provider": "silo.close"
                },
                {
                    "id": "ef9897c0-0be4-11f1-99f1-2d47ed7bc202",
                    "name": "Generate Facturae XML",
                    "provider": "gov-es.facturae.generate"
                }
            ],
            "rescue": []
        }
        ```
      </Tab>
    </Tabs>
  </Step>
</Steps>

## Administrative centers (DIR3 codes)

<Info>
  When invoicing Spanish **public administrations** via FACe, you must include three administrative centers identified by their **DIR3 codes**. Each public body publishes these codes in the [DIR3 directory](https://administracionelectronica.gob.es/ctt/dir3).
</Info>

The three required roles and their corresponding GOBL fields are:

| Facturae Role                            | Code | GOBL Field                                  |
| ---------------------------------------- | ---- | ------------------------------------------- |
| **Oficina Contable** (Accounting Office) | `01` | `customer.identities[]` with `scope: "tax"` |
| **Órgano Gestor** (Managing Body)        | `02` | `delivery.receiver.identities[0]`           |
| **Unidad Tramitadora** (Processing Unit) | `03` | `ordering.buyer.identities[0]`              |

See the FACe example below for a complete invoice with all three administrative centers.

## Running

Use the following example GOBL documents to generate Facturae invoices.

<AccordionGroup>
  <Accordion title="Facturae B2G Invoice">
    A standard Facturae invoice from a Spanish supplier to a Spanish public sector customer.

    Notice:

    * the [`es-facturae-v3`](https://docs.gobl.org/addons/es-facturae-v3) addon is required,
    * the `es-facturae-doc-type` and `es-facturae-invoice-class` tax extensions are set automatically by the addon when the document is built or uploaded — the built version shows the derived values,
    * both supplier and customer must have full address details and valid Spanish tax IDs.

    <CodeGroup>
      ```json Facturae B2G Invoice theme={null}
      {
      	"$schema": "https://gobl.org/draft-0/bill/invoice",
      	"$regime": "ES",
      	"$addons": [
      		"es-facturae-v3"
      	],
      	"code": "TEST01001F",
      	"issue_date": "2021-12-08",
      	"supplier": {
      		"name": "Hypeprop Sl",
      		"alias": "Hypeprop",
      		"tax_id": {
      			"country": "ES",
      			"code": "B23103039"
      		},
      		"people": [
      			{
      				"name": {
      					"given": "Paloma",
      					"surname": "Araujo"
      				}
      			}
      		],
      		"addresses": [
      			{
      				"num": "74",
      				"street": "Campo Real",
      				"locality": "Torrejón De La Calzada",
      				"region": "Madrid",
      				"code": "28023",
      				"country": "ES"
      			}
      		],
      		"emails": [
      			{
      				"addr": "rxazy27xfc@iname.com"
      			}
      		],
      		"telephones": [
      			{
      				"label": "office",
      				"num": "+34910730028"
      			}
      		]
      	},
      	"customer": {
      		"name": "Moniward Sl",
      		"tax_id": {
      			"country": "ES",
      			"code": "B77436020"
      		},
      		"addresses": [
      			{
      				"num": "35",
      				"street": "Plaza Horno",
      				"locality": "Nombela",
      				"region": "Toledo",
      				"code": "45083",
      				"country": "ES"
      			}
      		],
      		"emails": [
      			{
      				"addr": "bfn25xf3p@lycos.co.uk"
      			}
      		]
      	},
      	"lines": [
      		{
      			"quantity": "20",
      			"item": {
      				"name": "Operations and development - day rate",
      				"price": "200.00"
      			},
      			"taxes": [
      				{
      					"cat": "VAT",
      					"rate": "general"
      				}
      			]
      		},
      		{
      			"quantity": "2",
      			"item": {
      				"name": "Additional Overtime",
      				"price": "101.00"
      			},
      			"taxes": [
      				{
      					"cat": "VAT",
      					"rate": "general"
      				}
      			]
      		}
      	],
      	"payment": {
      		"terms": {
      			"key": "due-date",
      			"due_dates": [
      				{
      					"date": "2021-12-30",
      					"percent": "100%"
      				}
      			],
      			"notes": "Some kind of payment term note"
      		},
      		"instructions": {
      			"key": "credit-transfer",
      			"credit_transfer": [
      				{
      					"iban": "ES25 0188 2570 7185 4470 4761",
      					"name": "Bankrandom"
      				}
      			]
      		}
      	},
      	"notes": [
      		{
      			"key": "general",
      			"text": "Thank you for your custom!"
      		}
      	]
      }
      ```

      ```json Built version theme={null}
      {
      	"$schema": "https://gobl.org/draft-0/bill/invoice",
      	"$regime": "ES",
      	"$addons": [
      		"es-facturae-v3"
      	],
      	"type": "standard",
      	"code": "TEST01001F",
      	"issue_date": "2021-12-08",
      	"currency": "EUR",
      	"tax": {
      		"ext": {
      			"es-facturae-doc-type": "FC",
      			"es-facturae-invoice-class": "OO"
      		}
      	},
      	"supplier": {
      		"name": "Hypeprop Sl",
      		"alias": "Hypeprop",
      		"tax_id": {
      			"country": "ES",
      			"code": "B23103039"
      		},
      		"people": [
      			{
      				"name": {
      					"given": "Paloma",
      					"surname": "Araujo"
      				}
      			}
      		],
      		"addresses": [
      			{
      				"num": "74",
      				"street": "Campo Real",
      				"locality": "Torrejón De La Calzada",
      				"region": "Madrid",
      				"code": "28023",
      				"country": "ES"
      			}
      		],
      		"emails": [
      			{
      				"addr": "rxazy27xfc@iname.com"
      			}
      		],
      		"telephones": [
      			{
      				"label": "office",
      				"num": "+34910730028"
      			}
      		]
      	},
      	"customer": {
      		"name": "Moniward Sl",
      		"tax_id": {
      			"country": "ES",
      			"code": "B77436020"
      		},
      		"addresses": [
      			{
      				"num": "35",
      				"street": "Plaza Horno",
      				"locality": "Nombela",
      				"region": "Toledo",
      				"code": "45083",
      				"country": "ES"
      			}
      		],
      		"emails": [
      			{
      				"addr": "bfn25xf3p@lycos.co.uk"
      			}
      		]
      	},
      	"lines": [
      		{
      			"i": 1,
      			"quantity": "20",
      			"item": {
      				"name": "Operations and development - day rate",
      				"price": "200.00"
      			},
      			"sum": "4000.00",
      			"taxes": [
      				{
      					"cat": "VAT",
      					"key": "standard",
      					"rate": "general",
      					"percent": "21.0%"
      				}
      			],
      			"total": "4000.00"
      		},
      		{
      			"i": 2,
      			"quantity": "2",
      			"item": {
      				"name": "Additional Overtime",
      				"price": "101.00"
      			},
      			"sum": "202.00",
      			"taxes": [
      				{
      					"cat": "VAT",
      					"key": "standard",
      					"rate": "general",
      					"percent": "21.0%"
      				}
      			],
      			"total": "202.00"
      		}
      	],
      	"payment": {
      		"terms": {
      			"key": "due-date",
      			"due_dates": [
      				{
      					"date": "2021-12-30",
      					"amount": "5084.42",
      					"percent": "100%"
      				}
      			],
      			"notes": "Some kind of payment term note"
      		},
      		"instructions": {
      			"key": "credit-transfer",
      			"credit_transfer": [
      				{
      					"iban": "ES25 0188 2570 7185 4470 4761",
      					"name": "Bankrandom"
      				}
      			]
      		}
      	},
      	"totals": {
      		"sum": "4202.00",
      		"total": "4202.00",
      		"taxes": {
      			"categories": [
      				{
      					"code": "VAT",
      					"rates": [
      						{
      							"key": "standard",
      							"base": "4202.00",
      							"percent": "21.0%",
      							"amount": "882.42"
      						}
      					],
      					"amount": "882.42"
      				}
      			],
      			"sum": "882.42"
      		},
      		"tax": "882.42",
      		"total_with_tax": "5084.42",
      		"payable": "5084.42"
      	},
      	"notes": [
      		{
      			"key": "general",
      			"text": "Thank you for your custom!"
      		}
      	]
      }
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Facturae Credit Note">
    A corrective invoice (credit note) referencing a previous Facturae invoice.

    Notice:

    * the `type` is set to `credit-note`,
    * a `preceding` entry references the original invoice with the `es-facturae-correction` code,
    * the addon derives the `es-facturae-invoice-class` extension as `OR` (rectificativa) during build — you don't need to set it by hand.

    <CodeGroup>
      ```json Facturae Credit Note theme={null}
      {
      	"$schema": "https://gobl.org/draft-0/bill/invoice",
      	"$regime": "ES",
      	"$addons": [
      		"es-facturae-v3"
      	],
      	"type": "credit-note",
      	"code": "TEST01001R",
      	"issue_date": "2021-12-08",
      	"preceding": [
      		{
      			"type": "standard",
      			"issue_date": "2021-12-08",
      			"code": "TEST01001F",
      			"ext": {
      				"es-facturae-correction": "01"
      			}
      		}
      	],
      	"supplier": {
      		"name": "Hypeprop Sl",
      		"alias": "Hypeprop",
      		"tax_id": {
      			"country": "ES",
      			"code": "B23103039"
      		},
      		"people": [
      			{
      				"name": {
      					"given": "Paloma",
      					"surname": "Araujo"
      				}
      			}
      		],
      		"addresses": [
      			{
      				"num": "74",
      				"street": "Campo Real",
      				"locality": "Torrejón De La Calzada",
      				"region": "Madrid",
      				"code": "28023",
      				"country": "ES"
      			}
      		],
      		"emails": [
      			{
      				"addr": "rxazy27xfc@iname.com"
      			}
      		],
      		"telephones": [
      			{
      				"label": "office",
      				"num": "+34910730028"
      			}
      		]
      	},
      	"customer": {
      		"name": "Moniward Sl",
      		"tax_id": {
      			"country": "ES",
      			"code": "B77436020"
      		},
      		"addresses": [
      			{
      				"num": "35",
      				"street": "Plaza Horno",
      				"locality": "Nombela",
      				"region": "Toledo",
      				"code": "45083",
      				"country": "ES"
      			}
      		],
      		"emails": [
      			{
      				"addr": "bfn25xf3p@lycos.co.uk"
      			}
      		]
      	},
      	"lines": [
      		{
      			"quantity": "20",
      			"item": {
      				"name": "Operations and development - day rate",
      				"price": "200.00"
      			},
      			"taxes": [
      				{
      					"cat": "VAT",
      					"rate": "general"
      				}
      			]
      		},
      		{
      			"quantity": "2",
      			"item": {
      				"name": "Additional Overtime",
      				"price": "101.00"
      			},
      			"taxes": [
      				{
      					"cat": "VAT",
      					"rate": "general"
      				}
      			]
      		}
      	],
      	"notes": [
      		{
      			"key": "general",
      			"text": "Thank you for your custom!"
      		}
      	]
      }
      ```

      ```json Built version theme={null}
      {
      	"$schema": "https://gobl.org/draft-0/bill/invoice",
      	"$regime": "ES",
      	"$addons": [
      		"es-facturae-v3"
      	],
      	"type": "credit-note",
      	"code": "TEST01001R",
      	"issue_date": "2021-12-08",
      	"currency": "EUR",
      	"preceding": [
      		{
      			"type": "standard",
      			"issue_date": "2021-12-08",
      			"code": "TEST01001F",
      			"ext": {
      				"es-facturae-correction": "01"
      			}
      		}
      	],
      	"tax": {
      		"ext": {
      			"es-facturae-doc-type": "FC",
      			"es-facturae-invoice-class": "OR"
      		}
      	},
      	"supplier": {
      		"name": "Hypeprop Sl",
      		"alias": "Hypeprop",
      		"tax_id": {
      			"country": "ES",
      			"code": "B23103039"
      		},
      		"people": [
      			{
      				"name": {
      					"given": "Paloma",
      					"surname": "Araujo"
      				}
      			}
      		],
      		"addresses": [
      			{
      				"num": "74",
      				"street": "Campo Real",
      				"locality": "Torrejón De La Calzada",
      				"region": "Madrid",
      				"code": "28023",
      				"country": "ES"
      			}
      		],
      		"emails": [
      			{
      				"addr": "rxazy27xfc@iname.com"
      			}
      		],
      		"telephones": [
      			{
      				"label": "office",
      				"num": "+34910730028"
      			}
      		]
      	},
      	"customer": {
      		"name": "Moniward Sl",
      		"tax_id": {
      			"country": "ES",
      			"code": "B77436020"
      		},
      		"addresses": [
      			{
      				"num": "35",
      				"street": "Plaza Horno",
      				"locality": "Nombela",
      				"region": "Toledo",
      				"code": "45083",
      				"country": "ES"
      			}
      		],
      		"emails": [
      			{
      				"addr": "bfn25xf3p@lycos.co.uk"
      			}
      		]
      	},
      	"lines": [
      		{
      			"i": 1,
      			"quantity": "20",
      			"item": {
      				"name": "Operations and development - day rate",
      				"price": "200.00"
      			},
      			"sum": "4000.00",
      			"taxes": [
      				{
      					"cat": "VAT",
      					"key": "standard",
      					"rate": "general",
      					"percent": "21.0%"
      				}
      			],
      			"total": "4000.00"
      		},
      		{
      			"i": 2,
      			"quantity": "2",
      			"item": {
      				"name": "Additional Overtime",
      				"price": "101.00"
      			},
      			"sum": "202.00",
      			"taxes": [
      				{
      					"cat": "VAT",
      					"key": "standard",
      					"rate": "general",
      					"percent": "21.0%"
      				}
      			],
      			"total": "202.00"
      		}
      	],
      	"totals": {
      		"sum": "4202.00",
      		"total": "4202.00",
      		"taxes": {
      			"categories": [
      				{
      					"code": "VAT",
      					"rates": [
      						{
      							"key": "standard",
      							"base": "4202.00",
      							"percent": "21.0%",
      							"amount": "882.42"
      						}
      					],
      					"amount": "882.42"
      				}
      			],
      			"sum": "882.42"
      		},
      		"tax": "882.42",
      		"total_with_tax": "5084.42",
      		"payable": "5084.42"
      	},
      	"notes": [
      		{
      			"key": "general",
      			"text": "Thank you for your custom!"
      		}
      	]
      }
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Facturae FACe Invoice (with Administrative Centers)">
    An invoice addressed to a public administration via the FACe platform, including the three required DIR3 administrative centers.

    Notice:

    * the customer includes an identity with `scope: "tax"` for the **Oficina Contable** (DIR3 code `01`),
    * `delivery.receiver` includes the **Órgano Gestor** identity (DIR3 code `02`),
    * `ordering.buyer` includes the **Unidad Tramitadora** identity (DIR3 code `03`),
    * each public body publishes their DIR3 codes — look them up in the [DIR3 directory](https://administracionelectronica.gob.es/ctt/dir3).

    <CodeGroup>
      ```json Facturae FACe Invoice (B2G with Admin Centers) theme={null}
      {
      	"$schema": "https://gobl.org/draft-0/bill/invoice",
      	"$regime": "ES",
      	"$addons": [
      		"es-facturae-v3"
      	],
      	"code": "TEST01002F",
      	"issue_date": "2021-12-08",
      	"supplier": {
      		"name": "Hypeprop Sl",
      		"alias": "Hypeprop",
      		"tax_id": {
      			"country": "ES",
      			"code": "B23103039"
      		},
      		"people": [
      			{
      				"name": {
      					"given": "Paloma",
      					"surname": "Araujo"
      				}
      			}
      		],
      		"addresses": [
      			{
      				"num": "74",
      				"street": "Campo Real",
      				"locality": "Torrejón De La Calzada",
      				"region": "Madrid",
      				"code": "28023",
      				"country": "ES"
      			}
      		],
      		"emails": [
      			{
      				"addr": "rxazy27xfc@iname.com"
      			}
      		],
      		"telephones": [
      			{
      				"label": "office",
      				"num": "+34910730028"
      			}
      		]
      	},
      	"customer": {
      		"name": "Ayuntamiento de Madrid",
      		"tax_id": {
      			"country": "ES",
      			"code": "P2807900B"
      		},
      		"identities": [
      			{
      				"scope": "tax",
      				"code": "L01280796"
      			}
      		],
      		"addresses": [
      			{
      				"num": "4",
      				"street": "Plaza de la Villa",
      				"locality": "Madrid",
      				"region": "Madrid",
      				"code": "28005",
      				"country": "ES"
      			}
      		],
      		"emails": [
      			{
      				"addr": "facturacion@madrid.es"
      			}
      		]
      	},
      	"lines": [
      		{
      			"quantity": "20",
      			"item": {
      				"name": "Services rendered",
      				"price": "200.00"
      			},
      			"taxes": [
      				{
      					"cat": "VAT",
      					"rate": "general"
      				}
      			]
      		}
      	],
      	"ordering": {
      		"buyer": {
      			"name": "Departamento de Compras",
      			"identities": [
      				{
      					"code": "LA0007408"
      				}
      			],
      			"addresses": [
      				{
      					"num": "10",
      					"street": "Gran Vía",
      					"locality": "Madrid",
      					"region": "Madrid",
      					"code": "28013",
      					"country": "ES"
      				}
      			]
      		}
      	},
      	"payment": {
      		"terms": {
      			"key": "due-date",
      			"due_dates": [
      				{
      					"date": "2021-12-30",
      					"percent": "100%"
      				}
      			]
      		},
      		"instructions": {
      			"key": "credit-transfer",
      			"credit_transfer": [
      				{
      					"iban": "ES25 0188 2570 7185 4470 4761",
      					"name": "Bankrandom"
      				}
      			]
      		}
      	},
      	"delivery": {
      		"receiver": {
      			"name": "Concejalía de Hacienda",
      			"identities": [
      				{
      					"code": "LA0007407"
      				}
      			],
      			"addresses": [
      				{
      					"num": "3",
      					"street": "Calle Alcalá",
      					"locality": "Madrid",
      					"region": "Madrid",
      					"code": "28014",
      					"country": "ES"
      				}
      			]
      		}
      	}
      }
      ```

      ```json Built version theme={null}
      {
      	"$schema": "https://gobl.org/draft-0/bill/invoice",
      	"$regime": "ES",
      	"$addons": [
      		"es-facturae-v3"
      	],
      	"type": "standard",
      	"code": "TEST01002F",
      	"issue_date": "2021-12-08",
      	"currency": "EUR",
      	"tax": {
      		"ext": {
      			"es-facturae-doc-type": "FC",
      			"es-facturae-invoice-class": "OO"
      		}
      	},
      	"supplier": {
      		"name": "Hypeprop Sl",
      		"alias": "Hypeprop",
      		"tax_id": {
      			"country": "ES",
      			"code": "B23103039"
      		},
      		"people": [
      			{
      				"name": {
      					"given": "Paloma",
      					"surname": "Araujo"
      				}
      			}
      		],
      		"addresses": [
      			{
      				"num": "74",
      				"street": "Campo Real",
      				"locality": "Torrejón De La Calzada",
      				"region": "Madrid",
      				"code": "28023",
      				"country": "ES"
      			}
      		],
      		"emails": [
      			{
      				"addr": "rxazy27xfc@iname.com"
      			}
      		],
      		"telephones": [
      			{
      				"label": "office",
      				"num": "+34910730028"
      			}
      		]
      	},
      	"customer": {
      		"name": "Ayuntamiento de Madrid",
      		"tax_id": {
      			"country": "ES",
      			"code": "P2807900B"
      		},
      		"identities": [
      			{
      				"scope": "tax",
      				"code": "L01280796"
      			}
      		],
      		"addresses": [
      			{
      				"num": "4",
      				"street": "Plaza de la Villa",
      				"locality": "Madrid",
      				"region": "Madrid",
      				"code": "28005",
      				"country": "ES"
      			}
      		],
      		"emails": [
      			{
      				"addr": "facturacion@madrid.es"
      			}
      		]
      	},
      	"lines": [
      		{
      			"i": 1,
      			"quantity": "20",
      			"item": {
      				"name": "Services rendered",
      				"price": "200.00"
      			},
      			"sum": "4000.00",
      			"taxes": [
      				{
      					"cat": "VAT",
      					"key": "standard",
      					"rate": "general",
      					"percent": "21.0%"
      				}
      			],
      			"total": "4000.00"
      		}
      	],
      	"ordering": {
      		"buyer": {
      			"name": "Departamento de Compras",
      			"identities": [
      				{
      					"code": "LA0007408"
      				}
      			],
      			"addresses": [
      				{
      					"num": "10",
      					"street": "Gran Vía",
      					"locality": "Madrid",
      					"region": "Madrid",
      					"code": "28013",
      					"country": "ES"
      				}
      			]
      		}
      	},
      	"payment": {
      		"terms": {
      			"key": "due-date",
      			"due_dates": [
      				{
      					"date": "2021-12-30",
      					"amount": "4840.00",
      					"percent": "100%"
      				}
      			]
      		},
      		"instructions": {
      			"key": "credit-transfer",
      			"credit_transfer": [
      				{
      					"iban": "ES25 0188 2570 7185 4470 4761",
      					"name": "Bankrandom"
      				}
      			]
      		}
      	},
      	"delivery": {
      		"receiver": {
      			"name": "Concejalía de Hacienda",
      			"identities": [
      				{
      					"code": "LA0007407"
      				}
      			],
      			"addresses": [
      				{
      					"num": "3",
      					"street": "Calle Alcalá",
      					"locality": "Madrid",
      					"region": "Madrid",
      					"code": "28014",
      					"country": "ES"
      				}
      			]
      		}
      	},
      	"totals": {
      		"sum": "4000.00",
      		"total": "4000.00",
      		"taxes": {
      			"categories": [
      				{
      					"code": "VAT",
      					"rates": [
      						{
      							"key": "standard",
      							"base": "4000.00",
      							"percent": "21.0%",
      							"amount": "840.00"
      						}
      					],
      					"amount": "840.00"
      				}
      			],
      			"sum": "840.00"
      		},
      		"tax": "840.00",
      		"total_with_tax": "4840.00",
      		"payable": "4840.00"
      	}
      }
      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>

<Info>
  In your invoice data, make sure to include the [`es-facturae-v3` addon](https://docs.gobl.org/addons/es-facturae-v3) and set the regime to `ES`.
</Info>

Once you have saved in Invopop, select <kbd>Run workflow</kbd> and select "Facturae Generate Invoice" from the sidebar.

***

<AccordionGroup>
  <Accordion title="🇪🇸 Invopop resources for Spain">
    |            |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
    | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | Compliance | <Icon icon="https://assets.invopop.com/flags/es.svg" /> [Invoicing compliance in Spain](/compliance/spain)<br /> <Icon icon="timeline" /> [Compliance timeline](/timelines/spain)                                                                                                                                                                                                                                                                                                                   |
    | Apps       | <Icon icon="https://assets.invopop.com/apps/gov-es/icon.svg" /> [Spain](/apps/spain)<br /> <Icon icon="https://assets.invopop.com/apps/verifactu/icon.svg" /> [VERI\*FACTU Spain](/apps/verifactu-spain)<br /><Icon icon="https://assets.invopop.com/apps/ticketbai/icon.svg" /> [TicketBAI (Spain app)](/apps/spain)                                                                                                                                                                               |
    | Guides     | <Icon icon="book" /> [Facturae guide](/guides/es-facturae)<br /><Icon icon="book" /> [VERI\*FACTU invoicing guide](/guides/es-verifactu)<br /><Icon icon="book" /> [VERI\*FACTU supplier onboarding](/guides/es-verifactu-supplier)<br /><Icon icon="book" /> [SII invoicing guide](/guides/es-sii)<br /><Icon icon="book" /> [SII supplier onboarding](/guides/es-sii-supplier)<br /><Icon icon="book" /> [TicketBAI guide](/guides/es-ticketbai)                                                  |
    | FAQ        | <Icon icon="square-question" /> [Spain FAQ](/faq/spain)                                                                                                                                                                                                                                                                                                                                                                                                                                             |
    | GOBL       | <Icon icon="https://assets.invopop.com/icons/gobl.svg" />  [Spain Tax Regime](https://docs.gobl.org/regimes/es)<br /> <Icon icon="https://assets.invopop.com/icons/gobl.svg" /> [VERI\*FACTU Addon](https://docs.gobl.org/addons/es-verifactu-v1)<br /> <Icon icon="https://assets.invopop.com/icons/gobl.svg" /> [Facturae Addon](https://docs.gobl.org/addons/es-facturae-v3)<br /> <Icon icon="https://assets.invopop.com/icons/gobl.svg" /> [SII Addon](https://docs.gobl.org/addons/es-sii-v1) |
    | GitHub     | <Icon icon="github" /> [gobl.facturae](https://github.com/invopop/gobl.facturae)<br /><Icon icon="github" /> [gobl.verifactu](https://github.com/invopop/gobl.verifactu)<br /> <Icon icon="github" /> [gobl.ticketbai](https://github.com/invopop/gobl.ticketbai)                                                                                                                                                                                                                                   |
  </Accordion>
</AccordionGroup>

<Card title="Spain FAQ" icon="square-question" href="/faq/spain" arrow="true" horizontal>
  Find answers to frequently asked questions about invoicing in Spain →
</Card>

<Card title="Participate in our community" icon="forumbee" href="https://community.invopop.com" arrow="true" horizontal>
  Ask and answer questions about invoicing in Spain →
</Card>
