Skip to content

Features

Data residency

Requires a license with the data-residency feature. See pricing.

Data residency records where each tenant's data must live and holds every engine to it. You define the regions you run in, assign each tenant to one, and start each engine with the region it serves. A write from a tenant that belongs in another region is refused and told where to go.

When an engine starts with INSTANCE_REGION set, the Content API checks every write (any method except GET, HEAD and OPTIONS):

TenantResult
No region assignedWrites anywhere.
Assigned to this engine's regionWrites as usual.
Assigned to another region421 Misdirected Request.
Region cannot be read503 with cannot determine the tenant's data region. The write is never let through.
HTTP
HTTP/1.1 421 Misdirected Request
X-CMS-Region: us-east-1
X-CMS-Region-Target: eu-west-1
X-CMS-Region-Reason: data-residency-enforced
{"error":"write routed to wrong region","target_region":"eu-west-1"}

Route the request to an engine in X-CMS-Region-Target. Reads are not checked, and neither is the Admin API. Without INSTANCE_REGION, nothing is enforced. With it, every Content API response carries X-CMS-Region with this engine's region, so a load balancer can route on it. Residency decides where a tenant's writes land. It does not look at where a client connects from.

Uploads follow the same assignment. A tenant's files go only to storage providers in its region, and an upload whose region cannot be read answers 503 rather than land elsewhere. See object storage.

Open Settings > Data residency. Where tenants are counts the regions, the tenants, the replicated tenants and the tenants not placed. Below the counts it lists how many tenants each region holds, and each tenant's region, replica and assignment date. Regions lists every region with where it runs and whether it accepts tenants. New region opens a form with Slug, Name, Runs on, Latitude, Longitude, Accepting new tenants and Default for new tenants.

The Data residency page with two regions. Northwind Traders is placed in eu-west-1, and the regions EU West (Ireland) and US East (Virginia) both accept tenants.

LyEve Console does not assign a tenant to a region on this release. Do that over the API, as Try it shows.

This defines a region, assigns a tenant to it and reads the report. Sign in as a super admin. The tenant here is northwind, made on Tenants. A new install lists no tenant until you make one.

Create a region:

Console v0.28.0

  1. Open Settings > Data residency and choose New region.
  2. Enter eu-west-1 in Slug and EU West (Ireland) in Name. Leave Runs on as aws.
  3. Enter 53.35 in Latitude and -6.26 in Longitude. Leave Accepting new tenants on.
  4. Choose Create. The page says Created EU West (Ireland), and the region is listed under Regions as Accepting tenants.

Engine API v0.62.0

You need a super admin token in TOKEN. The quickstart shows how to get one.

Shell
curl -X POST http://localhost:3001/api/admin/regions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"slug": "eu-west-1", "display_name": "EU West (Ireland)", "provider": "aws", "coordinates": {"lat": 53.35, "long": -6.26}}'

The answer is 201 with the region. Copy its id into REGION.

Assign the tenant. Only the API does this on this release. If you work in the console, sign in over the API to get a token, as Turn on drafts and publishing shows, and keep it in TOKEN.

  1. Find the region's id and the tenant's id. A tenant is assigned by its id, not its slug:

    Shell
    REGION=$(curl -s http://localhost:3001/api/admin/regions \
    -H "Authorization: Bearer $TOKEN" \
    | jq -r '.data[] | select(.slug == "eu-west-1") | .id')
    TENANT=$(curl -s http://localhost:3001/api/admin/tenants \
    -H "Authorization: Bearer $TOKEN" \
    | jq -r '.data[] | select(.slug == "northwind") | .id')
  2. Assign it:

    Shell
    curl -X POST http://localhost:3001/api/admin/tenants/$TENANT/region \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d "{\"region_id\": \"$REGION\"}"
    JSON
    {
    "id": "909c7ca6-f9ed-4445-82bb-51f62b836bd7",
    "tenant_id": "3f64a521-1146-481c-aaf8-a3334f505aa3",
    "region_id": "76e7b309-80f4-4341-a958-2b15dacbbe44",
    "region_slug": "eu-west-1",
    "assigned_at": "2026-10-02T09:14:56Z"
    }

Read the report:

Console v0.28.0

Open Settings > Data residency. Where tenants are reads 1 under Regions, Tenants and the region's count, and 0 under Replicated and Not placed. The table below lists Northwind Traders in eu-west-1 with no replica and when it was assigned.

Engine API v0.62.0

