> For the complete documentation index, see [llms.txt](https://tripins.saladin.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tripins.saladin.vn/api-document-for-embedded-trip-insurance/api-details.md).

# API Details

## Header

| Endpoint (Staging)      | <https://gw-dev.saladin.vn/api/v1/trip-insurance>    |
| ----------------------- | ---------------------------------------------------- |
| Endpoint (Production)   | ​<https://gw.saladin.vn/api/v1/trip-insurance>       |
| X-Sld-Timestamp         | Request call time, in seconds                        |
| X-Sld-ClientKey         | Client Key is issued to 3rd Party                    |
| X-Sld-Signature (param) | The signature is generated based on the request body |

## How to generate X-Sld-Signature

```
// request body
body = {
    "<field_name>": <field_value>,
    "<field_name>": <field_value>,
    "<field_name>": <field_value>,
}

payload = timestamp + "." + client_key + "." + json_stringify(data)
secret = "<client_secret>"
encoded_payload = base64_safeurl_encode_no_padding(payload)
signature = HMAC_SHA256(secret, payload)
```

## API #01 - Calculate Premium v2

<mark style="color:green;">`GET`</mark>{{endpoint}}/vendor/accident-insurance/v2/premiums

* **Purpose:** Enable partners to access multiple insurance products with a single request.
* **Trigger when**: Users select to purchase the insurance for the trip.

> Partners can also use an older version [here](/api-document-for-embedded-trip-insurance/api-details/the-older-version-apis/api-01-calculate-premium-v1.md); however, they can only retrieve one insurance product per API call

**Headers**

| Name            | Value                                                                                                |
| --------------- | ---------------------------------------------------------------------------------------------------- |
| X-Sld-Timestamp | Timestamp when calling request in second                                                             |
| X-Sld-ClientKey | Client key which is given to partner                                                                 |
| X-Sld-Signature | The code is generated according to the instructions in the 'How to generate X-Sld-Signature' section |

**Query parameters**

| Name            | Type     | Description                        |
| --------------- | -------- | ---------------------------------- |
| number\_of-seat | interger |                                    |
| channel         | enum     | <p>1 - Offline.<br>2 - Online.</p> |

**Response**

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

```json
{
    "code": 0,
    "message": "OK",
    "data": {
        "products": [
            {
                "product_code": "e_trip_pa_04",
                "product_premium": "50000",
                "product_detail_url": "https://www.saladin.vn/bao-hiem-lien-ket/bao-hiem-chuyen-di-mtn200"
            },
            {
                "product_code": "e_trip_pa_05",
                "product_premium": "100000",
                "product_detail_url": "https://www.saladin.vn/bao-hiem-lien-ket/bao-hiem-chuyen-di-mtn400"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

## API #02 - Create Policy

Post: /vendor/accident-insurance/policies

* **Purpose:** The partner can request this API to create the insurance contract.
* **Trigger when**: After customers make payment successfully for their order.

### **Parameters**

**Body**

<table><thead><tr><th width="210">Field</th><th width="82">Data Type</th><th width="372">Description</th><th>Required</th></tr></thead><tbody><tr><td>order_id</td><td>string</td><td>The id of the order on the partner system. </td><td>Y</td></tr><tr><td>product_code</td><td>string</td><td>The product code which is returned by the API#1</td><td>N</td></tr><tr><td>channel</td><td>enum</td><td>1 - Offline.<br>2 - Online.</td><td>Y</td></tr><tr><td>buyer_name</td><td>string</td><td>Full name of the buyer</td><td>Y</td></tr><tr><td>buyer_phone</td><td>string</td><td>Phone number of the buyer</td><td>Y</td></tr><tr><td>buyer_email</td><td>string</td><td>email of the buyer</td><td>Y</td></tr><tr><td>bus_operator</td><td>string</td><td></td><td>Y</td></tr><tr><td>bus_phone_number</td><td>string</td><td></td><td>Y</td></tr><tr><td>bus_number_plate</td><td>string</td><td></td><td>N</td></tr><tr><td>driver_phone</td><td>string</td><td>Phone number of the driver</td><td>N</td></tr><tr><td>contract_date</td><td>timestamp</td><td>The time that the customer confirmed and made the payment for the insurance contract.</td><td>Y</td></tr><tr><td>trip_start_time</td><td>timestamp</td><td></td><td>Y</td></tr><tr><td>trip_end_time</td><td>timestamp</td><td></td><td>Y</td></tr><tr><td>from_city</td><td>string</td><td>e.g Thành phố Hồ Chí Minh</td><td>Y</td></tr><tr><td>to_city</td><td>string</td><td>e.g Thành phố Hồ Chí Minh</td><td>Y</td></tr><tr><td>from_address</td><td>string</td><td>e.g 135, Thành Thái, Quận 10, Thành phố Hồ Chí Minh</td><td>Y</td></tr><tr><td>to_address</td><td>string</td><td>e.g 135, Thành Thái, Quận 10, Thành phố Hồ Chí Minh</td><td>Y</td></tr><tr><td>ticket_number</td><td>string</td><td></td><td>Y</td></tr><tr><td>seat_numbers</td><td>array</td><td>e.g: A4, B5, ....</td><td>Y</td></tr><tr><td>price</td><td>number</td><td>Paid amount after the promotion/discount</td><td>Y</td></tr><tr><td>product_premium</td><td>string</td><td>1000000</td><td>Y</td></tr><tr><td>app_ref_id</td><td>string</td><td>A unique request ID from the partner to distinguish this request from others</td><td></td></tr></tbody></table>

**Responses**

| 200 | OK |
| --- | -- |

```

{
    "code": 0,
    "message": "OK",
    "data": {
        "policy_id": "string",
        "policy_number": "string",
        "claim_url": "string"
    }
}
```

## API #03 - Cancel ticket

* **Purpose:** The partner can request this API to cancel the ticket of a policy.
* **Trigger when**: When the user makes canceling the ticket on the partner's tools.

{% openapi src="/files/6jJUNOusgDst6uaoSINQ" path="/vendor/accident-insurance/policies/{policy\_id}/orders/{order\_id}/tickets/{ticket\_number}" method="put" %}
[ti\_vendor\_service.swagger.json](https://3720431088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJO1JowLW6ZG3LGhkByhm%2Fuploads%2FUJG1BgNupdOV2alqmley%2Fti_vendor_service.swagger.json?alt=media\&token=562b8bdd-806c-405c-ab2d-5234ed6d7945)
{% endopenapi %}

## API #04 - Create claim request

* **Purpose:**  The partner system call to submit a claim request to Saladin when the customer cancels the trip and they eligible to participate in the program "Tri ân khách hàng".
* **Trigger when**: When the user cancels the trip and presses a CTA to submit a claim request.

### **Parameters**

**Body**

{% openapi src="/files/wIeccoYmwVgcO1lC0Osh" path="/vendor/trip-insurance/claims" method="post" %}
[claim\_hub\_service.swagger.json](https://3720431088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJO1JowLW6ZG3LGhkByhm%2Fuploads%2FfcohHNpyrPevMrVazJlK%2Fclaim_hub_service.swagger.json?alt=media\&token=c2ef45a2-6a52-4e83-9c20-1882e5fa77f7)
{% endopenapi %}

## API #05 - Update Policy

&#x20;PUT :  /vendor/accident-insurance/policies/:policy\_id

* **Purpose:** The partner can request this API to edit the insurance contract.
* **Trigger when**: Customer or Admin makes changes details of the order.
* **Rules for update**:
  * All changes are only accepted before the estimated time departure of the trip.
  * All of the fields on the API's body will be replaced on the insurance contract except channel.&#x20;
  * If the insurance premium increases, the customer must pay more or the agent must collect the difference in the payment\_amount field.

### **Parameters**

**Path**

<table><thead><tr><th width="190">Field</th><th width="124">Data Type</th><th width="339">Description</th><th>Required</th></tr></thead><tbody><tr><td>policy_id</td><td>string</td><td></td><td>Y</td></tr></tbody></table>

**Body**

<table><thead><tr><th width="210">Field</th><th width="82">Data Type</th><th width="372">Description</th><th>Required</th></tr></thead><tbody><tr><td>order_id</td><td>string</td><td>The id of the order on the partner system. </td><td>Y</td></tr><tr><td>channel</td><td>enum</td><td>1 - Offline.<br>2 - Online.</td><td>Y</td></tr><tr><td>ticket_number</td><td>string</td><td></td><td>Y</td></tr><tr><td>buyer_name</td><td>string</td><td>Full name of the buyer</td><td>Y</td></tr><tr><td>buyer_phone</td><td>string</td><td>Phone number of the buyer</td><td>Y</td></tr><tr><td>buyer_email</td><td>string</td><td>email of the buyer</td><td>Y</td></tr><tr><td>bus_operator</td><td>string</td><td></td><td>Y</td></tr><tr><td>bus_phone_number</td><td>string</td><td></td><td>Y</td></tr><tr><td>bus_number_plate</td><td>string</td><td></td><td>N</td></tr><tr><td>driver_phone</td><td>string</td><td>Phone number of the driver</td><td>N</td></tr><tr><td>contract_date</td><td>date_time</td><td>The time that the customer confirmed and made the payment for the insurance contract.</td><td>Y</td></tr><tr><td>trip_start_time</td><td>date_time</td><td></td><td>Y</td></tr><tr><td>trip_end_time</td><td>date_time</td><td></td><td>Y</td></tr><tr><td>from_city</td><td>string</td><td>e.g Thành phố Hồ Chí Minh</td><td>Y</td></tr><tr><td>to_city</td><td>string</td><td>e.g Thành phố Hồ Chí Minh</td><td>Y</td></tr><tr><td>from_address</td><td>string</td><td>e.g 135, Thành Thái, Quận 10, Thành phố Hồ Chí Minh</td><td>Y</td></tr><tr><td>to_address</td><td>string</td><td>e.g 135, Thành Thái, Quận 10, Thành phố Hồ Chí Minh</td><td>Y</td></tr><tr><td></td><td>string</td><td></td><td>Y</td></tr><tr><td>seat_numbers</td><td>array</td><td>e.g: A4, B5, ....</td><td>Y</td></tr><tr><td>price</td><td>number</td><td>Paid amount after the promotion/discount</td><td>Y</td></tr></tbody></table>

**Responses**

| 200 | OK |
| --- | -- |

```
{
  "code": "integer",​
  "message": "string",​
  "policy_id": "string"
  "policy_number": "string"
  "new_premium_amount": "integer"
  "payment_amount": "integer"
}
```

## API #06 - Get policy information

* **Purpose:** The partner can call this API to check the status of the policy of the order.

{% openapi src="/files/RTEekWkBQFiNuXTdVXGZ" path="/vendor/accident-insurance/policies" method="get" %}
[trip\_240528.json](https://3720431088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJO1JowLW6ZG3LGhkByhm%2Fuploads%2FqM7FlrdpmTJcljIidr3H%2Ftrip_240528.json?alt=media\&token=23c5137b-bf49-440e-bd10-58dc29d55110)
{% endopenapi %}

## API #07 - Cancel Policy

**Purpose:** The partner can call this API to cancel the policy.&#x20;

Rules For Cancellation

* The policy is only canceled 48 hours before the estimated departure time of the trip

{% openapi src="/files/RTEekWkBQFiNuXTdVXGZ" path="/vendor/cancel-policy/{policy\_id}" method="post" %}
[trip\_240528.json](https://3720431088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJO1JowLW6ZG3LGhkByhm%2Fuploads%2FqM7FlrdpmTJcljIidr3H%2Ftrip_240528.json?alt=media\&token=23c5137b-bf49-440e-bd10-58dc29d55110)
{% endopenapi %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://tripins.saladin.vn/api-document-for-embedded-trip-insurance/api-details.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
