> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scaling.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Team Members

> Manage your organization members and invitations.

These endpoints let you list, invite, remove, and manage the roles of members in your organization. You can also revoke pending invitations.

<Note>
  All team management endpoints require the `org:admin` role. Requests from non-admin members will receive a `401 not_authorized` error.
</Note>

***

### GET /api/team/members

List all current members of your organization and any pending invitations.

**Authentication**

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

**Example request**

```bash theme={null}
curl https://api.scaling.cloud/v1/team/members \
  -H "Authorization: Bearer YOUR_API_KEY"
```

**Example response**

```json theme={null}
{
  "data": {
    "members": [
      {
        "id": "user_2abc123def456",
        "email": "jane@example.com",
        "firstName": "Jane",
        "lastName": "Smith",
        "imageUrl": "https://example.com/avatars/jane.jpg",
        "role": "org:admin",
        "joinedAt": "2025-01-15T09:30:00.000Z"
      },
      {
        "id": "user_3xyz789ghi012",
        "email": "bob@example.com",
        "firstName": "Bob",
        "lastName": "Jones",
        "imageUrl": null,
        "role": "org:member",
        "joinedAt": "2025-03-22T14:00:00.000Z"
      }
    ],
    "invitations": [
      {
        "id": "orginv_4lmn321opq654",
        "emailAddress": "alice@example.com",
        "role": "org:member",
        "status": "pending",
        "createdAt": "2026-04-05T10:00:00.000Z"
      }
    ]
  }
}
```

**Error codes**

| Status | Code             | Description                                                    |
| ------ | ---------------- | -------------------------------------------------------------- |
| `401`  | `not_authorized` | You are not authenticated or do not have the `org:admin` role. |

***

### POST /api/team/members/invite

Send an invitation to a new member by email address. The invited person will receive an email prompting them to join your organization.

**Authentication**

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

**Request body**

<ParamField body="emailAddress" type="string" required>
  The email address to send the invitation to. Must be a valid email and no longer than 320 characters.
</ParamField>

<ParamField body="role" type="&#x22;org:admin&#x22; | &#x22;org:member&#x22;" required>
  The role to assign to the invitee upon accepting. Use `org:admin` to grant admin access or `org:member` for standard access.
</ParamField>

**Example request**

```bash theme={null}
curl -X POST https://api.scaling.cloud/v1/team/members/invite \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "emailAddress": "alice@example.com",
    "role": "org:member"
  }'
```

**Example response**

```json theme={null}
{
  "data": {
    "id": "orginv_4lmn321opq654",
    "emailAddress": "alice@example.com",
    "role": "org:member",
    "status": "pending",
    "createdAt": "2026-04-07T11:20:00.000Z"
  }
}
```

**Error codes**

| Status | Code                    | Description                                                    |
| ------ | ----------------------- | -------------------------------------------------------------- |
| `400`  | `invalid_request_error` | The request body is missing or contains invalid fields.        |
| `401`  | `not_authorized`        | You are not authenticated or do not have the `org:admin` role. |
| `500`  | `server_error`          | An unexpected error occurred.                                  |

***

### PATCH /api/team/members/{userId}/role

Update the role of an existing organization member.

<Warning>
  You cannot change your own role. Attempting to do so returns a `400 cannot_change_own_role` error. Similarly, you cannot remove yourself from the organization — that returns a `400 cannot_remove_self` error on the delete endpoint.
</Warning>

**Authentication**

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

**Path parameters**

<ParamField path="userId" type="string" required>
  The ID of the member whose role you want to update. You can retrieve member IDs from the `GET /api/team/members` response.
</ParamField>

**Request body**

<ParamField body="role" type="&#x22;org:admin&#x22; | &#x22;org:member&#x22;" required>
  The new role to assign to the member.
</ParamField>

**Example request**

```bash theme={null}
curl -X PATCH https://api.scaling.cloud/v1/team/members/user_3xyz789ghi012/role \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "org:admin"
  }'
```

**Example response**

```json theme={null}
{
  "data": {
    "id": "user_3xyz789ghi012",
    "role": "org:admin"
  }
}
```

**Error codes**

| Status | Code                     | Description                                                    |
| ------ | ------------------------ | -------------------------------------------------------------- |
| `400`  | `cannot_change_own_role` | You attempted to change your own role, which is not allowed.   |
| `401`  | `not_authorized`         | You are not authenticated or do not have the `org:admin` role. |
| `500`  | `server_error`           | An unexpected error occurred.                                  |

***

### DELETE /api/team/members/{userId}

Remove a member from your organization. This revokes their access immediately.

**Authentication**

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

**Path parameters**

<ParamField path="userId" type="string" required>
  The ID of the member to remove. You can retrieve member IDs from the `GET /api/team/members` response.
</ParamField>

**Example request**

```bash theme={null}
curl -X DELETE https://api.scaling.cloud/v1/team/members/user_3xyz789ghi012 \
  -H "Authorization: Bearer YOUR_API_KEY"
```

**Example response**

```json theme={null}
{
  "data": {
    "success": true
  }
}
```

**Error codes**

| Status | Code                 | Description                                                                   |
| ------ | -------------------- | ----------------------------------------------------------------------------- |
| `400`  | `cannot_remove_self` | You attempted to remove yourself from the organization, which is not allowed. |
| `401`  | `not_authorized`     | You are not authenticated or do not have the `org:admin` role.                |
| `500`  | `server_error`       | An unexpected error occurred.                                                 |

***

### DELETE /api/team/members/invitations/{invitationId}

Revoke a pending invitation. The invitee will no longer be able to accept it.

**Authentication**

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

**Path parameters**

<ParamField path="invitationId" type="string" required>
  The ID of the invitation to revoke. You can retrieve invitation IDs from the `GET /api/team/members` response.
</ParamField>

**Example request**

```bash theme={null}
curl -X DELETE https://api.scaling.cloud/v1/team/members/invitations/orginv_4lmn321opq654 \
  -H "Authorization: Bearer YOUR_API_KEY"
```

**Example response**

```json theme={null}
{
  "data": {
    "success": true
  }
}
```

**Error codes**

| Status | Code             | Description                                                    |
| ------ | ---------------- | -------------------------------------------------------------- |
| `401`  | `not_authorized` | You are not authenticated or do not have the `org:admin` role. |
| `500`  | `server_error`   | An unexpected error occurred.                                  |
