Limits per end user
Give each end user of your app a filesystem with its own monthly spend cap, operation rate and storage quota, set from your backend.
When you put mountable.io inside your app, give each end user their own filesystem. Your backend sets that filesystem's limits through the API, and mountable.io enforces them for mounts and the files API alike. One heavy end user stops at their own limit; your other end users keep working.
The limits
| Field | What it limits | Range | Default |
|---|---|---|---|
spending_cap_cents | this filesystem's usage charges each UTC calendar month, in your organisation's currency | 0 to 1,000,000,000 cents, or null | null: no cap |
mutations_per_minute | creates, deletes, renames, content changes, and a mount's metadata changes (such as chmod or a new mtime) per minute | 1 to 2,147,483,647, or null | null: no limit |
byte_quota | stored bytes | 1 byte to 100 GiB | 100 GiB |
entry_quota | files, directories and links (counted a few seconds behind) | 1 to 1,000,000 | 1,000,000 |
Your organisation's own limits still apply on top: its monthly spending cap and the quotas. Filesystem caps can add up to more than the organisation cap; whichever is reached first stops the work. Changes apply to the next operation, including mounts and sessions that already exist.
Create an end user's filesystem with its limits
Set the limits when you create the filesystem, so there is never a moment
without them. Create it with a management key
(MOUNTABLE_MANAGEMENT_KEY), then give the backend's API key access to it.
MOUNTABLE_API_KEY_ID holds that key's ID, api_key.id from GET /api/v1/me called with that key; use an API key that is not limited to one
filesystem. The CLI reads only MOUNTABLE_API_KEY, so the CLI lines set it
to the management key for that command.
export MOUNTABLE_API_KEY=mtbl_… # the backend's API key
FS_ID=$(MOUNTABLE_API_KEY="$MOUNTABLE_MANAGEMENT_KEY" mountable fs create user-42 \
--spending-cap-cents 500 --mutations-per-minute 120 \
--byte-quota 5368709120 --entry-quota 50000)
MOUNTABLE_API_KEY="$MOUNTABLE_MANAGEMENT_KEY" mountable grants set "$FS_ID" api_key "$MOUNTABLE_API_KEY_ID" rwimport os
from mountable_sdk import Mountable
admin = Mountable(api_key=os.environ["MOUNTABLE_MANAGEMENT_KEY"])
user_fs = admin.create_filesystem(
"user-42",
spending_cap_cents=500,
mutations_per_minute=120,
byte_quota=5 * 1024**3,
entry_quota=50_000,
)
admin.set_grant(user_fs.id, "api_key", os.environ["MOUNTABLE_API_KEY_ID"], "rw")
client = Mountable() # reads MOUNTABLE_API_KEY: reads, usage and filesimport { Mountable } from "mountable-sdk";
const admin = new Mountable({ apiKey: process.env.MOUNTABLE_MANAGEMENT_KEY });
const userFs = await admin.createFilesystem("user-42", {
spendingCapCents: 500,
mutationsPerMinute: 120,
byteQuota: 5 * 1024 ** 3,
entryQuota: 50_000,
});
await admin.setGrant(userFs.id, "api_key", process.env.MOUNTABLE_API_KEY_ID!, "rw");
const client = new Mountable(); // reads MOUNTABLE_API_KEY: reads, usage and filesadmin() { printf 'header = "Authorization: Bearer %s"\n' "$MOUNTABLE_MANAGEMENT_KEY"; }
FS_ID=$(admin | curl -q -sS --fail-with-body --config - \
--request POST "https://mountable.io/api/v1/orgs/$ORG_ID/filesystems" \
--header "Content-Type: application/json" \
--data '{"name": "user-42", "spending_cap_cents": 500,
"mutations_per_minute": 120, "byte_quota": 5368709120,
"entry_quota": 50000}' | jq -er .id)
admin | curl -q -sS --fail-with-body --config - \
--request PUT "https://mountable.io/api/v1/orgs/$ORG_ID/filesystems/$FS_ID/grants" \
--header "Content-Type: application/json" \
--data '{"principal_type": "api_key", "principal_id": "'"$MOUNTABLE_API_KEY_ID"'", "mode": "rw"}'This end user can spend at most $5.00 (or €5.00) a month, make 120 changes a minute, and store 5 GiB in 50,000 entries.
Change them later
An update, with the management key, changes only the limits you pass. Removing a spending cap or a
custom rate sends null (none in the CLI, None in Python, null in
TypeScript); the two quotas always have a value.
MOUNTABLE_API_KEY="$MOUNTABLE_MANAGEMENT_KEY" mountable fs update "$FS_ID" --spending-cap-cents 2000
MOUNTABLE_API_KEY="$MOUNTABLE_MANAGEMENT_KEY" mountable fs update "$FS_ID" --mutations-per-minute none # no operation rateadmin.update_filesystem(user_fs.id, spending_cap_cents=2000)
admin.update_filesystem(user_fs.id, mutations_per_minute=None) # no operation rateawait admin.updateFilesystem(userFs.id, { spendingCapCents: 2000 });
await admin.updateFilesystem(userFs.id, { mutationsPerMinute: null }); // no operation rateadmin() { printf 'header = "Authorization: Bearer %s"\n' "$MOUNTABLE_MANAGEMENT_KEY"; }
FS_URL="https://mountable.io/api/v1/orgs/$ORG_ID/filesystems/$FS_ID"
admin | curl -q -sS --fail-with-body --config - --request PATCH "$FS_URL" \
--header "Content-Type: application/json" --data '{"spending_cap_cents": 2000}'
admin | curl -q -sS --fail-with-body --config - --request PATCH "$FS_URL" \
--header "Content-Type: application/json" --data '{"mutations_per_minute": null}' # no operation rateTo show an end user what is left, read the limits and this month's usage
with the API key.
The usage adds reserved_cents and currency: how much of this month's cap
the filesystem already uses.
mountable fs get "$FS_ID" --json
mountable fs usage "$FS_ID" --jsonlimits = client.get_filesystem(user_fs.id)
usage = client.filesystem_usage(user_fs.id)
left = limits.spending_cap_cents - usage.reserved_cents if limits.spending_cap_cents is not None else Noneconst limits = await client.getFilesystem(userFs.id);
const usage = await client.filesystemUsage(userFs.id);
const left = limits.spendingCapCents === null ? null : limits.spendingCapCents - usage.reservedCents;auth() { printf 'header = "Authorization: Bearer %s"\n' "$MOUNTABLE_API_KEY"; }
auth | curl -q -sS --fail-with-body --config - "https://mountable.io/api/v1/orgs/$ORG_ID/filesystems/$FS_ID"
auth | curl -q -sS --fail-with-body --config - "https://mountable.io/api/v1/orgs/$ORG_ID/filesystems/$FS_ID/usage"The CLI and the SDKs find ORG_ID themselves; with curl it is
api_key.org_id (or management_key.org_id) from GET /api/v1/me.
How the spend cap counts
The cap works like the organisation cap, for this one filesystem. Files keep costing money after a worker disconnects, so the filesystem reserves a full month at its highest stored size and file count this month, plus its downloads. An upload reserves room before it starts and returns what it did not use. Deleting files does not free this month's peak. Each of the three charges rounds up to a whole cent, so a cap can admit a little more work before the next cent is reached.
A cap below what the filesystem already reserves is refused with
409 spending_cap_below_reserved and the minimum_cents you can set. A
saved payment method is required, because caps are in your billing currency.
Stored files are never deleted when a limit is reached. Usage beyond it is refused:
| Limit reached | Files API | Mount |
|---|---|---|
| filesystem spend cap | 402 filesystem_spending_cap_reached | ResourceExhausted, filesystem_spending_cap_reached |
| organisation spend cap | 402 spending_cap_reached | ResourceExhausted, spending_cap_reached |
| operation rate | 429 rate_limited, retry after Retry-After seconds | the change waits until the rate allows it (on Linux from CLI 0.8.4) |
| storage or entry quota | 409 quota_exceeded | the write fails |
When both caps are reached, you get the organisation code: raising the end user's cap would not help.
Who can change limits
- Owners and admins.
- A management key, while the person who created it is an owner or admin.
- Never an API key (
403 management_key_required): hand the end user's worker a key limited to its filesystem, and it cannot raise its own limits.
The organisation's spending cap can only be changed by a person on the Billing page; no key can raise it.
How many end users fit
One organisation can have up to 10,000 filesystems, so 10,000 end users,
each with any quota up to 100 GiB and 1,000,000 entries. Quotas are not added
up across filesystems. The 10,001st create is refused with
409 filesystem_limit; deleting a filesystem frees its place. Contact
support if your app needs more.
The CLI, the SDKs and the REST API set these limits. The MCP server and the console do not set them yet.