> For the complete documentation index, see [llms.txt](https://edrus.gitbook.io/appgregator-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://edrus.gitbook.io/appgregator-api-docs/appgregators/delivery/anteraja/service-rates-by-district-code.md).

# Service Rates By District Code

This API is used to estimate shipping costs based on the services provided by Anteraja, by passing in origin and destination parameters and weight.

For endpoint you can hit with this url.

{% embed url="<https://us-central1-appgregator.cloudfunctions.net/antaraja/service/service-rates>" %}

To use it you must prepare the headers and bosy, here are the headers and body that must be prepared.

**Request Headers :**&#x20;

* **x-api-key :**  is the api key of the appgregator that has been encrypted using AES encryption format.
* **name :**  is the name of the project registered in the appgregator that is adjusted to the x-api-key in the previous parameter.
* **conection\_name :** connection\_name is the connection name that is adjusted to the project and x-api-key that has been registered in the appgregator.
* **base\_path :** is the basepath given directly by the anteraja.
* **access\_key :**  is a key that is given directly from the anteraja.

**Request Headers :**&#x20;

* **origin :  (required). I**s the district code of Anteraja, the list is in the API Destination and Origin Coverage Anteraja.
* **destination :  (required). I**s the district code of Anteraja, the list is in the API Destination and Origin Coverage Anteraja.
* **weight : (required).** Parcel weight in gram(s). Minimum is 1000. Maximum is 50000.

<mark style="color:green;">`POST`</mark> `https://us-central1-appgregator.cloudfunctions.net/antaraja/service/service-rates`

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | String |             |

{% tabs %}
{% tab title="Axios - NodeJs" %}

```javascript
var axios = require('axios');
var data = JSON.stringify({
  "origin": "16.71.06",
  "destination": "16.71.02",
  "weight": 2000
});

var config = {
  method: 'post',
  url: 'https://us-central1-appgregator.cloudfunctions.net/antaraja/service/service-rates',
  headers: { 
    'x-api-key': 'U2FsdGVkX1++ZZ4P1XMNg5SK1wAlLl+43SGcdaHpyt+f0fBNSVUHaKvtsRWP4Eu75QTIU5i2oAaBORnsQrRGYQ==', 
    'name': 'ft-4', 
    'connection_name': 'delivery02', 
    'base_path': 'https://doit-sit.anteraja.id/importir', 
    'access_key': 'Anteraja_x_importir_SIT', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endtab %}

{% tab title="CURL - PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://us-central1-appgregator.cloudfunctions.net/antaraja/service/service-rates',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "origin": "16.71.06",
    "destination": "16.71.02",
    "weight": 2000
}',
  CURLOPT_HTTPHEADER => array(
    'x-api-key: U2FsdGVkX1++ZZ4P1XMNg5SK1wAlLl+43SGcdaHpyt+f0fBNSVUHaKvtsRWP4Eu75QTIU5i2oAaBORnsQrRGYQ==',
    'name: ft-4',
    'connection_name: delivery02',
    'base_path: https://doit-sit.anteraja.id/importir',
    'access_key: Anteraja_x_importir_SIT',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="cURL" %}

```
curl --location --request POST 'https://us-central1-appgregator.cloudfunctions.net/antaraja/service/service-rates' \
--header 'x-api-key: U2FsdGVkX1++ZZ4P1XMNg5SK1wAlLl+43SGcdaHpyt+f0fBNSVUHaKvtsRWP4Eu75QTIU5i2oAaBORnsQrRGYQ==' \
--header 'name: ft-4' \
--header 'connection_name: delivery02' \
--header 'base_path: https://doit-sit.anteraja.id/importir' \
--header 'access_key: Anteraja_x_importir_SIT' \
--header 'Content-Type: application/json' \
--data-raw '{
    "origin": "16.71.06",
    "destination": "16.71.02",
    "weight": 2000
}'
```

{% endtab %}
{% endtabs %}
