> For the complete documentation index, see [llms.txt](https://convexity-tech-team.gitbook.io/chats-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://convexity-tech-team.gitbook.io/chats-documentation/technical-documentation/api-documentation/admin.md).

# Admin

Admin Management

## Get all NGOs

<mark style="color:blue;">`GET`</mark> `https://staging-api.chats.cash/v1/admin/ngos`

This endpoint is used to get all NGOs.

Authorization Header takes in the Bearer token generated from the login of the Admin&#x20;

#### Headers

| Name                                            | Type | Description     |
| ----------------------------------------------- | ---- | --------------- |
| Authorization<mark style="color:red;">\*</mark> |      | Bearer \<token> |

{% tabs %}
{% tab title="200: OK NGOs retrieved" %}

{% endtab %}

{% tab title="404: Not Found Internal Server Error" %}

{% endtab %}
{% endtabs %}

## Get all Vendors

<mark style="color:blue;">`GET`</mark> `https://staging-api.chats.cash/v1/admin/vendors`

This endpoint is used to get all Vendors.

Authorization Header takes in the Bearer token generated from the login of the Admin&#x20;

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<token> |

{% tabs %}
{% tab title="200: OK Vendors retrieved" %}

{% endtab %}

{% tab title="404: Not Found Internal Server Error" %}

{% endtab %}
{% endtabs %}

## Get all beneficiaries

<mark style="color:blue;">`GET`</mark> `https://staging-api.chats.cash/v1/admin/beneficiaries`

This endpoint is used to get all beneficiaries

Authorization Header takes in the Bearer token generated from the login of the Admin&#x20;

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<token> |

{% tabs %}
{% tab title="200: OK Beneficiaries retrieved" %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}
{% endtabs %}

## Get all campaigns

<mark style="color:blue;">`GET`</mark> `https://staging-api.chats.cash/v1/admin/campaigns`

This endpoint is used to get all campaigns

Authorization Header takes in the Bearer token generated from the login of the Admin&#x20;

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<token> |

{% tabs %}
{% tab title="200: OK Campaign retrieved" %}

{% endtab %}

{% tab title="404: Not Found Internal error occured. Please try again" %}

{% endtab %}
{% endtabs %}

## Get all donors

<mark style="color:blue;">`GET`</mark> `https://staging-api.chats.cash/v1admin/donors`

This endpoint is used to get all donors

Authorization Header takes in the Bearer token generated from the login of the Admin&#x20;

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<token> |

{% tabs %}
{% tab title="200: OK Donors retrieved" %}

{% endtab %}

{% tab title="404: Not Found Server Error. Unexpected error. Please retry" %}

{% endtab %}
{% endtabs %}

## Get all donors' withdrawal requests

<mark style="color:blue;">`GET`</mark> `https://staging-api.chats.cash/v1/admin/withdrawal-requests`

This endpoint is used to get all donors' withdrawal requests.

Authorization Header takes in the Bearer token generated from the login of the Admin&#x20;

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<token> |

{% tabs %}
{% tab title="200: OK Donor withdrawal requests" %}

{% endtab %}

{% tab title="500: Internal Server Error Internal server error. Contact support" %}

{% endtab %}
{% endtabs %}

## Approve / reject Donor's withdrawal request

<mark style="color:green;">`POST`</mark> `https://staging-api.chats.cash/v1/admin/approve-reject-request/:organisation_id`

This endpoint is used to approve the withdrawal request

Authorization Header takes in the Bearer token generated from the login of the Admin&#x20;

#### Path Parameters

| Name                                               | Type   | Description        |
| -------------------------------------------------- | ------ | ------------------ |
| organisation\_id<mark style="color:red;">\*</mark> | String | ID of organisation |

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<token> |

#### Request Body

| Name                                           | Type   | Description                                              |
| ---------------------------------------------- | ------ | -------------------------------------------------------- |
| campaign\_id<mark style="color:red;">\*</mark> | String | ID of campaign                                           |
| type<mark style="color:red;">\*</mark>         | String | <p>The approval type</p><p></p><p>\[approve, reject]</p> |
| request\_id<mark style="color:red;">\*</mark>  | String | ID or request                                            |

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal server error. Contact support" %}

{% endtab %}
{% endtabs %}

## Update User status

<mark style="color:green;">`POST`</mark> `https://staging-api.chats.cash/v1/admin/update-status`

This endpoint is used to update the status of a user.

Authorization Header takes in the Bearer token generated from the login of the Admin&#x20;

#### Headers

| Name          | Type   | Description     |
| ------------- | ------ | --------------- |
| Authorization | String | Bearer \<token> |

#### Request Body

| Name                                     | Type   | Description                                       |
| ---------------------------------------- | ------ | ------------------------------------------------- |
| userId<mark style="color:red;">\*</mark> | String | Id of user                                        |
| status<mark style="color:red;">\*</mark> | String | <p>status type </p><p>\[activated, suspended]</p> |

{% tabs %}
{% tab title="201: Created User status updated" %}

{% endtab %}

{% tab title="500: Internal Server Error Internal server error. Contact support" %}

{% endtab %}
{% endtabs %}

## Vendor Transactions

<mark style="color:blue;">`GET`</mark> `https://staging-api.chats.cash/v1/admin/vendor-transactions/:vendor_id`

This endpoint is used to get the transaction of a vendor.

Authorization Header takes in the Bearer token generated from the login of the Admin&#x20;

#### Path Parameters

| Name                                         | Type   | Description  |
| -------------------------------------------- | ------ | ------------ |
| vendor\_id<mark style="color:red;">\*</mark> | String | ID of vendor |

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<token> |

{% tabs %}
{% tab title="200: OK vendor transactions retrieved" %}

{% endtab %}

{% tab title="500: Internal Server Error Internal server error. Contact support" %}

{% endtab %}
{% endtabs %}

## Beneficiary Registration

<mark style="color:green;">`POST`</mark> `https://staging-api.chats.cash/v1/admin/register-beneficiary`

This endpoint enables an Admin to register a new Beneficiary

Authorization Header takes in the Bearer token generated from the login of the Admin&#x20;

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<token> |

#### Request Body

| Name                                          | Type   | Description               |
| --------------------------------------------- | ------ | ------------------------- |
| first\_name<mark style="color:red;">\*</mark> | String | First name of Beneficiary |
| first\_name<mark style="color:red;">\*</mark> | String | Last name of Beneficiary  |
| email<mark style="color:red;">\*</mark>       | String | Email of Beneficiary      |
| phone<mark style="color:red;">\*</mark>       | String | Phone of Beneficiary      |

{% tabs %}
{% tab title="201: Created Beneficiary registered successfully" %}

{% endtab %}

{% tab title="500: Internal Server Error Internal server error. Please try again later." %}

{% endtab %}
{% endtabs %}

## Vendor Registration

<mark style="color:green;">`POST`</mark> `https://staging-api.chats.cash/v1/admin/register-vendor`

This endpoint enables an Admin to register a new Vendor

Authorization Header takes in the Bearer token generated from the login of the Admin&#x20;

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<token> |

#### Request Body

| Name                                          | Type   | Description          |
| --------------------------------------------- | ------ | -------------------- |
| first\_name<mark style="color:red;">\*</mark> | String | First name of Vendor |
| last\_name<mark style="color:red;">\*</mark>  | String | Last name of Vendor  |
| email<mark style="color:red;">\*</mark>       | String | Email of Vendor      |
| phone<mark style="color:red;">\*</mark>       | String | Phone of Vendor      |
| location<mark style="color:red;">\*</mark>    | String | Location of Vendor   |
| address<mark style="color:red;">\*</mark>     | String | Address of Vendor    |
| store\_name<mark style="color:red;">\*</mark> | String | Store name of Vendor |

{% tabs %}
{% tab title="201: Created Vendor Account Created" %}

{% endtab %}

{% tab title="500: Internal Server Error Internal Server Error. Contact Support" %}

{% endtab %}
{% endtabs %}
