> For the complete documentation index, see [llms.txt](https://developer.komship.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.komship.id/reference/api-reference/tarif.md).

# Tarif

## Destination

Returns the list of regional goals throughout Indonesia

#### Query params

* **keyword:** City name or zip code

### <mark style="color:green;">GET</mark> /client/api/v1/destination/search

{% tabs %}
{% tab title="JS" %}

```typescript
const myHeaders = new Headers();
myHeaders.append("x-api-key", "xyz");

const requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.collaborator.komerce.my.id/tariff/api/v1/destination/search?keyword=cimaung", requestOptions)
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Curl" %}

```bash
curl --location '/tariff/api/v1/destination/search?keyword=jakarta%20pusat' \
--header 'Accept: application/json' \
--header 'x-api-key: xyz'
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "meta": {
    "message": "Sucessfully Get Destination Data",
    "code": 200,
    "status": "success"
  },
  "data": [
    {
      "id": 5056,
      "label": "CIMAUNG, CIMAUNG, BANDUNG, 40374",
      "subdistrict_name": "CIMAUNG",
      "district_name": "CIMAUNG",
      "city_name": "BANDUNG",
      "zip_code": "40374"
    },
    {
      "id": 18772,
      "label": "CIMAUNG, CIKEUSAL, SERANG, 42175",
      "subdistrict_name": "CIMAUNG",
      "district_name": "CIKEUSAL",
      "city_name": "SERANG",
      "zip_code": "42175"
    },
    {
      "id": 5054,
      "label": "CAMPAKAMULYA, CIMAUNG, BANDUNG, 40374",
      "subdistrict_name": "CAMPAKAMULYA",
      "district_name": "CIMAUNG",
      "city_name": "BANDUNG",
      "zip_code": "40374"
    },
    {
      "id": 5055,
      "label": "CIKALONG, CIMAUNG, BANDUNG, 40374",
      "subdistrict_name": "CIKALONG",
      "district_name": "CIMAUNG",
      "city_name": "BANDUNG",
      "zip_code": "40374"
    },
    {
      "id": 5057,
      "label": "CIPINANG, CIMAUNG, BANDUNG, 40374",
      "subdistrict_name": "CIPINANG",
      "district_name": "CIMAUNG",
      "city_name": "BANDUNG",
      "zip_code": "40374"
    },
    {
      "id": 5058,
      "label": "JAGABAYA, CIMAUNG, BANDUNG, 40374",
      "subdistrict_name": "JAGABAYA",
      "district_name": "CIMAUNG",
      "city_name": "BANDUNG",
      "zip_code": "40374"
    },
    {
      "id": 5059,
      "label": "MALASARI, CIMAUNG, BANDUNG, 40374",
      "subdistrict_name": "MALASARI",
      "district_name": "CIMAUNG",
      "city_name": "BANDUNG",
      "zip_code": "40374"
    },
    {
      "id": 5060,
      "label": "MEKARSARI, CIMAUNG, BANDUNG, 40375",
      "subdistrict_name": "MEKARSARI",
      "district_name": "CIMAUNG",
      "city_name": "BANDUNG",
      "zip_code": "40375"
    },
    {
      "id": 5061,
      "label": "PASIRHUNI, CIMAUNG, BANDUNG, 40374",
      "subdistrict_name": "PASIRHUNI",
      "district_name": "CIMAUNG",
      "city_name": "BANDUNG",
      "zip_code": "40374"
    },
    {
      "id": 5062,
      "label": "SUKAMAJU, CIMAUNG, BANDUNG, 40374",
      "subdistrict_name": "SUKAMAJU",
      "district_name": "CIMAUNG",
      "city_name": "BANDUNG",
      "zip_code": "40374"
    },
    {
      "id": 5063,
      "label": "WARJABAKTI, CIMAUNG, BANDUNG, 40374",
      "subdistrict_name": "WARJABAKTI",
      "district_name": "CIMAUNG",
      "city_name": "BANDUNG",
      "zip_code": "40374"
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Calculate

Returns shipping tarif cost

#### Query params

* **shipper\_destination\_id:** From destionation id
* **receiver\_destination\_id:** From destionation id
* **weight:** The weight of an item
* **item\_value:** Price of an item
* **cod:** yes/no

### <mark style="color:green;">GET</mark> /client/api/v1/calculate

{% tabs %}
{% tab title="JS" %}

```typescript
const myHeaders = new Headers();
myHeaders.append("x-api-key", "xyz");

const requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch('https://api.collaborator.komerce.my.id/tariff/api/v1/calculate?shipper_destination_id=17596&receiver_destination_id=5056&weight=1&item_value=200000&cod=yes', requestOptions)
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Curl" %}

```bash
curl --location '/tariff/api/v1/calculate?shipper_destination_id=17596&receiver_destination_id=5056&weight=1&item_value=200000&cod=yes' \
--header 'Accept: application/json' \
--header 'x-api-key: xyz'
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "meta": {
    "message": "Success Calculate Shipping",
    "code": 200,
    "status": "success"
  },
  "data": {
    "calculate_reguler": [
      {
        "shipping_name": "NINJA",
        "service_name": "Standard",
        "weight": 1,
        "is_cod": true,
        "shipping_cost": 7777,
        "shipping_cashback": 3499,
        "shipping_cost_net": 4278,
        "grandtotal": 57777,
        "service_fee": 1617,
        "net_income": 51882
      },
      {
        "shipping_name": "JNE",
        "service_name": "JNEFlat", //this service_name only appear on java-to-java shipment.
        "weight": 1,
        "is_cod": true,
        "shipping_cost": 9300,
        "shipping_cashback": 0, //no shipping_cashback for Flat Rate Service.
        "shipping_cost_net": 9300,
        "grandtotal": 59300,
        "service_fee": 1660,
        "net_income": 48340
      },
      {
        "shipping_name": "JNT",
        "service_name": "EZ",
        "weight": 1,
        "is_cod": true,
        "shipping_cost": 1000,
        "shipping_cashback": 250,
        "shipping_cost_net": 750,
        "grandtotal": 51000,
        "service_fee": 1428,
        "net_income": 48822
      },
      {
        "shipping_name": "JNE",
        "service_name": "REG23",
        "weight": 3,
        "is_cod": true,
        "shipping_cost": 225000,
        "shipping_cashback": 56250,
        "shipping_cost_net": 168750,
        "grandtotal": 325000,
        "service_fee": 9100,
        "net_income": 147150
      },
      {
        "shipping_name": "SICEPAT",
        "service_name": "SIUNT",
        "weight": 3,
        "is_cod": true,
        "shipping_cost": 165000,
        "shipping_cashback": 49500,
        "shipping_cost_net": 115500,
        "grandtotal": 265000,
        "service_fee": 7420,
        "net_income": 142080
      },
      {
        "shipping_name": "IDEXPRESS",
        "service_name": "STD",
        "weight": 3,
        "is_cod": true,
        "shipping_cost": 165000,
        "shipping_cashback": 41250,
        "shipping_cost_net": 123750,
        "grandtotal": 265000,
        "service_fee": 7420,
        "net_income": 133830
      },
      {
        "shipping_name": "SAP",
        "service_name": "UDRREG",
        "weight": 3,
        "is_cod": true,
        "shipping_cost": 186000,
        "shipping_cashback": 74400,
        "shipping_cost_net": 111600,
        "grandtotal": 286000,
        "service_fee": 8008,
        "net_income": 166392
      }
    ],
    "calculate_cargo": []
  }
}
```

{% endtab %}
{% endtabs %}
