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

# Vendor

Campaign Management

## Campaign Creation

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

Endpoint to create a new campaign by the NGO.

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             |
| --------------------------------------------- | ------ | ----------------------- |
| title<mark style="color:red;">\*</mark>       | String | Title of Campaign       |
| type<mark style="color:red;">\*</mark>        | String | Type of Campaign        |
| description<mark style="color:red;">\*</mark> | String | Description of Campaign |
| budget<mark style="color:red;">\*</mark>      | Int    | Budget of Campaign      |
| location<mark style="color:red;">\*</mark>    | String | Location of Campaign    |
| start\_date<mark style="color:red;">\*</mark> | String | Start date of Campaign  |
| end\_date<mark style="color:red;">\*</mark>   | String | End date of Campaign    |
| is\_public<mark style="color:red;">\*</mark>  | bool   |                         |

{% tabs %}
{% tab title="201: Created Created Campaign" %}

{% endtab %}

{% tab title="500: Internal Server Error Campaign creation failed. Please retry" %}

{% endtab %}
{% endtabs %}

## Update Existing Campaign

<mark style="color:orange;">`PUT`</mark> `https://staging-api.chats.cash/v1/organisations/:organisation_id/campaigns/:campaign_id`

Endpoint to update the status of an existing campaign.

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 |
| campaign\_id<mark style="color:red;">\*</mark>     | String | ID of campaign     |

#### Headers

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

#### Request Body

| Name                                     | Type   | Description        |
| ---------------------------------------- | ------ | ------------------ |
| type<mark style="color:red;">\*</mark>   | String | Type of Campaign   |
| status<mark style="color:red;">\*</mark> |        | Status of campaign |

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

{% endtab %}

{% tab title="500: Internal Server Error Campaign update failed. Please retry" %}

{% endtab %}
{% endtabs %}

## Fund Cash Campaign

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

This is the endpoint to fund the campaign wallet. This is done by the NGO

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 |
| campaign\_id<mark style="color:red;">\*</mark>     | String | ID of campaign     |

#### Headers

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

{% tabs %}
{% tab title="200: OK Organisation fund to campaign is Processing" %}

{% endtab %}

{% tab title="500: Internal Server Error Campaign funding failed. Please retry" %}

{% endtab %}
{% endtabs %}

## Disburse Funds to Beneficiaries

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

This endpoint allows funds to be distributed to the beneficiaries of a campaign.

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 |
| campaign\_id<mark style="color:red;">\*</mark>     | String | ID of campaign     |

#### Headers

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

#### Request Body

| Name                                          | Type   | Description                                                              |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------ |
| token\_type<mark style="color:red;">\*</mark> | String | <p>Type of funds disbursement<br><br>\[papertoken, wallet, smstoken]</p> |

{% tabs %}
{% tab title="200: OK Campaign fund with beneficiaries is Processing" %}

{% endtab %}

{% tab title="500: Internal Server Error Disbursing failed. Please retry" %}

{% endtab %}
{% endtabs %}

## Import Beneficiaries

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

This endpoint allows the NGO to import already existing beneficiaries from an existing campaigns to a newly created campaign.

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                                |
| campaign\_id<mark style="color:red;">\*</mark>      | String | ID of campaign                                    |
| replicaCampaignId<mark style="color:red;">\*</mark> | String | The campaign ID you want to duplicate beneficiary |

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

{% endtab %}

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

{% endtab %}
{% endtabs %}

## Extend Campaign

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

This endpoint extends the existence of a campaign. It is an optional feature for the NGO who decide whether or not to extend a campaign. \
\
Optionally, the NGO can decide to additionally add funds to the campaign. However, if the NGO decides not to extend the campaign, funds are refunded back to the wallet of the NGO.

Authorization Header takes in the Bearer token generated from the login of the NGO

#### 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                                 |
| ---------------------------------------------- | ------ | ------------------------------------------- |
| end\_date<mark style="color:red;">\*</mark>    | String | Campaign End Date - DD-MM-YYYY              |
| campaign\_id<mark style="color:red;">\*</mark> | String | ID of the campaign to extend                |
| location                                       | String |                                             |
| additional\_budget                             | String | additional budget to fund the campaign with |
| description                                    | String | Description of the extention                |

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

{% endtab %}

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

{% endtab %}
{% endtabs %}

## Get all organisation campaigns

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

Endpint to fetch all the campaigns of organisations

#### 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> |

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

{% endtab %}

{% tab title="500: Internal Server Error Request failed. Please try again" %}

{% endtab %}
{% endtabs %}
