NIP-86 management

The JSON-RPC management API: moderation, access lists, relay identity, roles, invite claims and delegated method grants, with Bearer or NIP-98 authentication.

Enabling

NIP-86 is a JSON-RPC API for managing the relay. It needs one of two authentication methods, otherwise every call is refused:

MethodSetup
Bearer tokenSet rpc.management_token and send Authorization: Bearer <token>
NIP-98Set rpc.admin_pubkey and send a NIP-98 auth event (kind 27235) signed by the admin key in Authorization: Nostr <base64> — a payload tag is required; each event is single-use within its 60-second window

Calling the API

POST / with Content-Type: application/nostr+json+rpc:

sh
curl -X POST http://127.0.0.1:8080/ \
  -H "Content-Type: application/nostr+json+rpc" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{"method":"supportedmethods","params":[]}'

Methods

MethodParamsDescription
supportedmethods[]List of supported methods
banpubkey["pubkey", "reason (optional)"]Ban a pubkey from posting (also removes it from the allowlist)
unbanpubkey["pubkey"]Unban a pubkey
listbannedpubkeys[]List banned pubkeys and reasons
allowpubkey["pubkey", "reason (optional)"]Add to the allowlist (also un-bans)
unallowpubkey["pubkey"]Remove from the allowlist
listallowedpubkeys[]List the allowlist
allowkind / disallowkind[kind]Allow / disallow a kind
listallowedkinds / listdisallowedkinds[]List allowed / disallowed kinds
changerelayname / changerelaydescription / changerelayicon["new value"]Change the relay name / description / icon (persisted to the config file; reports an error when the file cannot be written)
createrole / editrole / deleterole[id, label, description, color, order]NIP-43 role management (wrong-typed fields are rejected; deleting a missing role succeeds)
assignrole / unassignrole["pubkey", "role id"]Assign / unassign a role (a duplicate grant or missing revocation succeeds)
assignmethod / unassignmethod["pubkey", "method"]Grant / revoke a NIP-86 method to a non-admin pubkey — only moderation and read methods are grantable
listmethodassignees[]List method grants ([{pubkey, methods}])
blockip / unblockip["ip", "reason (optional)"]Block / unblock an IP (blocking also drops existing connections)
listblockedips[]List blocked IPs
banevent["event id", "reason (optional)"]Ban an event (banning an unknown id pre-bans it; also removes it from the allowlist)
allowevent["event id", "reason (optional)"]Add an event to the allowlist (also lifts the ban; allowing an unknown id pre-allows it)
unallowevent / unbanevent["event id"]Remove an event from the allow / ban list (a missing entry succeeds)
listbannedevents[]List banned events (a failed lookup surfaces an error, never an empty list)
listallowedevents[]List allowed events
listeventsneedingmoderation[]Events awaiting moderation (always empty on this relay)
listclaims[]List NIP-43 invite codes
createclaim / deleteclaim["claim"]Issue / revoke a NIP-43 invite code (a kind:28934 carrying a listed code admits its author)
Delegated administration
rpc.admin_pubkey (and the management token) stay the root login with every method. Other pubkeys authenticate with NIP-98 and may only run their assignmethod-granted methods (supportedmethods shows their own subset). Permission, role, invite-claim and relay-identity management stay admin-only, so a grantee can never escalate. A banned pubkey is refused even with grants.
Served on the public POST / routes
The NIP-86 RPC is mounted on the relay's public POST / routes. Mutations are recorded in a rate-limited audit log (at most 600 entries per minute) with the authenticated identity. Requests over rpc.max_admin_body_bytes are refused with 413.