folkwaysDocs
Realtime API

POST /v1/kick and /v1/revoke

Disconnect an identity, or revoke one token, before the token expires.

Your backend can cut a user off before their token expires. JSON, not frames; service tokens only.

EndpointBodyEffect
POST /v1/kick{ "identity": "user:42" }Closes every WebSocket connection of that identity in the segment with Close { AuthRevoked }, within a second. Its tokens still work
POST /v1/revoke{ "jti": "9b1d3c0e-…" }Closes every connection holding the token with that jti, and refuses the token with AuthRevoked from then on, on every endpoint, until it would have expired
HTTP
POST https://realtime.folkways.net/v1/kick
Authorization: Bearer <service token with publish on $user/user:42>
Content-Type: application/json

{ "identity": "user:42" }
EndpointFieldMeaningThe service token needs
/v1/kickidentityThe sub to disconnect; one topic levelpublish on $user/{identity}
/v1/revokejtiThe token ID, 1 to 256 bytespublish on $user/>

Both answer 204 with no body, whether or not anyone was connected or the token was ever seen, so a request reveals nothing about who exists.

Banning a user

A kick alone doesn't keep anyone out: the app can reconnect with a token it still holds. To ban a user, stop issuing tokens for them and revoke the ones they hold, or kick them and let their tokens run out (at most 15 minutes). Only tokens with a jti can be revoked.

Revocations are kept in memory for the token's remaining lifetime, up to 10,000 per segment at a time, and don't yet survive a restart of the service. Keep tokens short-lived and stop issuing them, rather than relying on revocation alone.

Clients must not reconnect automatically after AuthRevoked: sign the user out, and reconnect only once your backend issues a new token.

Errors

StatuserrorWhen
401AuthRequired, AuthInvalid, AuthExpired, AuthRevokedNo token, or a bad one
403ForbiddenNot a service token, or without the right above
403SuspendedThe segment is suspended
400InvalidArgumentMalformed body
429QuotaExceeded/v1/revoke only: the segment already holds 10,000 revocations. Room comes back as they expire
429RateLimitedThe segment's backend request budget is used up. Wait retry_after_ms
503UnavailableTry again

No CORS: browsers never hold service tokens.

On this page