Members
Add a member
Lets a person, by email, sign in to Flung and connect apps to this workspace.
POST
/v1/membersTL;DR
| Question | Answer |
|---|---|
| What does it do? | Add a member. |
| What does it need? | An API key or an OAuth access token. |
| What does it take? | A JSON body with the fields below. |
| What does it return? | Status 200 with a body of type Member. |
| In the SDK? | flung.members.add() |
| What can go wrong? | 401 Missing, unknown, revoked or expired API key; 403 Only an owner, or an API key, may change members; 422 The request failed validation; 429 Too many requests for this credential; wait for retry-after seconds. Every failure has the same error shape. |
What it does
Lets a person, by email, sign in to Flung and connect apps to this workspace. Adding an existing member changes their role.
Example
bash
curl -X POST 'https://api.flung.dev/v1/members' \ --header "Authorization: Bearer $FLUNG_API_KEY" \ --header 'Content-Type: application/json' \ --header "Idempotency-Key: $(uuidgen)" \ --data '{ "email": "sam@example.com"}'ts
import { Flung } from '@flung.dev/sdk'
const flung = new Flung({ apiKey: process.env.FLUNG_API_KEY! })const result = await flung.members.add({ email: 'sam@example.com',})js
const response = await fetch('https://api.flung.dev/v1/members', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.FLUNG_API_KEY}`, 'Content-Type': 'application/json', 'Idempotency-Key': crypto.randomUUID(), }, body: JSON.stringify({ email: 'sam@example.com', }),})if (!response.ok) throw new Error((await response.json()).error.message)const result = await response.json()A successful answer looks like this:
json
{ "userId": "usr_aaaaaaaaaaaaaaaaaaaaaaaa", "email": "string", "role": "owner", "createdAt": "2026-11-01T09:00:00.000Z"}Request body
The body has the type an object, with the fields below.
| Field | Type | Required | Description |
|---|---|---|---|
email | string | yes | They sign in with this address; nothing is sent to it now. at most 254 characters. |
role | "owner" | "member" | no | owner may add and remove members; both may connect apps to the workspace. default "member". |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | The member. | Member |
| 401 | Missing, unknown, revoked or expired API key. | Error |
| 403 | Only an owner, or an API key, may change members. | Error |
| 422 | The request failed validation. | Error |
| 429 | Too many requests for this credential; wait for retry-after seconds. | Error |
Response body
A 200 answer has the type Member.
| Field | Type | Required | Description |
|---|---|---|---|
userId | string | yes | |
email | string | yes | |
role | "owner" | "member" | yes | owner may add and remove members; both may connect apps to the workspace. |
createdAt | string | yes |
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint |
| Schemas | Every request and response type |
| Errors | Every error code and what to do about it |