Skip to content

Commit d01be8d

Browse files
committed
doc: add post for members
1 parent 8364c58 commit d01be8d

File tree

1 file changed

+61
-1
lines changed

1 file changed

+61
-1
lines changed

src/content/docs/docs/public-api/members.mdx

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,54 @@ Organization members are users who have access to your Capgo organization. Each
3232

3333
## Endpoints
3434

35+
### POST
36+
37+
`https://api.capgo.app/organization/members/`
38+
39+
Add a new member to an organization or update an existing member's role. Note that you can only invite users who already have a Capgo account - the email must correspond to an existing Capgo user.
40+
41+
#### Request Body
42+
43+
```typescript
44+
interface MemberCreate {
45+
orgId: string
46+
email: string
47+
role: "read" | "upload" | "write" | "admin" | "super_admin"
48+
}
49+
```
50+
51+
#### Example Request
52+
53+
```bash
54+
curl -X POST \
55+
-H "authorization: your-api-key" \
56+
-H "Content-Type: application/json" \
57+
-d '{
58+
"orgId": "org_123",
59+
"email": "newmember@example.com",
60+
"role": "write"
61+
}' \
62+
https://api.capgo.app/organization/members/
63+
```
64+
65+
#### Success Response
66+
67+
```json
68+
{
69+
"status": "OK",
70+
"data": {
71+
"uid": "user_789",
72+
"email": "newmember@example.com",
73+
"role": "invite_write",
74+
"image_url": null
75+
}
76+
}
77+
```
78+
79+
Notes:
80+
- When adding a new member, they will receive an invitation email. Their role will be prefixed with "invite_" until they accept the invitation.
81+
- The user must already have a Capgo account before they can be invited. If they don't have an account, they should first create one at https://web.capgo.app/register/
82+
3583
### GET
3684

3785
`https://api.capgo.app/organization/members/`
@@ -155,11 +203,23 @@ Common error scenarios and their responses:
155203
"error": "Cannot remove the last admin from the organization",
156204
"status": "KO"
157205
}
206+
207+
// Invalid email
208+
{
209+
"error": "Invalid email format",
210+
"status": "KO"
211+
}
212+
213+
// Member already exists
214+
{
215+
"error": "Member already exists in organization",
216+
"status": "KO"
217+
}
158218
```
159219

160220
## Common Use Cases
161221

162222
1. **Team Expansion**: Adding new team members with appropriate roles
163223
2. **Access Control**: Managing member permissions as responsibilities change
164224
3. **Security Audit**: Reviewing member list and roles periodically
165-
4. **Team Restructuring**: Updating roles during organizational changes
225+
4. **Team Restructuring**: Updating roles during organizational changes

0 commit comments

Comments
 (0)