Step 1 of 5
Same address, plain HTTP
The management API lives at the relay's own URL, reached over https instead of wss. The relay spots it by the Content-Type application/nostr+json+rpc.
NIP-86
DraftHTTP
An HTTP API, on the same address as the relay's WebSocket, that lets a relay operator ban pubkeys, allow kinds and moderate events with simple JSON-RPC calls signed through NIP-98.
Edit the form or the JSON: both stay in sync, the badge says whether the result is valid, and tapping any field explains it.
How the parts connect: Sign, then call
Select any field in the form or the JSON to see what it does.
Step 1 of 5
The management API lives at the relay's own URL, reached over https instead of wss. The relay spots it by the Content-Type application/nostr+json+rpc.
No course chapter covers this NIP yet. The editor above is the quickest way in.
Every call is authorized with a NIP-98 event in the Authorization header.
The relay information document is served from the same URL with a different Accept header.
The claim methods manage NIP-43 invite codes.
NIP-42 authenticates WebSocket clients; this API uses HTTP auth instead.
Specification text is quoted in English from the nostr-protocol/nips repository. Our explanations and the interface are translated. Source on GitHub at commit 0046368
Relays may provide an API for performing management tasks. This is made available as a JSON-RPC-like request-response protocol over HTTP, on the same URI as the relay's websocket.
When a relay receives an HTTP(s) request with a Content-Type header of application/nostr+json+rpc to a URI supporting WebSocket upgrades, it should parse the request as a JSON document with the following fields:
{
"method": "<method-name>",
"params": ["<array>", "<of>", "<parameters>"]
}
Then it should return a response in the format
{
"result": {"<arbitrary>": "<value>"},
"error": "<optional error message, if the call has errored>"
}
This is the list of methods that may be supported:
supportedmethodsLists the methods supported by the relay. May be customized to match permissions assigned to the authenticated user.
[]["<method-name>", "<method-name>", ...] (an array with the names of all the other supported methods)banpubkeyBans a pubkey from the relay. Should automatically remove the pubkey from the allow list.
["<32-byte-hex-public-key>", "<optional-reason>"]true (a boolean always set to true)unbanpubkeyRemoves a pubkey from the relay's ban list. Should not automatically add the pubkey to the allow list.
["<32-byte-hex-public-key>", "<optional-reason>"]true (a boolean always set to true)listbannedpubkeysLists pubkeys banned from the relay.
[][{"pubkey": "<32-byte-hex>", "reason": "<optional-reason>"}, ...], an array of objectsallowpubkeyAdds a pubkey to the relay's allow list. Should automatically remove the pubkey from the ban list.
["<32-byte-hex-public-key>", "<optional-reason>"]true (a boolean always set to true)unallowpubkeyRemoves a pubkey from the relay's allow list. Should not automatically add the pubkey to the ban list.
["<32-byte-hex-public-key>", "<optional-reason>"]true (a boolean always set to true)listallowedpubkeysLists pubkeys on the relay's allow list.
[][{"pubkey": "<32-byte-hex>", "reason": "<optional-reason>"}, ...], an array of objectscreateroleCreates a new role.
[id, label, description, color, order]true (boolean true)editroleUpdates an existing role.
[id, label, description, color, order]true (boolean true)deleteroleDeletes a role.
[id]true (boolean true)assignroleAssigns a role to a pubkey.
["<32-byte-hex-public-key>", "<role-id>"]true (a boolean always set to true)unassignroleRemoves a role from a pubkey.
["<32-byte-hex-public-key>", "<role-id>"]true (a boolean always set to true)listclaimsLists NIP 43 invite codes currently accepted by the relay.
[][claim, ...], an array of NIP 43 invite codescreateclaimCreates a new NIP 43 invite code.
[claim]true (boolean true)deleteclaimRevokes a NIP 43 invite code.
[claim]true (boolean true)listeventsneedingmoderationLists events awaiting moderation.
[][{"id": "<32-byte-hex>", "reason": "<optional-reason>"}], an array of objectsalloweventAdds an event to the relay's allow list. Should automatically remove the event from the ban list.
["<32-byte-hex-event-id>", "<optional-reason>"]true (a boolean always set to true)unalloweventRemoves an event from the relay's allow list. Should not automatically add the event to the ban list.
["<32-byte-hex-event-id>", "<optional-reason>"]true (a boolean always set to true)baneventBans an event from the relay. Should automatically remove the event from the allow list.
["<32-byte-hex-event-id>", "<optional-reason>"]true (a boolean always set to true)unbaneventRemoves an event from the relay's ban list. Should not automatically add the event to the allow list.
["<32-byte-hex-event-id>", "<optional-reason>"]true (a boolean always set to true)listbannedeventsLists events banned from the relay.
[][{"id": "<32-byte hex>", "reason": "<optional-reason>"}, ...], an array of objectslistallowedeventsLists events on the relay's allow list.
[][{"id": "<32-byte-hex>", "reason": "<optional-reason>"}, ...], an array of objectschangerelaynameChanges the relay's name.
["<new-name>"]true (a boolean always set to true)changerelaydescriptionChanges the relay's description.
["<new-description>"]true (a boolean always set to true)changerelayiconChanges the relay's icon.
["<new-icon-url>"]true (a boolean always set to true)allowkindAdds an event kind to the relay's allow list.
[<kind-number>]true (a boolean always set to true)disallowkindDisallows an event kind.
[<kind-number>]true (a boolean always set to true)listallowedkindsLists event kinds on the relay's allow list.
[][<kind-number>, ...], an array of numberslistdisallowedkindsLists event kinds the relay disallows.
[][<kind-number>, ...], an array of numbersblockipAdds an IP address to the relay's block list.
["<ip-address>", "<optional-reason>"]true (a boolean always set to true)unblockipRemoves an IP address from the relay's block list.
["<ip-address>"]true (a boolean always set to true)listblockedipsLists IP addresses blocked by the relay.
[][{"ip": "<ip-address>", "reason": "<optional-reason>"}, ...], an array of objectsThe request must contain an Authorization header with a valid NIP-98 event, except the payload tag is required. The u tag is the relay URL.
If Authorization is not provided or is invalid, the endpoint should return a 401 response.