> ## 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 Organization Management APIs
- URL: https://blog.fabrixly.com/how-to-use-organization-management-apis/
- Published: 2026-07-07T14:10:50.000Z
- Updated: 2026-07-07T14:10:50.000Z
- Author: Fabrixly
- Tags: Documentation

This guide describes how to manage multi-tenant Organizations and Subdomains inside Fabrixly-IDS using the Organization REST APIs.

---

## 🔐 Authentication & Prerequisites

All organization 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`.*

---

## 1\. Create an Organization

Creates a new tenant organization partition.

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

### Request Body Parameters

| Parameter | Type   | Required | Description                                                                  |
| --------- | ------ | -------- | ---------------------------------------------------------------------------- |
| name      | string | Yes      | The name of the organization (e.g. Acme Corp).                               |
| domain    | string | Yes      | The domain associated with the organization (must be unique, e.g. acme.com). |

### Example Request (curl)

```bash
curl -X POST https://ids.fabrixly.com/api/organizations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "name": "Acme Corp",
    "domain": "acme.com"
  }'

```

### Response (`201 Created`)

```json
{
  "id": "org_xyz789abc",
  "name": "Acme Corp",
  "domain": "acme.com",
  "createdAt": "2026-07-07T12:00:00.000Z",
  "updatedAt": "2026-07-07T12:00:00.000Z"
}

```

### Error Responses

#### `400 Bad Request` (Domain already in use)

```json
{
  "error": "Organization with this domain already exists"
}

```

#### `403 Forbidden` (License limit exceeded or not System Admin)

```json
{
  "error": "Maximum organization limit reached for this system license. Please contact the administrator."
}

```

---

## 2\. List Organizations

Get all organizations.

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

### Example Request (curl)

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

```

### Response (`200 OK`)

```json
[
  {
    "id": "org_xyz789abc",
    "name": "Acme Corp",
    "subdomain": "acme",
    "domain": "acme.com",
    "status": "active"
  }
]

```

---

## 3\. Get Organization Details

Retrieves details of a specific organization by ID.

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

### Example Request (curl)

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

```

---

## 4\. Update Organization Settings

Modifies configurations of an existing organization.

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

### Example Request (curl)

```bash
curl -X PUT https://ids.fabrixly.com/api/organizations/org_xyz789abc \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-admin-jwt-token>" \
  -d '{
    "name": "Acme Corporation",
    "status": "active"
  }'

```

### Response (`200 OK`)

```json
{
  "id": "org_xyz789abc",
  "name": "Acme Corporation",
  "subdomain": "acme",
  "domain": "acme.com",
  "status": "active"
}

```

---

## 5\. Delete Organization

Deletes an organization and all associated database records.

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

### Example Request (curl)

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

```

### Response (`200 OK`)

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

```