POST /v1/members/*
Keep the member list of a private topic, deciding who may use it and with which operations.
A private topic, one whose rule is Members only, has a member list your backend keeps. A user may do there only what their token ∩ the rule's operations ∩ their member entry allow. So tokens don't list rooms, and a token refresh can't undo a removal. JSON, not frames; service tokens only.
POST https://realtime.folkways.net/v1/members/add
Authorization: Bearer <service token with publish on the topic>
Content-Type: application/json
{ "topic": "dm/7f3a9c", "identities": ["user:1", "user:2"], "ops": ["subscribe", "publish", "set", "signal"] }Endpoints
| Endpoint | Body | Does | Response |
|---|---|---|---|
POST /v1/members/add | { topic, identities, ops } | Each identity gets exactly ops, whether or not it was a member | 204 |
POST /v1/members/set | { topic, identity, ops } | The same, for one identity. Narrow to ["subscribe"] to let someone read but not write | 204 |
POST /v1/members/remove | { topic, identities } | The identities lose every right in the topic. Not being a member isn't an error | 204 |
POST /v1/members/clear | { topic } | Everyone loses access: the room is closed | 204 |
POST /v1/members/list | { topic } | Lists the members | 200 { "topic", "members": [{ "identity", "ops" }] } |
| Field | Meaning |
|---|---|
topic | A topic name (not a pattern, not a $ topic) matched by a members-only rule |
identities, identity | Token subs, each one topic level, not anonymous. 1 to 1,000 per request |
ops | At least one of subscribe, publish, set, signal, history, presence. To take every right away, remove the member |
add and set replace a member's ops; they don't merge. A topic holds at most 10,000 members. The service token
needs publish on the topic.
When a change applies
The response comes once the change is stored. Removals apply first and at once:
- a removed member's subscriptions to the topic end with
SubEnded { Forbidden }, normally within milliseconds; - a long-poll they have waiting there returns at once with
Forbidden; - their next publish, subscribe or poll there gets
Forbidden, whatever token they hold.
A member narrowed to ["subscribe"] keeps their subscription and can no longer write. Grants apply once the
change is stored.
If the request fails with Unavailable, sending it again is safe. What it took away already applies; what it
granted doesn't.
Errors
| Status | error | When |
|---|---|---|
401 | AuthRequired, AuthInvalid, AuthExpired, AuthRevoked | No token, or a bad one |
403 | Forbidden | Not a service token; no rule for the topic; no publish on it |
403 | Suspended | The segment is suspended |
400 | InvalidArgument | Malformed body, or the topic's rule isn't members-only |
429 | QuotaExceeded | The topic would have more than 10,000 members; nothing changed |
429 | RateLimited | The segment's backend request budget is used up. Wait retry_after_ms |
503 | Unavailable | Try again |
No CORS: browsers never hold service tokens.