# Preorder

**End Point :**&#x20;

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

**Reques Headers Parameters :**

* **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.
* **connection\_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 Body Parameters :**

* **booking\_id, (required),** user's system Unique Transaction Id / Booking Id. Format : \[PREFIX]-\[TRX ID]. Prefix will be given by Anteraja Team. We will trim the leading and trailing whitespace, and ignore case. max length 25 character.
* **invoice\_no, (optional),** user's System Invoice No. max length 25 character
* **service\_code, (required).** Anteraja Service Type (SD, ND, REG, ICE, BIG), max length 3 character
* **parcel\_total\_weight, (required).** Parcel Total Weight (in grams). Minimum is 1000. Maximum is 50000. max length 5 character
* **\[shipper/receiver].name**, **(required)**. Shipper / Receiver Name info. Maximal length 50 character
* **\[shipper/receiver].phone**, its required. Shipper / Receiver Telephone info. Max length 16 character.
* **\[shipper/receiver].email**, optional. Shipper / Receiver Email info. Max length 50 character.
* **\[shipper/receiver].district**, its required. Shipper / Receiver District Code. Max length 10 character.
* **\[shipper/receiver].address**, its required. Shipper / Receiver Address detail info. Max length 256 character.
* **\[shipper/receiver].postcode**, its required. Shipper / Receiver Postcode info. Max length 5 character.
* **\[shipper/receiver].geoloc**, optional. Shipper / Receiver Geolocation (Longitude, Latitude) info. Max length 100 character.
* **items.item\_name**, its required Item name info. Max length 50 character.
* **items.item\_desc**, optional. Item description info. Max length 32 character.
* **items.item\_category**, optioanal. Item category info. Max length 20 character.
* **items.item\_quantity**, its required. Item quantity info. Max length 2 character.
* **items.declared\_value**, its required. Item value info (per item). Max length 9 character.
* **items.weight**, its required. Item weight info (in grams and per item). Minimum is 100. Maximum is 50000. Max length 5 character.
* **use\_insurance**, optional, Order covered by insurance or not. (true / false).
* **declared\_value**, its required. Parcel declared value. Max length 9 character.

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

```javascript
var axios = require('axios');
var data = JSON.stringify({
  "booking_id": "PREFIX-20191",
  "invoice_no": "INV/RJ/20191",
  "service_code": "REG",
  "parcel_total_weight": 1000,
  "shipper": {
    "name": "JuliShop",
    "phone": "081234324283",
    "email": "julishop@gmail.com",
    "district": "31.75.08",
    "address": "Jl Kampung Pulo Pinang Ranti",
    "postcode": "13510",
    "geoloc": ""
  },
  "receiver": {
    "name": "JuliBuyer",
    "phone": "012931232139819",
    "email": "julibuyer@gmail.com",
    "district": "31.75.08",
    "address": "Jalan Halim Perdanakusuma, RT.3/RW.4, Halim Perdana Kusumah",
    "postcode": "13610",
    "geoloc": ""
  },
  "items": [
    {
      "item_name": "Laptop 2",
      "item_desc": "Laptop ROG",
      "item_category": "Elektronik",
      "item_quantity": 1,
      "declared_value": 15000000,
      "weight": 1000
    }
  ],
  "use_insurance": true,
  "declared_value": 15000000
});

var config = {
  method: 'post',
  url: 'https://us-central1-appgregator.cloudfunctions.net/antaraja/service/preorder',
  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);
});ava
```

{% 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/preorder',
  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 =>'{
    "booking_id": "PREFIX-20191",
    "invoice_no": "INV/RJ/20191",
    "service_code": "REG",
    "parcel_total_weight": 1000,
    "shipper": {
        "name": "JuliShop",
        "phone": "081234324283",
        "email": "julishop@gmail.com",
        "district": "31.75.08",
        "address": "Jl Kampung Pulo Pinang Ranti",
        "postcode": "13510",
        "geoloc": ""
    },
    "receiver": {
        "name": "JuliBuyer",
        "phone": "012931232139819",
        "email": "julibuyer@gmail.com",
        "district": "31.75.08",
        "address": "Jalan Halim Perdanakusuma, RT.3/RW.4, Halim Perdana Kusumah",
        "postcode": "13610",
        "geoloc": ""
    },
    "items": [
        {
            "item_name": "Laptop 2",
            "item_desc": "Laptop ROG",
            "item_category": "Elektronik",
            "item_quantity": 1,
            "declared_value": 15000000,
            "weight": 1000
        }
    ],
  "use_insurance": true,
  "declared_value": 15000000
}',
  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/preorder' \
--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 '{
    "booking_id": "PREFIX-20191",
    "invoice_no": "INV/RJ/20191",
    "service_code": "REG",
    "parcel_total_weight": 1000,
    "shipper": {
        "name": "JuliShop",
        "phone": "081234324283",
        "email": "julishop@gmail.com",
        "district": "31.75.08",
        "address": "Jl Kampung Pulo Pinang Ranti",
        "postcode": "13510",
        "geoloc": ""
    },
    "receiver": {
        "name": "JuliBuyer",
        "phone": "012931232139819",
        "email": "julibuyer@gmail.com",
        "district": "31.75.08",
        "address": "Jalan Halim Perdanakusuma, RT.3/RW.4, Halim Perdana Kusumah",
        "postcode": "13610",
        "geoloc": ""
    },
    "items": [
        {
            "item_name": "Laptop 2",
            "item_desc": "Laptop ROG",
            "item_category": "Elektronik",
            "item_quantity": 1,
            "declared_value": 15000000,
            "weight": 1000
        }
    ],
  "use_insurance": true,
  "declared_value": 15000000
}'
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://edrus.gitbook.io/appgregator-api-docs/appgregators/delivery/anteraja/preorder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
