7 endpoints.
| Method | Path | Summary |
|---|---|---|
GET | /api/communities | Get all communities |
POST | /api/communities | Create a new community (Super Admin only) |
DELETE | /api/communities/{id} | Delete community (Super Admin only) |
GET | /api/communities/{id} | Get a single community by ID |
PUT | /api/communities/{id} | Update community (Community Admin or Super Admin) |
PATCH | /api/communities/{id}/archive | Archive (hide) a community - Community Admin only |
PATCH | /api/communities/{id}/unarchive | Unarchive (restore) a community - Community Admin only |
GET /api/communitiesAuth: Bearer JWT required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
page | query | no | integer | — |
limit | query | no | integer | — |
search | query | no | string | — |
Responses
| Status | Description | Body |
|---|---|---|
200 | Communities list with pagination | — |
POST /api/communitiesAuth: Bearer JWT required.
Request body (required) — application/json
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | — |
nameArabic | string | yes | — |
slug | string | yes | — |
description | string | no | — |
descriptionArabic | string | no | — |
logo | string | no | — |
type | enum: PUBLIC, PRIVATE | no | Community visibility (preferred — single source of truth). |
isPublic | boolean | no | Deprecated — pass type instead. Still accepted as input for back-compat; the underlying column was removed in the Community.isPublic removal plan, commit 4. |
Responses
| Status | Description | Body |
|---|---|---|
201 | Community created successfully | — |
403 | Only Super Admins can create communities | — |
DELETE /api/communities/{id}Auth: Bearer JWT required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
id | path | yes | string | — |
Responses
| Status | Description | Body |
|---|---|---|
200 | Community deleted | — |
403 | Only Super Admins can delete communities | — |
GET /api/communities/{id}Auth: Bearer JWT required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
id | path | yes | string | — |
Responses
| Status | Description | Body |
|---|---|---|
200 | Community details | — |
404 | Community not found | — |
PUT /api/communities/{id}Auth: Bearer JWT required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
id | path | yes | string | — |
Responses
| Status | Description | Body |
|---|---|---|
200 | Community updated | — |
PATCH /api/communities/{id}/archiveChanges community status to ARCHIVED, hiding it from listings while preserving all data Auth: Bearer JWT required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
id | path | yes | string | Community ID |
Responses
| Status | Description | Body |
|---|---|---|
200 | Community archived successfully | — |
401 | Authentication required | — |
403 | Only Community Admins can archive their community | — |
404 | Community not found | — |
PATCH /api/communities/{id}/unarchiveChanges community status from ARCHIVED back to ACTIVE, making it visible again Auth: Bearer JWT required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
id | path | yes | string | Community ID |
Responses
| Status | Description | Body |
|---|---|---|
200 | Community restored successfully | — |
401 | Authentication required | — |
403 | Only Community Admins can restore their community | — |
404 | Community not found | — |