- The
/api/v1list endpoints now limit the page size. A request with aper_pageabove the limit is rejected with a422error instead of being served. - Customer text fields now have a maximum length. Creating or updating a customer with a longer value is rejected with a
422error. - The front image listens on port
8080.getlago/frontnow runs nginx as a non-root user, on port8080(8443for TLS) instead of80(443). A self-hosted setup that sends traffic to port80of the front container no longer reaches the app.
What are the changes?
A maximum page size on /api/v1
Every request on an /api/v1 path that sends per_page is checked before any data is read. When per_page is above the limit, it returns a 422 with the value_is_out_of_range code on per_page. A per_page equal to the limit is accepted.
A page or per_page that is not a positive number (0, a negative value, text) is not rejected. As before, it falls back to the first page or the default page size.
page or per_page, or send them empty, behave as before: the default page size stays 100. A limit below 100 also lowers that default, so a request without per_page then returns at most the limit.
The limit can be changed in two ways:
- For the whole instance, with the
LAGO_API_PAGINATION_MAX_PAGE_SIZEenvironment variable. - For one organization, with the new
pagination_max_page_sizecolumn of theorganizationstable. When it is set, it wins over the environment variable, higher or lower.
- The response of a valid request is unchanged.
- The GraphQL API used by the Lago front-end is not affected.
A maximum length on customer text fields
Creating or updating a customer now checks the length of its text fields, on the API, in the Lago app and in the customer portal:name already had a 255 character limit. A longer value returns a 422 with the value_is_too_long code on the field (the shipping fields are reported as shipping_city, shipping_address_line1 and so on):
invalid_characters code. The API and the Lago app still accept these characters.
The front image runs as a non-root user on port 8080
This applies to self-hosted users only. Thegetlago/front image is now built on a hardened base image (lago-front#4359):
A non-root process cannot listen on a port below 1024, so the container port changes. The port on your host can stay
80.
Why are we doing this?
Until now, nothing limitedper_page on /api/v1. A single request such as GET /api/v1/invoices?per_page=1000000000 loaded the whole table in one response, and held a database connection and a worker for as long as it took. On a large instance, a few of these requests slowed the API down for every other client.
Customer text fields had no length limit either, and the customer portal let end customers write long, multi-line text into them. These values are shown on invoices and in the Lago app, and are read by the AI assistant. The limits keep them to the size of a real name or address.
What should self-hosted users do?
Cloud users do not need to follow steps 1, 2 and 4. The Lago Team sets the page size limit for the organizations that need larger pages.
1. Check the page size your integrations send
Before upgrading, look for/api/v1 requests that send a per_page above 200 (in your API access logs, your load balancer logs, or the code of your integrations).
If none of them do, no action is needed: install v1.56.0 as usual.
2. Raise the limit before upgrading, if needed
If some integrations send aper_page above 200, choose one of the options below before installing v1.56.0. Otherwise these requests start failing with a 422 as soon as the new version runs.
Option A: raise the limit for the whole instance
Set the environment variable on the API container, then restart it:
The value is read on every request, so a later change only needs a restart, not a new release.
Option B: raise the limit for one organization
After installing v1.56.0 (the column is added by the database migrations), open a Rails console on your API server and set the limit of the organization:nil to use the instance limit again.
3. Check the customer values your integrations send
This step applies to Cloud and self-hosted users. Look for integrations that create or update customers with text longer than the limits above, for example a long legal name or an address sent in a single field. Shorten these values before sending them, or split an address acrossaddress_line1 and address_line2. Otherwise these requests fail with a 422 once v1.56.0 runs.
4. Point the front service at port 8080
Thedocker-compose.yml of the Lago repository for v1.56.0 already does this: it publishes ${FRONT_PORT:-80}:8080, and gives the front service read_only: true and a tmpfs on /tmp. If you run your own Compose file, Kubernetes manifests or reverse proxy:
- Send traffic to container port
8080(and8443for TLS). For example80:8080in Compose, orloadbalancer.server.port=8080in a Traefik label. - If the root filesystem of the container is read-only, give
/tmpa writable mount (a tmpfs, or anemptyDirin Kubernetes). - If you mount your own nginx
default.conf(for TLS), listen on8080and8443, and copy theenv-config.jslocation, the dotfile rule and theinclude /tmp/csp.conflines fromextra/nginx-selfsigned.confin the Lago repository. Removessl_dhparam: the image cannot load DH parameter files. - Make your TLS key and certificate readable by uid
65532.extra/init-selfsigned.shandextra/init-letsencrypt.shin the Lago repository do this. - Remove any
command:override of the front service. Use theentrypoint:shown indocker-compose.ymlinstead.
Other changes to check
The environment variables below are set on the API and worker containers, like the other environment variables.Document download links now expire
This applies to Cloud and self-hosted users. The download links of invoices, credit notes, payment receipts and signed order forms (file_url, xml_url, signed_document_url) now point to a new path, <LAGO_API_URL>/documents/..., and expire. Each link comes with its expiry date in a new field next to it (file_url_expires_at, xml_url_expires_at, signed_document_url_expires_at), in the API, GraphQL and webhook payloads.
A link expires at the end of the day, 30 days after:
- the payment due date of an invoice (or its issuing date when it has no due date),
- the issuing date of a credit note,
- the creation date of a payment receipt,
- the signing date of an order form.
document_url_expiration_days setting of the organization (API and GraphQL).
An expired link returns a 410:
GET /api/v1/invoices/:lago_id).
Links generated before v1.56.0 use the previous /rails/active_storage/... path and do not expire. They keep working until LAGO_LEGACY_DOCUMENT_URLS_EXPIRE_AT is set to a date in the past. After that date, these old links also return the 410. Logos and data exports are not affected.
What to check:
- Integrations that store
file_urlorxml_url(in a database, a CRM, an ERP, an email). A stored link stops working after its expiry date. Store the document ID and fetch a fresh link when it is needed, or download the file when you receive it. - Reverse proxies or firewalls that only allow some paths on the API host. Allow
/documents/onLAGO_API_URL. With local disk storage, the download is then redirected to/rails/active_storage/...on the same host, so keep that path allowed too. LAGO_LEGACY_DOCUMENT_URLS_EXPIRE_AT, only if you want the old links to stop working. The value is a date such as2027-01-31or2027-01-31T00:00:00Z(read as UTC), read when the API starts. A value that is not a valid date stops the API from starting.
Login limits behind a reverse proxy
Login attempts are limited per client IP address (30 attempts per minute), and per email and IP address pair. Attempts from other IP addresses no longer block a user’s password login. Lago reads the client IP from theX-Forwarded-For header only when the request comes through a trusted proxy. Proxies on private addresses (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, loopback) are trusted by default. When a proxy has a public address (a CDN, a load balancer outside your private network), list it in LAGO_TRUSTED_PROXIES. Otherwise every client gets the proxy’s IP, shares one counter, and one client can block logins for everyone.
LAGO_TRUSTED_PROXIES takes a comma-separated list of IP addresses or CIDR ranges. An invalid entry stops the API from starting.
The attempt counters are kept in the Sidekiq Redis (REDIS_URL) by default. To keep them in another Redis, set LAGO_REDIS_THROTTLING_URL, and LAGO_REDIS_THROTTLING_PASSWORD if it needs one.
WebSocket connections check the front-end origin
The API now accepts WebSocket connections (used by the AI assistant) only from the origin ofLAGO_FRONT_URL. Make sure LAGO_FRONT_URL is the exact URL users open the Lago app with (scheme, host and port). When it is not set, it defaults to https://app.getlago.com, and these features stop working on a self-hosted front end.
GraphQL introspection is off
The GraphQL API no longer describes its schema (__schema, __type queries) in production. The Lago app does not need it. If a tool needs the schema from a running API, set LAGO_GRAPHQL_INTROSPECTION_ENABLED=true on the API.
Event timestamps out of range are rejected
An event with atimestamp before 1970 or from the year 2300 now returns a 422 with the value_is_out_of_range code on timestamp (one error per event in a batch).
Two optional variables, LAGO_EVENTS_MAX_PAST_DAYS and LAGO_EVENTS_MAX_FUTURE_HOURS, reject events too far in the past or the future, for example a timestamp sent in milliseconds instead of seconds. Both are off when not set, and are read when the API starts.
The gRPC token endpoint was removed
GET /api/v1/organizations/grpc_token now returns a 404. It was not used by Lago.
Database migrations that can take time
The database migrations run when the API starts, as usual. Two of them can take longer on large instances:- PostgreSQL: a new index on
invoices(organization_id,created_at) is built withCREATE INDEX CONCURRENTLY. It does not block writes, but it can take a while on a largeinvoicestable. If it fails, running the migrations again builds it from the start. - ClickHouse (only when
LAGO_CLICKHOUSE_MIGRATIONS_ENABLEDis set): new indexes are added onevents_raw(transaction_id) andevents_enriched(transaction_id,enriched_at). The migrations finish right away, then ClickHouse builds the indexes in the background (MATERIALIZE INDEX). On large tables this can take a long time and use CPU and disk. You can follow it in thesystem.mutationstable.
Docker Compose changes
The Docker Compose files of the Lago repository now use theghcr.io/getlago/lago-gotenberg:8.39 image for the PDF service. If you run your own compose file, update the pdf service image.