sondahub / Identity API / Memberships
Fake memberships API
1,457 memberships from the Identity API, a fake user directory API. A person in a group. POST one to add someone (409 if they are in it already); DELETE it to take them out.
Reads with filters, sorting, search and relations; writes that answer like a real server and stay in your session token. Same ids on every build. Free, no key, CORS open.
Connect
- List
- https://api.sondahub.com/v1/identity/memberships
- One record
- https://api.sondahub.com/v1/identity/memberships/{id}
- OpenAPI 3
- https://api.sondahub.com/v1/identity/openapi.json
- GraphQL
- https://api.sondahub.com/v1/identity/graphql
- JSON file
- https://api.sondahub.com/data/identity/memberships.json
- MCP
- https://api.sondahub.com/mcp · list_records
curl "https://api.sondahub.com/v1/identity/memberships?limit=3"
Sample records
Records 1 to 3 of 1,457, exactly as GET /v1/identity/memberships/{id} answers them. The data file holds all of them.
[
{
"id": 1,
"created_at": "2023-05-26T12:00:00Z",
"updated_at": "2023-05-26T12:00:00Z",
"user_id": 1,
"group_id": 36,
"role": "owner"
},
{
"id": 2,
"created_at": "2023-05-26T12:00:00Z",
"updated_at": "2023-05-26T12:00:00Z",
"user_id": 1,
"group_id": 31,
"role": "member"
},
{
"id": 3,
"created_at": "2024-08-02T06:56:11Z",
"updated_at": "2024-08-02T06:56:11Z",
"user_id": 1,
"group_id": 30,
"role": "member"
}
]
Fields
| Field | Type | Notes |
|---|---|---|
idread-only | int | Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. |
created_atread-only | datetime | When the record was created (ISO 8601, UTC). |
updated_atread-only | datetime | When the record last changed. |
user_idrequired | int → users | |
group_idrequired | int → groups | |
role | enum | member owner |
Relations: user → one user through user_id; group → one group through group_id. Use ?expand=user,group to embed them, or the nested routes.
Endpoints
already_member), defaults role to member and bumps the group’s member_count; DELETE lowers it.Try it
curl "https://api.sondahub.com/v1/identity/memberships?role=owner&expand=user&limit=3"
curl https://api.sondahub.com/v1/identity/memberships/1?expand=user
curl -i -X POST https://api.sondahub.com/v1/identity/memberships \
-H "Content-Type: application/json" \
-d '{"user_id":1,"group_id":1,"role":"member"}'
curl "https://api.sondahub.com/v1/identity/memberships?sort=-id&limit=3" \ -H "X-Sondahub-Session: THE_TOKEN_FROM_THE_CREATE"
curl -X PATCH https://api.sondahub.com/v1/identity/memberships/1 \
-H "Content-Type: application/json" \
-d '{"role":"owner"}'
curl -X DELETE https://api.sondahub.com/v1/identity/memberships/1458 \ -H "X-Sondahub-Session: THE_TOKEN_FROM_THE_CREATE"
Query recipes
Every list option works on memberships; these are ready to paste. All the options.
| What | Request |
|---|---|
| Page 2, 50 at a time (of 1,457) | /v1/identity/memberships?page=2&limit=50 |
| Only role = member | /v1/identity/memberships?role=member |
| Newest first by created at | /v1/identity/memberships?sort=-created_at&limit=5 |
| Only some fields | /v1/identity/memberships?fields=id,user_id&limit=5 |
| Embed the user | /v1/identity/memberships/1?expand=user |
| Just the count | /v1/identity/memberships?limit=1&fields=id |
GraphQL
The same memberships as the memberships query on https://api.sondahub.com/v1/identity/graphql, and one membership as membership(id: 1). Introspection is on. More on the GraphQL API.
{
memberships(limit: 3, sort: "-id", filter: { role: member }) {
total
data {
id user_id group_id role
user { user_name }
}
}
}
curl https://api.sondahub.com/v1/identity/graphql -H "Content-Type: application/json" -d '{"query": "{ memberships(limit: 3, sort: \"-id\", filter: { role: member }) { total data { id user_id group_id role user { user_name } } } }"}'
From an AI agent (MCP)
The MCP server reaches the same rows with list_records, get_record, create_record, update_record and delete_record, and as the resource sondahub://identity/memberships.
curl https://api.sondahub.com/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_records","arguments":{"api":"identity","collection":"memberships","filters":{"role":"member"},"limit":3}}}'
More in the Identity API
The live streams, and the whole API on one page: Identity API. Other worlds: fake e-commerce API, fake IoT API, fake banking API, fake social media API, fake helpdesk API, fake flight booking API.