[Goto Home](/docs/index.html)

# 🔒 GET `/admin/communities`

## Request Query

- **limit** - default `10`; set the number of items to return on each page
- **page** - default `1`; set the page for which to return the items
- **search** - `optional`; search by name or id

## Description

- Returns a list of all communities with pagination.

## Response Body

```json
{
  "communities": [
    {
      "_id": "6940fb887695b40bdcd6046c",
      "id": "CONCORDIA",
      "name": "Concordia",
      "isUniversity": true,
      "emailDomain": "concordia.ca",
      "createdAt": "2026-03-02T06:27:41.335Z",
      "updatedAt": "2026-03-02T06:27:41.335Z"
    },
    {
      "_id": "6940fb887695b40bdcd6053c",
      "id": "MCGILL",
      "name": "McGill",
      "isUniversity": true,
      "emailDomain": "mcgill.ca",
      "createdAt": "2026-02-23T06:27:41.335Z",
      "updatedAt": "2026-02-23T06:27:41.335Z"
    },
    {
      "_id": "6940fb887695b40bdcd6043f",
      "id": "MIT",
      "name": "MIT",
      "isUniversity": true,
      "emailDomain": "mit.edu",
      "isRelief": true,
      "createdAt": "2026-02-23T06:27:41.335Z",
      "updatedAt": "2026-02-23T06:27:41.335Z"
    },
    {
      "_id": "69bd07bb15e578b4bc3295f6",
      "id": "UAE",
      "name": "UAE",
      "isRelief": true,
      "createdAt": "2026-02-23T06:27:41.335Z",
      "updatedAt": "2026-03-24T07:14:52.557Z",
      "emergencyContacts": [
        {
          "name": "Police",
          "phone": "112",
          "emoji": "🚔",
          "color": "#ff0000",
          "_id": "69c239d1dbf330fdb2803450"
        },
        {
          "name": "Ambulance",
          "phone": "102",
          "emoji": "🚑",
          "color": "#001eff",
          "_id": "69c239ecdbf330fdb280345a"
        }
      ]
    }
  ],
  "count": 4
}
```

# 🔒 GET `/admin/communities/:id`

## Description

- Returns the details of a specific community.

## Response Body

```json
{
  "community": {
    "_id": "69bd07bb15e578b4bc3295f6",
    "id": "UAE",
    "name": "UAE",
    "isRelief": true,
    "createdAt": "2026-02-23T06:27:41.335Z",
    "updatedAt": "2026-03-24T07:14:52.557Z",
    "emergencyContacts": [
      {
        "name": "Police",
        "phone": "112",
        "emoji": "🚔",
        "color": "#ff0000",
        "_id": "69c239d1dbf330fdb2803450"
      },
      {
        "name": "Ambulance",
        "phone": "102",
        "emoji": "🚑",
        "color": "#001eff",
        "_id": "69c239ecdbf330fdb280345a"
      }
    ]
  }
}
```

# 🔒 PATCH `/admin/communities/:id`

## Request Body

- **isRelief** - `boolean`; set or unset relief mode

## Description

- Updates the `isRelief` field of a community.

## Response Body

```json
{
  "community": {
    "_id": "69bd07bb15e578b4bc3295f6",
    "id": "UAE",
    "name": "UAE",
    "isRelief": true,
    "createdAt": "2026-02-23T06:27:41.335Z",
    "updatedAt": "2026-03-24T07:17:31.149Z",
    "emergencyContacts": [
      {
        "name": "Police",
        "phone": "112",
        "emoji": "🚔",
        "color": "#ff0000",
        "_id": "69c239d1dbf330fdb2803450"
      },
      {
        "name": "Ambulance",
        "phone": "102",
        "emoji": "🚑",
        "color": "#001eff",
        "_id": "69c239ecdbf330fdb280345a"
      }
    ]
  }
}
```

# 🔒 POST `/admin/communities/:id/emergency-contacts`

## Request Body

- **name** - `string`; contact name
- **phone** - `string`; contact phone
- **emoji** - `string`; contact emoji
- **color** - `string`; hex color code (e.g. #ff0000)

## Description

- Adds a new emergency contact to a community.

## Response Body

```json
{
  "community": {
    "_id": "69bd07bb15e578b4bc3295f6",
    "id": "UAE",
    "name": "UAE",
    "isRelief": true,
    "createdAt": "2026-02-23T06:27:41.335Z",
    "updatedAt": "2026-03-24T07:19:03.541Z",
    "emergencyContacts": [
      {
        "name": "Police",
        "phone": "112",
        "emoji": "🚔",
        "color": "#ff0000",
        "_id": "69c239d1dbf330fdb2803450"
      },
      {
        "name": "Ambulance",
        "phone": "102",
        "emoji": "🚑",
        "color": "#001eff",
        "_id": "69c239ecdbf330fdb280345a"
      },
      {
        "name": "Emerency",
        "phone": "112",
        "emoji": "✅",
        "color": "#ff1234",
        "_id": "69c23ae7dbf330fdb2803478"
      }
    ]
  }
}
```

# 🔒 DELETE `/admin/communities/:id/emergency-contacts/:contactId`

## Description

- Deletes an emergency contact from a community.

## Response Body

```json
{
  "community": {
    "_id": "69bd07bb15e578b4bc3295f6",
    "id": "UAE",
    "name": "UAE",
    "isRelief": true,
    "createdAt": "2026-02-23T06:27:41.335Z",
    "updatedAt": "2026-03-24T07:19:46.375Z",
    "emergencyContacts": [
      {
        "name": "Police",
        "phone": "112",
        "emoji": "🚔",
        "color": "#ff0000",
        "_id": "69c239d1dbf330fdb2803450"
      },
      {
        "name": "Ambulance",
        "phone": "102",
        "emoji": "🚑",
        "color": "#001eff",
        "_id": "69c239ecdbf330fdb280345a"
      }
    ]
  }
}
```

# Links

[Goto Home](/docs/index.html)
