Skip to main content
Meridian uses custom ed25519-signed tokens — smaller than JWT, constant-time verification.

Bootstrap your first admin token

The HTTP token endpoint requires a token with admin: true. To generate one locally from your signing key (no server needed):
Store the output as $ADMIN_TOKEN. You can then use it to issue scoped client tokens via the HTTP API.
For production, generate client tokens server-side in your own backend using the same signing key via the HTTP API below. Use gen_demo_token only for local bootstrapping.

Token format

Claims:

Issue a token via HTTP

Response:

Permissions — V1 (glob lists)

V1 permissions use glob patterns matched against the CRDT key (crdt_id). Issue a V1 token with the permissions field:

Permissions — V2 (fine-grained rules)

V2 tokens add per-rule op masks, per-rule TTLs, and a rate limit override. Issue a V2 token with the rules field:

Rule fields

Rules are evaluated first-match-wins in order. The token-level expires_at still applies.

Op mask constants

Each CRDT type uses its own bit positions: Combine masks with bitwise OR: 0x01 | 0x02 = 0x03 allows both operations.

Example: read-only observer + increment-only counter

Example: time-limited write rule

{clientId} template — per-agent key scoping

Pattern values in V2 rules may contain the literal placeholder {clientId}. The server expands it to the token’s client_id before matching. This lets you issue a single token template that automatically scopes each agent to its own keys:
Agent 42 can write or:cart-42 but not or:cart-99. Agent 99, issued with the same rule template, can only write or:cart-99. This is especially useful for multi-agent systems where each agent must be isolated to its own slice of the namespace:

Rate limit override

The rl field (V2 only) sets a per-token rate limit in requests per second. This overrides the server default (100 req/s) for this specific token — useful to give trusted services higher throughput or restrict untrusted clients.

Backward compatibility

V1 and V2 tokens coexist without migration. Old V1 tokens continue to work unchanged. The server detects the version automatically from the token payload.
A token with write: ["*"] (V1) or w: [{ "p": "*" }] (V2) can write to any key in the namespace. In multi-user namespaces, always scope write permissions to the keys the client actually owns.

Inspect a token

GET /v1/namespaces/:ns/tokens/me decodes the caller’s token and returns its claims as JSON. Useful for debugging — no msgpack tooling needed.
V1 tokens return permissions with read, write, and admin fields instead.

Verify a token (SDK)

MeridianClient.create() automatically parses and validates the token before connecting: