Skip to content

Commit 0796b74

Browse files
committed
Add docs for member management api
1 parent f069210 commit 0796b74

File tree

1 file changed

+132
-0
lines changed

1 file changed

+132
-0
lines changed

docs/platform/integrations/api-reference.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,135 @@ The API responds with a 2xx status code on successful creation of a new rollout.
166166

167167
On success it returns a **Rollout** object as its JSON response payload,
168168
representing the current state of the newly created rollout.
169+
170+
## Member Management
171+
172+
Encore Cloud provides APIs for managing application members, including inviting users, listing members, and updating member roles.
173+
174+
### Member Object
175+
176+
```typescript
177+
type Member = {
178+
// The user's email address
179+
email: string;
180+
181+
// The member's role in the application
182+
role: "owner" | "reader" | "writer" | "none";
183+
184+
// When the member was invited to the application
185+
invited: timestamp;
186+
187+
// When the member accepted the invitation
188+
accepted: timestamp;
189+
190+
// When the membership expires
191+
expires: timestamp;
192+
193+
// The member's username
194+
username: string;
195+
196+
// The member's full name
197+
full_name: string;
198+
199+
// The member's picture URL
200+
picture_url: string;
201+
}
202+
```
203+
204+
### Available Roles
205+
206+
- **owner**: Full control over the application
207+
- **writer**: Can write application resources
208+
- **reader**: Can read application resources
209+
- **none**: Used to revoke access to an application
210+
211+
### Invite Member
212+
213+
Invite a new member to an Encore application.
214+
215+
**Method**: `POST` <br/>
216+
**Path**: `/api/apps/${APP_ID}/member`
217+
218+
#### Path Parameters
219+
220+
| Parameter | Description |
221+
| ---------- | ---------------------------------------------- |
222+
| **APP_ID** | The id of the Encore application. |
223+
224+
#### JSON Request Body
225+
226+
```typescript
227+
{
228+
// The email address of the user to invite
229+
"email": string;
230+
231+
// The role to assign to the invited member
232+
"role": "owner" | "reader" | "writer" | "none";
233+
}
234+
```
235+
236+
#### Response
237+
238+
The API responds with a 2xx status code on successful invitation.
239+
240+
On success it returns a **Member** object as its JSON response payload,
241+
representing the newly invited member.
242+
243+
### List Members
244+
245+
Retrieve a list of all members for an Encore application.
246+
247+
**Method**: `GET` <br/>
248+
**Path**: `/api/apps/${APP_ID}/members`
249+
250+
#### Path Parameters
251+
252+
| Parameter | Description |
253+
| ---------- | ---------------------------------------------- |
254+
| **APP_ID** | The id of the Encore application. |
255+
256+
#### Response
257+
258+
The API responds with a 2xx status code on success.
259+
260+
On success it returns an array of **Member** objects as its JSON response payload,
261+
representing all current members and pending invites for the application.
262+
263+
```typescript
264+
type Response = Member[];
265+
```
266+
267+
### Update Member Role
268+
269+
Update the role of an existing member.
270+
271+
**Method**: `PUT` <br/>
272+
**Path**: `/api/apps/${APP_ID}/members`
273+
274+
#### Path Parameters
275+
276+
| Parameter | Description |
277+
| ---------- | ---------------------------------------------- |
278+
| **APP_ID** | The id of the Encore application. |
279+
280+
#### JSON Request Body
281+
282+
```typescript
283+
{
284+
// The email address of the member to update
285+
"email": string;
286+
287+
// The new role to assign to the member
288+
"role": "owner" | "reader" | "writer" | "none";
289+
}
290+
```
291+
292+
#### Response
293+
294+
The API responds with a 2xx status code on successful update.
295+
296+
#### Error Cases
297+
298+
- **403 Forbidden**: Insufficient permissions to manage members
299+
- **409 Conflict**: Attempting to remove the last owner (error detail: "last_owner")
300+
- **404 Not Found**: Member not found

0 commit comments

Comments
 (0)