Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Relay Management

Manage Nostr relays used by your Portal instance. Relays store and forward Nostr messages.

API

  • addRelay(relay): Add a relay (e.g. wss://relay.damus.io). Returns confirmation.
  • removeRelay(relay): Remove a relay.
HTTP
# Add a relay
curl -s -X POST $BASE_URL/relays \
  -H "Authorization: Bearer $AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"relay": "wss://relay.damus.io"}'

# Remove a relay
curl -s -X DELETE $BASE_URL/relays \
  -H "Authorization: Bearer $AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"relay": "wss://relay.damus.io"}'
JavaScript
await client.addRelay('wss://relay.damus.io');
await client.removeRelay('wss://relay.damus.io');
Java
import cc.getportal.command.request.AddRelayRequest;
import cc.getportal.command.request.RemoveRelayRequest;

sdk.sendCommand(new AddRelayRequest("wss://relay.damus.io"), (res, err) -> {
    if (err != null) System.err.println(err);
});
sdk.sendCommand(new RemoveRelayRequest("wss://relay.damus.io"), (res, err) -> {
    if (err != null) System.err.println(err);
});

Common relays: wss://relay.damus.io, wss://relay.snort.social, wss://nos.lol, wss://relay.nostr.band. Use several for redundancy; respect user preferred relays from the key handshake when relevant.


Next: SDK