---
# System prepended metadata

title: Sancus Create Bnft All Endpoints

---

# Sancus Create Bnft All Endpoints
Pathao's loyalty program.

## Authentication

Use **Basic Auth** (username/password) for authentication

### Backend
- [Create a Benefit](#Create-a-Benefit)
- [Update a Benefit](#Update-a-Benefit)
- [Publish a Benefit](#Publish-a-Benefit)
- [List of Benefits](#List-of-Benefits)
- [Upload a File](#Upload-a-File)

#### Header
```
Authorization  [required]
Content-Type  [application/json]

```

## Backend
### Create a Benefit
Create a benefit for the users.Creating a benefit has two modalities.

  * [Percentage Modality](#Percentage-Modality)
  * [Verification Modality](#Verification-Modality)
 
#### Percentage Modality

#### Url(Internal)
```
/benefits
```
#### Verb
```
POST
```

#### Request Payload
```json

{
   {
   "title":"Artisan Banani 1",
   "city":[
      "dhaka"
   ],
   "partner_type":"Clothing",
   "benefit_modality":{
      "silver":{
         "amount":10,
         "max_discount_amount": 100000,
         "description":"Deatils...This modality only works for silver user",
         "short_description":"Buy-1/Get-1"
      },
      "gold":{
         "amount":20,
         "max_discount_amount":100000,
         "description":"Deatils...This modality only works for gold user",
         "short_description":"This modality"
      }
   },
   "partner_mobile_number":"01675450158",
   "thumbnail_url":"https://quicksilver-qa.pathaopay.xyz/images/sampleImage.jpeg",
   "short_description":"Upto 20% off",
   "description":"Upto 5% for Silver, 10% for Gold, 20% for Platinum users",
   "created_by":"team sancus",
   "visibility":true,
   "address": "Gulshan-1, Dhaka",
   "location": {
       "map_address": "Road16, Gulshan-1",
       "lat": 23.8103,
       "lon": 90.4125
   },
   "socials":{
      "twitter":"www.artisan.com",
      "facebook":"www.facebook.com"
   },
   "benefit_type":"percentage",
   "expires_at": "2021-11-23T11:27:29.538Z"
}

```
| Key                   | Required | Type               | Description                                                                        |
|-----------------------|----------|--------------------|------------------------------------------------------------------------------------|
| title                 | ✔        | string             | name of the partner where user can get the benefit. (**Max 30 characters**)                                |                                       |                                          |
| city                  | ✔        | list of string     | list of city/cities where the benefit will be available (**dhaka** and/or **chattogram**). **NB:** The city names are *Case Sensitive*.                           |
| partner_type          | ✔        | string             | type of the partner e.g. Clothing, Fast Food, etc.(**15 characters**)                                 |
| benefit_modality      | ✔        | list of dictionary | attributes of the benefit modality for a particular level. *The **max_discount_amount** is in **paisa** to avoid problems caused due to fraction*                         |
| partner_mobile_number | ✔        | string             | valid contact number (**11 digits**)                                                   |
| thumbnail_url         | ✔        | string             | thumbnail url.                                                                     |                                                  |
| short_description     | ✔        | string             | short description of the root.(**max 20 characters**)                                  |
| description           | ✔        | string             | description of the root. (**max 150 characters**)                                      |
| created_by            | ✔        | string             | who created the benefit.                                                           |
| website               | ✔        | string             | website of the partner (*Please put **https:// or http://** before the website URL*)                                                            |
| visibility            | ✔        | boolean            | visibility of the benefit on the users' end.(**true** or **false**)                                       |
| address               | ✔        | string             | address of the partner (**max 50 characters**)                                                             |
| location               | ✔        | dictionary             | location of the partner in the map. (*map address*, *lat*, *long*)                                               |
| social                | ✔        | dictionary         | social link of the partners e.g. **facebook, instagram, and twitter**.                 |
| benefit_type          | ✔        | string             | type of the benefit e.g.  **percentage**.                               |
| expires_at            | ✔        | string             | the time of expiry of the benefit in ISO 8601 format e.g. **UTC+6(yyyy-mm-dd hh:mm:ss).** Something similar to (2021-11-23T11:27:29.538Z) this format|

#### Response Payload
```json=
{
    "id": "5ffd06775fe73800014bf009",
    "message": "Benefit created"
}
```
#### Verification Modality

#### Url(Internal)
```
/benefits
```
#### Verb
```
POST
```

#### Request Payload
```json

{
   {
   "title":"Artisan Banani 1",
   "city":[
      "dhaka"
   ],
   "partner_type":"Clothing",
   "benefit_modality":{
      "silver":{
         "amount":10,
         "max_discount_amount": 100000,
         "description":"Deatils...This modality only works for silver user",
         "short_description":"Buy-1/Get-1"
      },
      "gold":{
         "amount":20,
         "max_discount_amount":100000,
         "description":"Deatils...This modality only works for gold user",
         "short_description":"This modality"
      }
   },
   "partner_mobile_number":"01675450158",
   "thumbnail_url":"https://quicksilver-qa.pathaopay.xyz/images/sampleImage.jpeg",
   "short_description":"Upto 20% off",
   "description":"Upto 5% for Silver, 10% for Gold, 20% for Platinum users",
   "created_by":"team sancus",
   "visibility":true,
   "address": "Gulshan-1, Dhaka",
   "location": {
       "map_address": "Road16, Gulshan-1",
       "lat": 23.8103,
       "lon": 90.4125
   },
   "socials":{
      "twitter":"www.artisan.com",
      "facebook":"www.facebook.com"
   },
   "benefit_type":"verification",
   "expires_at": "2021-11-23T11:27:29.538Z"
}

```
| Key                   | Required | Type               | Description                                                                        |
|-----------------------|----------|--------------------|------------------------------------------------------------------------------------|
| title                 | ✔        | string             | name of the partner where user can get the benefit. (**Max 30 characters**)                                |                                       |                                          |
| city                  | ✔        | list of string     | list of city/cities where the benefit will be available (**dhaka** and/or **chattogram**).                           |
| partner_type          | ✔        | string             | type of the partner e.g. Clothing, Fast Food, etc.(**15 characters**)                                 |
| benefit_modality      | ✔        | list of dictionary | attributes of the benefit modality for a particular level. ***For verification modality, put any acccepted value in the fields as shown in the example***                        |
| partner_mobile_number | ✔        | string             | valid contact number (**11 digits**)                                                   |
| thumbnail_url         | ✔        | string             | thumbnail url.                                                                     |                                                  |
| short_description     | ✔        | string             | short description of the root.(**max 20 characters**)                                  |
| description           | ✔        | string             | description of the root. (**max 150 characters**)                                      |
| created_by            | ✔        | string             | who created the benefit.                                                           |
| website               | ✔        | string             | website of the partner. (*Please put **https://** before the website URL*)                                                             |
| visibility            | ✔        | boolean            | visibility of the benefit on the users' end.(**true** or **false**)                                       |
| address               | ✔        | string             | address of the partner (**max 50 characters**)                                                             |
| location               | ✔        | dictionary             | location of the partner in the map. (*map address*, *lat*, *long*)                                               |
| social                | ✔        | dictionary         | social link of the partners e.g. facebook, instagram, twitter etc.                 |
| benefit_type          | ✔        | string             | type of the benefit e.g. **verification** .                               |
| expires_at            | ✔        | string             | the time of expiry of the benefit in ISO 8601 format e.g. **UTC+6(yyyy-mm-dd hh:mm:ss).** Something similar to (2021-11-23T11:27:29.538Z) this format|

#### Response Payload
```json=
{
    "id": "5ffd06775fe73800014bf009",
    "message": "Benefit created"
}
```

### Update a Benefit
Update a benefit for the users.
#### Url(Internal)
```
/benefits
```
#### Verb
```
PUT
```

#### Update Payload
```json=

{
   "id": "5ffd87ee9d875e00012a0207",
   "title":"Artisan Gulshan",
   "city":[
      "dhaka"
   ],
   "partner_type":"Clothing",
   "benefit_modality":{
      "silver":{
         "amount":10,
         "max_discount_amount": 100000,
         "description":"Deatils...This modality only works for silver user",
         "short_description":"Silver 10%"
      }
   },
   "partner_mobile_number":"01731375076",
   "thumbnail_url":"https://quicksilver-qa.pathaopay.xyz/images/sampleImage.jpeg",
   "short_description":"Upto 20% off",
   "description":"Upto 5% for Silver, 10% for Gold, 20% for Platinum users",
   "created_by":"team sancus",
   "visibility":true,
   "address": "Gulshan-1, Dhaka",
   "location": {
       "map_address": "Road 16, Gulshan circle",
       "lat": 23.8103,
       "lon": 90.4125
   },
   "socials":{
      "twitter":"https://twitter.com/artisan",
      "facebook":"https://www.facebook.com/artisan"
   },
   "website": "www.artisan.com",
   "benefit_type":"percentage",
   "expires_at": "2023-11-23T11:27:29.538Z"
}
```
| Key                   | Required | Update | Type               |
|-----------------------|----------|--------|--------------------|
| id                    | ✔        |        | string             |
| title                 | ✔          | ✔      | string             |
| city                  |✔           |  ✔       | list of string     |
| partner_type          | ✔        | ✔      | string             |
| benefit_modality      | ✔          |   ✔      | list of dictionary |
| partner_mobile_number | ✔          |        | string             |
| thumbnail_url         | ✔        |    ✔     | string             |
| banner_url            | ✔        |    ✔     | string             |
| cover_image_url       |  ✔         |  ✔       | string             |
| short_description     | ✔        | ✔      | string             |
| description           | ✔        | ✔      | string             |
| created_by            | ✔        |        | string             |
| website               | ✔          | ✔        | string             |
| visibility            | ✔          | ✔      | boolean            |
| address               | ✔        | ✔      | string             |
| location              | ✔        | ✔      | dictionary            |
| social                |  ✔         |  ✔       | dictionary         |
| benefit_type          | ✔        |    ✔     | string             |
| expires_at            |  ✔         | ✔      | string             |

#### Response Payload
```json=
{
    "message": "Benefit Updated"
}
```
### Publish a Benefit
Publish a benefit for the users.
#### Url(Internal)
```
/benefits/publish
```
#### Verb
```
PATCH
```
#### Publish Payload
```json=

{
    "id": "5ffcfbc85fe73800014bf007"
}
```
| Key                   | Required | Type               | Description                                                                        |
|-----------------------|----------|--------------------|------------------------------------------------------------------------------------|
| id                    | ✔        | string             | id of the benefit that has been created.                                           |
                                                 
#### Response Payload
```json=
{
    "message": "Benefit Updated"
}
```
### List of Benefits
List of all benefits of the existing users.
#### Url(Internal)
```
/benefits
```
#### Verb
```
GET
```
#### List Payload
```json=

{
    
}
```
#### Response Payload
```json=
{
    "data": [
        {
            "ID": "5ffd06775fe73800014bf009",
            "Title": "Yellow",
            "Level": [
                "silver",
                "gold"
            ],
            "Status": "draft",
            "City": [
                "chattogram"
            ],
            "PartnerType": "Clothing",
            "BenefitModality": {
                "bronze": {
                    "Amount": 5,
                    "MaxDiscountAmount": 100000,
                    "Description": "Artisan brings to you Happy Sale! It's something you have never witnessed before. Up to 40% discount on your desired winter and summer products.",
                    "ShortDescription": "5% Discount"
                },
                "silver": {
                    "Amount": 10,
                    "MaxDiscountAmount": 100000,
                    "Description": "Artisan brings to you Happy Sale! It's something you have never witnessed before. Up to 40% discount on your desired winter and summer products.",
                    "ShortDescription": "10% Discount"
                }
            },
            "PartnerMobileNumber": "01675450158",
            "ThumbnailURL": "https://quicksilver-qa.pathaopay.xyz/images/sampleImage.jpeg",
            "ShortDescription": "20% discount",
            "Description": "Upto 5% for Silver, 10% for Gold, 20% for Platinum users",
            "CreatedBy": "team sancus",
            "Visibility": false,
            "Address": "Gulshan-1, Dhaka",
            "MapAddress": "",
            "Location": null,
            "Socials": {
                "facebook": "https://www.facebook.com/artisanoutfitters/",
                "twitter": "twitter.com"
            },
            "BenefitType": "percentage",
            "Website": "https://artisanclick.com/",
            "ExpiresAt": "2021-11-23T11:27:29.538Z",
            "CreatedAt": "2021-01-12T02:16:23.501Z",
            "UpdatedAt": "2021-01-12T02:29:25.702Z"
        }
    ]
}


```
**PS**: Additionally to search filtered *benefit list*, it is possible to filter with the following keys. You've to put them in the request payload.
- ```"visibility" : true``` or ```"visibility" : false``` 
- ``` "city" : "dhaka" ``` or ``` "city" : "chattogram" ```
- ``` "status" : "published" ``` or ``` "status" : "draft"```
- ```"PartnerMobileNumber": "01675450158" ```

#### Example Request Payload
```json=

{
    "visibility" : true,
    "city" : "dhaka"
}
```

### Upload a File
Upload the ```thumbnail_url``` file for a benefit.
#### Url(Internal)
```
/benefits/files
```
#### Verb
```
POST
```
#### Request Payload

##### Body
```form-data```
| Key       | Value              |
|-----------|--------------------|
| thumbnail | ```Select Files``` |

**PS**: Max File Size <=1MB

#### Response Payload
```json=
{
    "thumbnail_url": "https://cdn.pathao.com/uploads/img/sancus/image-2021-01-13T12:15:08Zthumbnail_download.jpeg"
}
```
*Clicking on the link on the response payload will redirect to a new tab where pressing **Send** request will open up the image.*

