> For the complete documentation index, see [llms.txt](https://doc.blowhorn.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.blowhorn.com/api-docs/wms-inbound/suppliers.md).

# Suppliers

## Fetch details of a Supplier

<mark style="color:blue;">`GET`</mark> `/wms/supplier`

Use this API to get the details of the Supplier(s). Below mentioned filters can be used to filter to get a single or set of client objects. If multi filters are used then all will be used for matching the result.

#### Query Parameters

| Name             | Type   | Description                                                                            |
| ---------------- | ------ | -------------------------------------------------------------------------------------- |
| id               | String | Supplier id returned by the Blowhorn at the time of client creation.                   |
| name             | String | Full or partial supplier name                                                          |
| phone\_number    | String | Registered phone number of the supplier                                                |
| gstin            | String | GST number of the supplier                                                             |
| pan              | String | PAN of the supplier                                                                    |
| cin              | String | CIN(corporate identification number) of the supplier                                   |
| tan              | String | TAN(Tax deduction Account Number) of the supplier                                      |
| status           | String | Status of the Supplier onboarding. Ex Values are 'onboarding', 'active' and 'inactive' |
| bank\_account    | String | Registered bank account number of the supplier                                         |
| state            | String | Registered state of the supplier                                                       |
| current\_address | String | Full or partial current address of the supplier                                        |
| invoice\_address | String | Full or partial invoice address of the supplier                                        |
| email            | String | Email address of the supplier                                                          |

#### Headers

| Name                                       | Type   | Description                              |
| ------------------------------------------ | ------ | ---------------------------------------- |
| API\_KEY<mark style="color:red;">\*</mark> | string | API key obtained by the Customer/Partner |

{% tabs %}
{% tab title="200 Successful result with or without filter" %}

```json
{
    "count": 4,
    "previous": null,
    "next": 0,
    "result": [
        {
            "id": 181,
            "bank_account": {
                "id": 29627,
                "account_number": "1234567890",
                "account_name": "JOHN DOE",
                "bank_name": "ICICI BANK",
                "ifsc_code": "ICIC0000424"
            },
            "current_address": {
                "id": 3926,
                "first_name": "John",
                "last_name": "Doe",
                "line1": "#007, Church Street",
                "line2": "80 Feet Road",
                "line3": "Near Police Station",
                "line4": "Koramangala",
                "state": "Karnataka",
                "country": "India",
                "postcode": "560068"
            },
            "invoice_address": {
                "id": 3927,
                "first_name": "Jane",
                "last_name": "Roe",
                "line1": "#008, French Street",
                "line2": "80 Feet Road",
                "line3": "Near Jhony Theatre",
                "line4": "Indira Nagar",
                "state": "Karnataka",
                "country": "India",
                "postcode": "560068"
            },
            "created_date": "2022-05-24T00:23:02.896972+05:30",
            "modified_date": "2022-05-24T00:23:02.898421+05:30",
            "name": "Supplier 01 From Koramangala",
            "phone_number": "+917411475502",
            "email": "abc@def.com",
            "photo": null,
            "is_address_same": false,
            "cin": "A12345BC6789DEF012345",
            "pan": "BMPPV4211B",
            "tan": "ABCD12345E",
            "gstin": "12ABCDE3456F7G8",
            "status": "onboarding",
            "reason_for_inactive": null,
            "remarks": null,
            "tos_response_date": null,
            "created_by": 108434,
            "modified_by": null,
            "state": null,
            "customer": 40082
        }
    ]
}
```

{% endtab %}

{% tab title="401 Unauthorized / Wrong api key" %}

```json
{
  "status": "FAIL",
  "message": "Unauthorized"
}
```

{% endtab %}

{% tab title="500 Unexpected error" %}

```json
{
  "status": "FAIL",
  "message": "Unexpected error"
}
```

{% endtab %}

{% tab title="200: OK When no client matches the filter criteria" %}

```javascript
{
    "count": 0,
    "previous": null,
    "next": 0,
    "result": []
}
```

{% endtab %}
{% endtabs %}

## Create a Supplier

<mark style="color:green;">`POST`</mark> `/wms/supplier`

This API can used to create supplier. Supplier name is mandatory for a client and this should be unique across the client.

#### Headers

| Name                                       | Type   | Description                              |
| ------------------------------------------ | ------ | ---------------------------------------- |
| API\_KEY<mark style="color:red;">\*</mark> | String | API key obtained by the Customer/Partner |

#### Request Body

| Name                                   | Type   | Description                                                                                            |
| -------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------ |
| name<mark style="color:red;">\*</mark> | String | Name of the supplier                                                                                   |
| phone\_number                          | String | <p>Phone number of the supplier </p><p>Ex: +917411XXXX03</p>                                           |
| cin                                    | String | <p>CIN(corporate identification number) of the supplier.</p><p>Ex: A12345BC6789DEF012347</p>           |
| pan                                    | String | <p>PAN of the supplier.</p><p>Ex: BMPPV4211D</p>                                                       |
| tan                                    | String | <p>TAN(Tax deduction Account Number) of the supplier.</p><p>Ex: ABCD12345G</p>                         |
| gstin                                  | String | <p>GST number of the supplier.</p><p>Ex: 12ABCDE3456F7G0</p>                                           |
| bank\_account                          | String | Bank account id or object containing bank account details per below given attributes.                  |
| account\_number                        | String | Supplier bank account number                                                                           |
| account\_name                          | String | Supplier bank account holder name as per the bank KYC.                                                 |
| bank\_name                             | String | Name of the supplier bank                                                                              |
| ifsc\_code                             | String | IFSC code of the supplier bank                                                                         |
| current\_address                       | String | Address id or object containing supplier current address details per below given attributes.           |
| invoice\_address                       | String | Address id or object containing supplier invoice address details per below given attributes.           |
| first\_name                            | String | First name of the supplier bank account holder                                                         |
| last\_name                             | String | Last name of the supplier bank account holder                                                          |
| line1-line4                            | String | Address line of the address divided into four lines.                                                   |
| state                                  | String | State name of the supplier                                                                             |
| country                                | String | Country name or id of the supplier                                                                     |
| postcode                               | String | Postal code of the supplier                                                                            |
| is\_address\_same                      | String | Flag indicating whether both invoice address and current are the same. This field default to s 'False' |
| email                                  | String | Email address of the supplier                                                                          |

{% tabs %}
{% tab title="400: Bad Request Validation Error" %}

```javascript
{
    "status": "FAIL",
    "message": "Supplier name should be unique."
}
```

{% endtab %}

{% tab title="200: OK Successful Creation" %}

```javascript
{
    "status": "PASS",
    "message": {
        "id": 181,
        "name": "Supplier 01 From Koramangala"
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized/Wrong API key" %}

```javascript
{
  "status": "FAIL",
  "message": "Unauthorized"
}
```

{% endtab %}

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

```javascript
{
  "status": "FAIL",
  "message": "Unexpected error"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Example Schema 01" %}

```json
{
    "name": "Supplier 03 From Koramangala",
    "phone_number": "+917411475503",
    "email": "abc@def.com",
    "cin": "A12345BC6789DEF012347",
    "pan": "BMPPV4211D",
    "tan": "ABCD12345G",
    "gstin": "12ABCDE3456F7G0",
    "bank_account": {
        "account_number": "1234567890",
        "account_name": "JOHN DOE",
        "bank_name": "ICICI BANK",
        "ifsc_code": "ICIC0000424" 
    },
    "current_address": {
        "first_name": "John",
        "last_name": "Doe",
        "line1": "#007, Church Street",
        "line2": "80 Feet Road",
        "line3": "Near Police Station",
        "line4": "Koramangala",
        "state": "Karnataka",
        "country": "India",
        "postcode": "560068"
    },
    "invoice_address": {
        "first_name": "Jane",
        "last_name": "Roe",
        "line1": "#008, French Street",
        "line2": "80 Feet Road",
        "line3": "Near Jhony Theatre",
        "line4": "Indira Nagar",
        "state": "Karnataka",
        "country": "India",
        "postcode": "560068"
    },
    "is_address_same": false
}
```

{% endtab %}

{% tab title="Example Schema 02" %}

```json
{
    "name": "Supplier 03 From Koramangala",
    "phone_number": "+917411475503",
    "email": "abc@def.com",
    "cin": "A12345BC6789DEF012347",
    "pan": "BMPPV4211D",
    "tan": "ABCD12345G",
    "gstin": "12ABCDE3456F7G0",
    "bank_account": 123456,
    "current_address": 234567,
    "invoice_address": 345678,
    "is_address_same": false
}
```

{% endtab %}
{% endtabs %}

## Update a supplier

<mark style="color:orange;">`PUT`</mark> `/wms/supplier`

This API can be used to update a supplier details. Name or id is mandatory when trying to update a supplier to identify the supplier for updating the details.

#### Headers

| Name                                       | Type   | Description                              |
| ------------------------------------------ | ------ | ---------------------------------------- |
| API\_KEY<mark style="color:red;">\*</mark> | String | API key obtained by the Customer/Partner |

#### Request Body

| Name                                   | Type   | Description                                                                                            |
| -------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------ |
| name<mark style="color:red;">\*</mark> | String | Name of the supplier                                                                                   |
| phone\_number                          | String | <p>Phone number of the supplier </p><p>Ex: +917411XXXX03</p>                                           |
| cin                                    | String | <p>CIN(corporate identification number) of the supplier.</p><p>Ex: A12345BC6789DEF012347</p>           |
| pan                                    | String | <p>PAN of the supplier.</p><p>Ex: BMPPV4211D</p>                                                       |
| tan                                    | String | <p>TAN(Tax deduction Account Number) of the supplier.</p><p>Ex: ABCD12345G</p>                         |
| gstin                                  | String | <p>GST number of the supplier.</p><p>Ex: 12ABCDE3456F7G0</p>                                           |
| bank\_account                          | String | Bank account id or object containing bank account details per below given attributes.                  |
| account\_number                        | String | Supplier bank account number                                                                           |
| account\_name                          | String | Supplier bank account holder name as per the bank KYC.                                                 |
| bank\_name                             | String | Name of the supplier bank                                                                              |
| ifsc\_code                             | String | IFSC code of the supplier bank                                                                         |
| current\_address                       | String | Address id or object containing supplier current address details per below given attributes.           |
| invoice\_address                       | String | Address id or object containing supplier invoice address details per below given attributes.           |
| first\_name                            | String | First name of the supplier bank account holder                                                         |
| last\_name                             | String | Last name of the supplier bank account holder                                                          |
| line1-line4                            | String | Address line of the address divided into four lines.                                                   |
| state                                  | String | State name of the supplier                                                                             |
| country                                | String | Country name or id of the supplier                                                                     |
| postcode                               | String | Postal code of the supplier                                                                            |
| is\_address\_same                      | String | Flag indicating whether both invoice address and current are the same. This field default to s 'False' |

{% tabs %}
{% tab title="400: Bad Request Validation Error" %}

```javascript
{
    "status": "FAIL",
    "message": "Supplier does not exist."
}
```

{% endtab %}

{% tab title="200: OK Successful Updation" %}

```javascript
{
    "status": "PASS",
    "message": {
        "id": 181,
        "name": "Supplier 01 From Koramangala"
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized/Wrong API key" %}

```javascript
{
  "status": "FAIL",
  "message": "Unauthorized"
}
```

{% endtab %}

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

```javascript
{
  "status": "FAIL",
  "message": "Unexpected error"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Example 01" %}

```json
{
    "name": "Supplier 01 From Koramangala",
    "phone_number": "+917411475502",
    "email": "abc@def.com",
    "cin": "A12345BC6789DEF012345",
    "pan": "BMPPV4211B",
    "tan": "ABCD12345E",
    "gstin": "12ABCDE3456F7G8",
    "bank_account": {
        "account_number": "1234567890",
        "account_name": "JOHN DOE",
        "bank_name": "ICICI BANK",
        "ifsc_code": "ICIC0000424" 
    },
    "current_address": {
        "first_name": "John",
        "last_name": "Doe",
        "line1": "#007, Church Street",
        "line2": "80 Feet Road",
        "line3": "Near Police Station",
        "line4": "Koramangala",
        "state": "Karnataka",
        "country": "India",
        "postcode": "560068"
    },
    "invoice_address": {
        "first_name": "Jane",
        "last_name": "Roe",
        "line1": "#008, French Street",
        "line2": "80 Feet Road",
        "line3": "Near Jhony Theatre",
        "line4": "Indira Nagar",
        "state": "Karnataka",
        "country": "India",
        "postcode": "560068"
    },
    "is_address_same": false
}
```

{% endtab %}

{% tab title="Example 02" %}

```json
{
    "name": "Supplier 01 From Koramangala",
    "phone_number": "+917411475502",
    "email": "abc@def.com",
    "cin": "A12345BC6789DEF012345",
    "pan": "BMPPV4211B",
    "tan": "ABCD12345E",
    "gstin": "12ABCDE3456F7G8",
    "bank_account": 100025,
    "current_address": 1023,
    "invoice_address": 1024,
    "is_address_same": false
}
```

{% endtab %}

{% tab title="Examaple 03" %}

```json
{
    "name": "Supplier 01 From Koramangala",
    "phone_number": "+917411475503",
    "email": "abc@def.com"
}
```

{% endtab %}

{% tab title="Example 04" %}

```json
{
    "name": "Supplier 01 From Koramangala",
    "bank_account": {
        "account_number": "1234567889",
        "account_name": "Jane Roe",
        "bank_name": "ICICI BANK",
        "ifsc_code": "ICIC0000424" 
    }
}
```

{% endtab %}

{% tab title="Example 05" %}

```json
{
    "id": 181,
    "bank_account": {
        "account_number": "1234567888",
        "account_name": "Jane Roe",
        "bank_name": "ICICI BANK",
        "ifsc_code": "ICIC0000424" 
    }
}
```

{% endtab %}
{% endtabs %}
