> 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/user.md).

# User

User Management/Authentication

## NGO Registration

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

Registration endpoint of NGO

#### Request Body

| Name                                                 | Type   | Description                                  |
| ---------------------------------------------------- | ------ | -------------------------------------------- |
| organisation\_name<mark style="color:red;">\*</mark> | String | The name of Organisation                     |
| email<mark style="color:red;">\*</mark>              | String | The email of the organisation representative |
| password<mark style="color:red;">\*</mark>           | String | Password                                     |
| website\_url                                         | String |                                              |

{% tabs %}
{% tab title="201: Created NGO and User registered successfully" %}

{% endtab %}

{% tab title="400: Bad Request An Organisation with such name or website url already exist" %}

{% endtab %}
{% endtabs %}

## NGO Email Verification

<mark style="color:green;">`POST`</mark> `https://staging-api.chats.cash/v1/auth/verify-email/`

Email verificaiton endpoint for NGO

#### Request Body

| Name                                               | Type   | Description                                 |
| -------------------------------------------------- | ------ | ------------------------------------------- |
| confirmationCode<mark style="color:red;">\*</mark> | String | Confirmation Code of the Email Verification |

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

{% endtab %}

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

{% endtab %}
{% endtabs %}

## Organisation Member Registration

<mark style="color:green;">`POST`</mark> `https://staging-api.chats.cash/v1/ngos/:organisation_id/members`

Endpoint to register Orgamisation Members. These types of members, include: \[admin, subadmin, fieldagent]

Authorization Header takes in the Bearer token generated from the login of the NGO&#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                                                                          |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| first\_name<mark style="color:red;">\*</mark> | String | First name of Organisation Member                                                    |
| last\_name<mark style="color:red;">\*</mark>  | String | Last name of Organisation Member                                                     |
| email<mark style="color:red;">\*</mark>       | String | Email of the Organisation Member                                                     |
| phone<mark style="color:red;">\*</mark>       | String | Phone number of Organisation Member                                                  |
| role<mark style="color:red;">\*</mark>        | String | <p>Type of Organisation Member. Includes: <br><br>\[admin, subadmin, fieldagent]</p> |

## Vendor Registration by NGO

<mark style="color:green;">`POST`</mark> `https://staging-api.chats.cash/v1/organisations/:organisation_id/vendors`

Endpoint to register Vendors by NGOs.

Authorization Header takes in the Bearer token generated from the login of the NGO&#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              |
| --------------------------------------------- | ------ | ------------------------ |
| 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          |
| store\_name<mark style="color:red;">\*</mark> | String | Store name of Vendor     |
| location<mark style="color:red;">\*</mark>    | String | Store location of Vendor |
| address<mark style="color:red;">\*</mark>     | String | Store address of Vendor  |

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

{% endtab %}

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

{% endtab %}
{% endtabs %}

## Beneficiary Registration By Field Agent

<mark style="color:green;">`POST`</mark> `https://staging-api.chats.cash/v1/ngos/:organisation_id/beneficiaries`

This is the endpoint to register beneficiaries by a Field agent. These types of beneficiaries are presumed not to have smart phones to register themselves.&#x20;

Authorization Header takes in the Bearer token generated from the login of Field Agent&#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> |      | Bearer \<token> |

#### Request Body

| Name                                           | Type   | Description                              |
| ---------------------------------------------- | ------ | ---------------------------------------- |
| campaign<mark style="color:red;">\*</mark>     | String | The campaign to register the Beneficiary |
| first\_name<mark style="color:red;">\*</mark>  | String | First name of Beneficiary                |
| last\_name<mark style="color:red;">\*</mark>   | String | Last name of Beneficiary                 |
| email                                          | String | Email of Beneficiary                     |
| phone<mark style="color:red;">\*</mark>        | String | Phone of Beneficiary                     |
| gender<mark style="color:red;">\*</mark>       | String | Gender of Beneficiary                    |
| address<mark style="color:red;">\*</mark>      | String | Address of Beneficiary                   |
| location<mark style="color:red;">\*</mark>     | String | Location of Beneficiary                  |
| dob<mark style="color:red;">\*</mark>          | String | Date of Birth of Beneficiary             |
| profile\_pic<mark style="color:red;">\*</mark> | String | Photo of Beneficiary                     |
| pin<mark style="color:red;">\*</mark>          | String | Campaign pin of the Beneficiary          |
| nfc                                            | String |                                          |

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

{% endtab %}
{% endtabs %}

## Beneficiary Self Registration

<mark style="color:green;">`POST`</mark> `https://staging-api.chats.cash/v1/auth/self-registration`

This endpoint enables the self registraion of beneficiaries. These types of beneficiaries are presumed to have smart phones to register themselves.&#x20;

#### Request Body

| Name                                           | Type   | Description                 |
| ---------------------------------------------- | ------ | --------------------------- |
| first\_name<mark style="color:red;">\*</mark>  | String | First name of Beneficiary   |
| last\_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 number of Beneficiary |
| gender<mark style="color:red;">\*</mark>       | String |                             |
| password<mark style="color:red;">\*</mark>     | String |                             |
| profile\_pic<mark style="color:red;">\*</mark> | String |                             |
| state<mark style="color:red;">\*</mark>        | String |                             |
| country<mark style="color:red;">\*</mark>      | String |                             |
| coordinates<mark style="color:red;">\*</mark>  | String |                             |

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

{% endtab %}

{% tab title="500: Internal Server Error On-boarding failed. Please try again later" %}

{% endtab %}
{% endtabs %}

## Donor Registration

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

This is the endpoint that registers Donors. Prior to a registration, a donor is sent an invite to join a campaign. Refer to the Donor page, for the invitation endpoint, before, calling this endpoint.

#### Request Body

| Name                                                 | Type   | Description                      |
| ---------------------------------------------------- | ------ | -------------------------------- |
| organisation\_name<mark style="color:red;">\*</mark> | String | Name of Donor                    |
| email<mark style="color:red;">\*</mark>              | String | Email of Donor                   |
| password<mark style="color:red;">\*</mark>           | String | Password of Donor                |
| website\_url                                         | String | Website URL of Donor             |
| campaignId<mark style="color:red;">\*</mark>         | String | ID of campaign for Donor to join |

{% tabs %}
{% tab title="201: Created Donor and User registered successfully" %}

{% endtab %}

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

{% endtab %}
{% endtabs %}