Shell
curl http://localhost:3001/api/admin/residency/report \
-H "Authorization: Bearer $TOKEN"

It lists regions, every tenant's assignment under tenant_regions, and a summary:

JSON
{
"total_regions": 1,
"total_tenants": 1,
"tenants_per_region": {"eu-west-1": 1},
"replicating_count": 0,
"unassigned_count": 0
}

Ask for the nearest region the way a sign-up page would, with no credentials. This is a public Content API route, the same on both paths:

Shell
curl -X POST http://localhost:3002/api/v1/regions/nearest \
-H "Content-Type: application/json" \
-d '{"lat": 48.85, "long": 2.35}'

The answer is the region with distance_km, about 781 from Paris to Dublin.

  1. Run with a license that includes data-residency. If you set LYEVE_PLUGINS, include data-residency in it. See Licensing and tiers.
  2. On each engine, set INSTANCE_REGION to the slug of the region it serves.
  3. Create regions in the console or over the API, and assign tenants over the API.

Without the license the feature does not start, and its routes answer 404.

Regions need a super admin. slug and display_name are required, and provider defaults to aws. coordinates lets the nearest-region lookup use the region. is_default marks the default region, and marking one clears the mark from the others. PUT also takes enabled. Only enabled regions are listed publicly.

A region with enabled: false is closed to new tenants. Assigning a tenant to it answers 409 with the code data_residency.region_closed, even for a tenant already there. Tenants already assigned to it keep their assignment. A closed region cannot be the default: marking a closed region is_default, or closing the default region, answers 400. Make another region the default first.

An admin can read and set their own tenant's region. A super admin can do it for any tenant. GET /api/admin/tenants/{id}/region returns the assignment, or 404 with no region assigned.

These record your disaster-recovery setup and planned moves between regions. The engine stores them and shows them in the report. Copying the data is up to you.

  • POST /api/admin/tenants/{id}/replication takes replica_region_id, target_rpo_secs (default 3600) and target_rto_secs (default 1800), and answers 201 with a record in status syncing.
  • PUT /api/admin/tenants/{id}/replication/{rid} updates status, one of syncing, synced, failed or paused, and the lag.
  • POST /api/admin/tenants/{id}/migrate takes to_region_id and an optional requested_by, and answers 202 with a migration record in status estimating.

Two Content API routes need no credentials:

  • GET /api/v1/regions lists enabled regions, paginated (limit default 50, offset). 30 requests a second per address, bursts of 50.
  • POST /api/v1/regions/nearest takes {"lat": ..., "long": ...} and answers {"region": {...}, "distance_km": ...}. 10 requests a second per address, bursts of 20.
VariableWhat it doesDefault
INSTANCE_REGIONThe region slug this engine serves. Set, it turns on write enforcement.unset
Regions, assignments and records
MethodPathWho
GET, POST/api/admin/regionssuper admin
GET, PUT, DELETE/api/admin/regions/{id}super admin
GET, POST/api/admin/tenants/{id}/regionadmin of that tenant
GET, POST/api/admin/tenants/{id}/replicationadmin of that tenant
PUT, DELETE/api/admin/tenants/{id}/replication/{rid}admin of that tenant
POST/api/admin/tenants/{id}/migrateadmin of that tenant
GET/api/admin/tenants/{id}/migrationsadmin of that tenant
GET/api/admin/tenants/{id}/migrations/{mid}admin of that tenant
GET/api/admin/residency/reportsuper admin
GET/api/v1/regionsanyone
POST/api/v1/regions/nearestanyone
StatusMessageCause
421write routed to wrong regionThe tenant belongs in another region.
403forbidden: super_admin requiredA tenant admin called a region or report route.
403forbidden: cannot access another tenant's dataA tenant admin named another tenant.
Every error
StatusMessageCause
400slug is required, display_name is requiredRegion created without them.
400a closed region cannot be the defaultA closed region marked is_default, or the default region closed.
400region_id is required, to_region_id is requiredAssignment or migration without a region.
400invalid status: must be one of syncing, synced, failed, pausedUnknown replication status.
404region not found, no region assigned, replication not found, migration not foundWrong id.
409region with slug "<slug>" already existsDuplicate slug.
409This region is closed to new tenants., with the code data_residency.region_closedThe region is not enabled.
503cannot determine the tenant's data regionThe tenant's region could not be read during a write.
  • Tenants: what a tenant is and how a request picks one.
  • PII masking: keep personal data out of responses and logs.
  • Data protection: how residency fits a vendor review.