Reference · Control API
Distribution
Spread a project across shards by root type, move buckets without downtime and pin roots to regions.
- In the schema
- —
Placeable roots and usage#
A root is the top-level tenant or partition object (such as Org or Workspace) that descendant types link to through required owner links. When you push a schema, Napalm automatically analyzes every object type’s link graph and classifies types as root-scoped or shared reference tables. See Schema: Sharding & roots for the schema rules.
Compiler-inferred root trees
Required owner links group each tenant’s records into one root tree so bucket moves and shard splits never cut across linked rows.
Dedicated single-root overrides
POST / lifts a hot tenant root onto its own shard online behind the same project hostname.
Regional residency pins
POST / migrates a root’s tree into a target region and blocks rebalances from moving it out.
Root placement map#
Enabling root placement assigns each of a branch’s roots to a bucket and each bucket to a shard in your cluster. A root override places one root on a shard apart from the rest of its bucket. Overrides isolate a big root or keep a root in a region. Queries that filter on a root ID or traverse from a root-scoped record route directly to the owning shard without changing your project URL or application code.
| Route | Description | Scope |
|---|---|---|
GET /# | Read the active bucket placement map, root overrides, participating shards and core copies | Scoperead |
POST /# | Enable or disable root placement on a branch, or add and drain participating shards | Scopemanage |
GET /# | Inspect per-shard storage and query load and compute the recommended bucket moves to balance the cluster | Scoperead |
Online bucket moves and shard splits#
| Route | Description | Scope |
|---|---|---|
POST / | Move one bucket of roots or a single root to another shard while the branch keeps serving | Scopemanage |
POST / | Split a heavily loaded shard into two shards that divide the original shard’s buckets | Scopemanage |
POST/projects/{id}/bucket-moves#
POST /projects/{id}/bucket-moves
- shardstringrequired
- Target shard slug (such as
shard-k3m9x2p7qa). The shard must already hold the branch. - bucketinteger
- Bucket number from the placement map or rebalance advice. Send
bucketorroot, not both. - rootuuid
- Single root UUID to isolate on
shardas a root override. Sendbucketorroot, not both. - ?branchstring
- Branch name (
mainwhen omitted).
Rows copy online while the branch keeps serving reads without interruption. Writes to the moved bucket or root pause for seconds at the final switch (step advances through copying, catchingUp, draining and clearing). Sending a region-pinned root to a shard outside that region answers 400 outside_region.
curl https://api.napalmdata.com/projects/$PROJECT/bucket-moves \ -H "Authorization: Bearer $NAPALM_TOKEN" \ -H "Content-Type: application/json" \ -d { "root": "6f1c2d3e-0000-4000-8000-000000000001", "shard": "shard-k3m9x2p7qa" }{ "operation": { "id": "0192c410-3a4b-7c8d-9e01-2f3a4b5c6d7e", "operationType": "rootMove", "status": "pending", "clusterId": "7a1e9c2b-4d3f-4b8a-9e6c-2f1d0b8a7c35", "projectId": "8a4d2c10-5e3b-4f9a-8c12-6d7e8f9a0b1c", "branch": "main", "root": "6f1c2d3e-0000-4000-8000-000000000001", "region": null, "sourceShard": "shard-a1b2c3d4e5", "targetShard": "shard-k3m9x2p7qa", "isAutomatic": false, "step": null, "placementVersion": null, "insertTime": "2026-11-10T17:04:00Z" }}POST/projects/{id}/shard-splits#
POST /projects/{id}/shard-splits
- shardstringrequired
- Slug of the ready data shard to split. The shard must hold at least two buckets of the branch.
- regionstring
- Three-letter airport code (such as
iad) for the new data shard. Defaults to the source shard’s region. - ?branchstring
- Branch name (
mainwhen omitted).
Splitting provisions a new data shard and moves the later half of the source shard’s buckets onto the new shard (buckets lists the moving [first, last] ranges, and step advances through forking, promoting, attaching, catchingUp, draining and clearing). The new shard’s machines count toward the organization’s monthly spend ceilings (402 monthly_limit_reached or 402 monthly_cap_reached). See Scale and recovery for architectural details.
curl https://api.napalmdata.com/projects/$PROJECT/shard-splits \ -H "Authorization: Bearer $NAPALM_TOKEN" \ -H "Content-Type: application/json" \ -d { "shard": "shard-a1b2c3d4e5", "region": "iad" }{ "operation": { "id": "0192c415-9b1c-7d2e-8f30-5a6b7c8d9e0f", "operationType": "shardSplit", "status": "pending", "clusterId": "7a1e9c2b-4d3f-4b8a-9e6c-2f1d0b8a7c35", "projectId": "8a4d2c10-5e3b-4f9a-8c12-6d7e8f9a0b1c", "branch": "main", "sourceShard": "shard-a1b2c3d4e5", "targetShard": "shard-p8r4v1w6yz", "buckets": [[64, 127]], "step": null, "placementVersion": null, "splitError": null, "insertTime": "2026-11-10T17:15:00Z" }}Regional root pinning#
| Route | Description | Scope |
|---|---|---|
POST /# | Pin a specific root UUID to shards in a target geographic region, or clear an existing regional pin | Scopemanage |
Pass { "region": "iad" } (or { "region": null } to unpin). For a pinned root, the control plane migrates its data to a shard in that region, and future rebalances cannot move it out of the region.
Single-root point-in-time restore#
| Route | Description | Scope |
|---|---|---|
POST /# | Restore a single root and every descendant record to a specific timestamp without affecting other tenants | Scopemanage |
POST /projects/{id}/root-restores
- rootstringrequired
- The UUID of the root to rewind.
- targetTimestringrequired
- An RFC 3339 time with an offset, before now and inside the cluster’s backup window.
- branchstring
- Query parameter: the branch name (main by default).
Napalm takes the root’s rows back to targetTime from the shard’s backups in one step. All other roots keep serving normally.
Consolidated core copies#
A core copy keeps a continuously updated copy of every shard’s rows on a single read-only shard. Cross-tenant analytical queries and global aggregations run on the core copy without reaching every shard.