Factuarea APIDevelopers
Contract

Period variables in recurring invoices

The concept and description of each line, the notes, and the subject and message of the automatic delivery of a recurring invoice accept nine variables for the month, the year and the quarter, replaced when each invoice is generated. Saving measures the length with each variable at its longest value. Two updated operations, with their MCP tools.

26 November 2026 — The text of a recurring invoice can now name the period of the invoice it generates. Nine period variables, written between braces, are replaced once, when each invoice is generated, with the date of that invoice and the issuing language of the company: a line that says Plan SEO {mes} {anio} becomes Plan SEO septiembre 2026 in the invoice of September and Plan SEO octubre 2026 in the one of October, while the recurring invoice keeps the variables for the next ones. No field is added or removed: the five fields that accept the variables now say so in the reference, and saving checks the length of three of them as explained below. What to check in your integration lists what can affect an existing one. The recurring invoices guide covers the rest of the flow.

Where they apply

They are accepted in five fields of the create and update operations of a recurring invoice, and in the MCP tools create_recurring_invoice and update_recurring_invoice:

  • lines[].description — the concept of each line.
  • lines[].additional_description — the description of each line.
  • notes — the notes of the recurring invoice.
  • auto_delivery.subject and auto_delivery.body — the subject and the message of the automatic delivery. The period variables are replaced first and the variables of the email, such as {nombreCliente}, afterwards.

They are not replaced in the default subject and message that the company sets in its settings, in manual sends, in the legacy email_to delivery or in any document that is not a recurring invoice.

The nine variables

VariableValue
{mes}, {mesAnterior}, {mesSiguiente}Name of the month of the invoice date, of the previous month and of the next one.
{anio}, {anioMesAnterior}, {anioMesSiguiente}Year of the invoice date, of the previous month and of the next month. They differ from {anio} only in January and December.
{trimestre}, {trimestreAnterior}, {anioTrimestreAnterior}Calendar quarter of the invoice date, the previous quarter and the year of that previous quarter. In the first quarter, the previous one is the fourth of the year before.

The names of the variables are Spanish whichever language you write in. The names of the months and the quarters come in the issuing language of the company, es, en or ca (es when it has none or another one), which is the language the PDF of the invoice is rendered in; account personalization sets it. For an invoice of September, in the third quarter:

Language{mes}{trimestre}
esseptiembre3.er trimestre
enSeptemberQ3
casetembre3r trimestre

A capital first letter, as in {Mes} or {MesAnterior}, capitalises the value (Septiembre). Any other capitalisation, such as {MES}, and any other text between braces stay as written and return no error.

When they are replaced

  • Once per invoice. They are replaced when the recurring invoice generates each invoice, with the date of that invoice, which is the day of generation, whether the invoice is born as a draft or issued. A manual generation (POST /v1/companies/{company}/recurring-invoices/{recurring_invoice}/generate and the tool generate_recurring_invoice), the nightly one and the draft mode replace them in the same way, each with its own date.
  • The recurring invoice keeps its variables. It stores the text with them for the next generations, and the invoice that is generated, its PDF and its VeriFactu record carry the text already resolved. An invoice that has been generated never changes afterwards.
  • The preview. GET /v1/companies/{company}/recurring-invoices/{recurring_invoice}/preview with expand=document and the tool preview_recurring_invoice resolve the concept and the description of the lines with the date of the next run.

Length check on save

When you create or update a recurring invoice, three texts are measured counting each variable as its longest value in any language: 10 characters for a month, 4 for a year and 14 for a quarter. They are the concept of each line (lines[].description, up to 255 characters), the subject (up to 255) and the message (up to 5000) of the automatic delivery. If one does not fit, the request answers 422 parameter_invalid_value and saves nothing; MCP answers with the same status, code and param.

Textparamsubcode
Concept of a linelines.0.description, with the position of the linerecurring_line_description_too_long
Subject of the automatic deliveryauto_delivery.subjectauto_delivery_subject_too_long
Message of the automatic deliveryauto_delivery.bodyauto_delivery_body_too_long

A concept of 251 characters that includes {mes} counts as 256, because the variable counts 10 and not 5, so it is rejected. The measure is pessimistic on purpose: it does not depend on the language, which can change in the settings after you save, and it keeps the nightly generation from failing on length. notes and lines[].additional_description have their variables replaced too, but they are not measured with the longest value.

What to check in your integration

  • Texts with braces. A text that already contained one of the nine names between braces, for example {mes}, is now replaced when its next invoice is generated. Review the templates of your recurring invoices if one used those words as literal text.
  • The new 422. A concept, a subject or a message that was saved before and fits in its limit as written can now be rejected once its variables are measured. Show your user the param and the message, and shorten the text.
  • Recurring invoices saved before. They are not measured again. If a concept exceeds 255 characters once resolved, it is cut to 255 and the generation goes ahead.

Operations in this release

OperationoperationIdMCP toolWhat changes
POST /v1/companies/{company}/recurring-invoicespublic-api.v1.recurring_invoices.createcreate_recurring_invoicelines[].description, lines[].additional_description, notes, auto_delivery.subject and auto_delivery.body describe the period variables. The line concept, the subject and the message are measured with each variable at its longest value, and one that does not fit answers 422 parameter_invalid_value.
PATCH /v1/companies/{company}/recurring-invoices/{recurring_invoice}public-api.v1.recurring_invoices.updateupdate_recurring_invoiceThe same five fields describe the period variables, with the same length check and the same 422.

Updated endpoints2

EndpointDescription
POST/v1/companies/{company}/recurring-invoicesCreate a recurring invoice
PATCH/v1/companies/{company}/recurring-invoices/{recurring_invoice}Update a recurring invoice

On this page

Need a hand?Contact support