> ## Content Index
> Fetch the complete content index at: https://blog.fabrixly.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Use Role and Team Management APIs
- URL: https://blog.fabrixly.com/how-to-use-role-and-team-management-apis/
- Published: 2026-07-07T14:10:53.000Z
- Updated: 2026-07-07T14:10:53.000Z
- Author: Fabrixly
- Tags: Documentation

This guide describes how to manage role-based access control (RBAC) Roles and Teams inside Fabrixly-IDS.

---

## 🔐 Authentication & Prerequisites

All role and team management endpoints require administrative authentication. To call them:

1. **Include the Token in the Authorization Header**: Add `-H "Authorization: Bearer <your-admin-jwt-token>"` to your API calls.

**Obtain an Admin JWT Token**:

```bash
curl -X POST https://ids.fabrixly.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "admin@example.com",
    "password": "your-admin-password"
  }'

```

*Note: This returns a JSON response containing a `token`.*

---

## Part A: Role Management APIs

Roles define specific sets of privileges (permissions) for users within the organization context.

### 1\. Create a Role

- **HTTP Method**: `POST`
- **Path**: `/api/roles`
- **Headers**:
  - `Content-Type: application/json`
  - `Authorization: Bearer <your-admin-jwt-token>`

#### Example Request (curl)

```bash
curl -X POST https://ids.fabrixly.com/api/roles \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "name": "SUPPORT_STAFF",
    "description": "Customer support agents with access to user profiles"
  }'

```

#### Response (`201 Created`)

```json
{
  "id": "rol_123xyz789",
  "name": "SUPPORT_STAFF",
  "description": "Customer support agents with access to user profiles"
}

```

### 2\. List Roles

- **HTTP Method**: `GET`
- **Path**: `/api/roles`
- **Headers**:
  - `Authorization: Bearer <your-admin-jwt-token>`

#### Example Request (curl)

```bash
curl -X GET https://ids.fabrixly.com/api/roles \
  -H "Authorization: Bearer <your-admin-jwt-token>"

```

#### Response (`200 OK`)

```json
[
  {
    "id": "rol_123xyz789",
    "name": "SUPPORT_STAFF",
    "description": "Customer support agents with access to user profiles"
  }
]

```

### 3\. Delete a Role

- **HTTP Method**: `DELETE`
- **Path**: `/api/roles/:id`
- **Headers**:
  - `Authorization: Bearer <your-admin-jwt-token>`

#### Example Request (curl)

```bash
curl -X DELETE https://ids.fabrixly.com/api/roles/rol_123xyz789 \
  -H "Authorization: Bearer <your-admin-jwt-token>"

```

#### Response (`200 OK`)

```json
{
  "message": "Role deleted successfully"
}

```

---

## Part B: Team Management APIs

Teams segment users into collaborative divisions (e.g., Engineering, Marketing, Finance).

### 1\. Create a Team

- **HTTP Method**: `POST`
- **Path**: `/api/teams`
- **Headers**:
  - `Content-Type: application/json`
  - `Authorization: Bearer <your-admin-jwt-token>`

#### Example Request (curl)

```bash
curl -X POST https://ids.fabrixly.com/api/teams \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "name": "Engineering Support Team",
    "description": "Team handling active developer integrations"
  }'

```

#### Response (`201 Created`)

```json
{
  "id": "tem_987abc654",
  "name": "Engineering Support Team",
  "description": "Team handling active developer integrations"
}

```

### 2\. List Teams

- **HTTP Method**: `GET`
- **Path**: `/api/teams`
- **Headers**:
  - `Authorization: Bearer <your-admin-jwt-token>`

#### Example Request (curl)

```bash
curl -X GET https://ids.fabrixly.com/api/teams \
  -H "Authorization: Bearer <your-admin-jwt-token>"

```

#### Response (`200 OK`)

```json
[
  {
    "id": "tem_987abc654",
    "name": "Engineering Support Team",
    "description": "Team handling active developer integrations"
  }
]

```

### 3\. Update Team Details

- **HTTP Method**: `PUT`
- **Path**: `/api/teams/:id`
- **Headers**:
  - `Content-Type: application/json`
  - `Authorization: Bearer <your-admin-jwt-token>`

#### Example Request (curl)

```bash
curl -X PUT https://ids.fabrixly.com/api/teams/tem_987abc654 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "name": "Engineering Support Team (Updated)"
  }'

```

#### Response (`200 OK`)

```json
{
  "id": "tem_987abc654",
  "name": "Engineering Support Team (Updated)",
  "description": "Team handling active developer integrations"
}

```

### 4\. Delete a Team

- **HTTP Method**: `DELETE`
- **Path**: `/api/teams/:id`
- **Headers**:
  - `Authorization: Bearer <your-admin-jwt-token>`

#### Example Request (curl)

```bash
curl -X DELETE https://ids.fabrixly.com/api/teams/tem_987abc654 \
  -H "Authorization: Bearer <your-admin-jwt-token>"

```

#### Response (`200 OK`)

```json
{
  "message": "Team deleted successfully"
}

```