> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yasmina.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# TPL Motor Insurance

> Seamless insurance for the cars you're selling and the drivers that are buying from you.

## Introduction

This guide introduces Yasmina’s **TPL Motor Insurance APIs for Multiple Insurance Providers** (for the single-provider version, [click here](/single-provider-integrations/cartpl)). These APIs enable you to retrieve quotes from several insurance companies before issuing a policy to your customer. The guide covers all key operations, including requesting quotes, issuing and managing policies, generating payment links, and handling claims. Our APIs are built on RESTful principles and follow consistent input and output structures, making them simple to integrate, test, and maintain within your systems

## What you will learn

* Requesting and managing quotes
* Issuing and managing policies
* Starting a claim

## Prerequisites

1. **Account in Yasmina** - See the <a href="/introduction#onboarding" target="_blank">Onboarding section</a> for details. You need to add "TPL Motor Insurance (Multiple Providers)" in the products field.
2. **Authenticated Token** - Follow the <a href="/authentication" target="_blank">Authentication guide</a> to generate one.
3. **Backend server** - Required to securely call Yasmina APIs.

## Quotes

Quotes are the different premiums and benefits offered by insurance providers. Unlike Comprehensive Motor Insurance Quotes, TPL quotes do not have multiple deductibles, they only have one. Before issuing a TPL Motor insurance policies you need to give the car details to get different quotes from insurance providers. These quotes are then used to issuing the policy.

### Request Quotes

In order to provide quotes for your customer you need to execute the <a href="/car-api-reference/quotes/request-quotes" target="_blank">Request Quotes API</a>. This API provides an array response from different insurance providers. Each item in this array, represents the name of the company, the different premiums and deductibles, and also the list of benefits (both free and paid).

<Note>The Request Quotes API may take longer to respond because it retrieves results from multiple insurance providers. Be sure to increase your timeout to at least 1 minute before making the request.</Note>

You need to provider the following properties for the Request Quotes API

| Field                   | Example Value         | Is Required       | Description                                                                                                                                                                 |
| ----------------------- | --------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `owner_id`              | `2234567890`          | Yes               | The owner’s national ID. Must be 10 digits and typically starts with 1, 2, or 7.                                                                                            |
| `email`                 | `someone@example.com` | Yes               | The owner’s email. Must be unique and belong to the one customer (Do not use the same email for multiple customers).                                                        |
| `birthdate`             | `1988-04-20`          | Yes               | Date of birth of the owner in `YYYY-MM-DD` format. If the owner ID is a Saudi National, then you need to give Hijri date, otherwise you need to give a Gregorian birthdate. |
| `phone`                 | `05XXXXXXXX`          | Yes               | Saudi mobile number. Must start with `05` and be exactly 10 digits.                                                                                                         |
| `car_sequence_number`   | `52423810`            | Yes               | The car’s sequence number (8–9 digits).                                                                                                                                     |
| `is_ownership_transfer` | `false`               | No                | Boolean flag. `true` if the car is being transferred to a new owner, otherwise `false`. Defaults to `false` when omitted.                                                   |
| `current_car_owner_id`  | `1234567890`          | Yes (if transfer) | The current owner’s national ID. **Only required if** `is_ownership_transfer = true`.                                                                                       |
| `car_estimated_cost`    | `45000`               | Yes               | Estimated market cost of the car in SAR.                                                                                                                                    |
| `car_model_year`        | `2026`                | Yes               | Year of manufacture of the car. Must be between 1950 and the next year.                                                                                                     |
| `start_date`            | `2025-12-01`          | No                | Start date of the policy (format: `YYYY-MM-DD`). Must be between the next day and 28 days from today (inclusive). Yasmina validates this range server-side.                 |

Example request

```
POST /api/v1/car-comp/quote-requests HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: ••••••
Content-Length: 226

{
    "owner_id": 2234567890,
    "email": "someone@example.com",
    "phone": "05XXXXXXXX",
    "birthdate": "1982-04-20",
    "car_sequence_number": 52423810,
    "is_ownership_transfer": false,
    "car_estimated_cost": 45000,
    "car_model_year": 2024
}
```

Once you execute this you will get a response that includes pricing and benefits from multiple insurance providers. This is an example of a response in json

```
{
  "owner_id": 1234567890,
  "email": "someone@example.com",
  "phone": "0555555555",
  "birthdate": "1990-01-01",
  "car_sequence_number": 1111111111,
  "is_ownership_transfer": true,
  "current_car_owner_id": "7000000000",
  "car_estimated_cost": 45000,
  "car_model_year": 2024,
  "quotes": [
    {
      "type": "Comprehensive",
      "fix_type": "workshop",
      "vehicle_estimated_value": 45000,
      "company_logo": "https://axjqy4nuifd8.compat.objectstorage.me-jeddah-1.oraclecloud.com/Yasmina-Dev-bucket/logos/takaful.png",
      "company_name": "Al Rajhi Takaful",
      "quote_reference_id": "6c7c18a7-ee89-49fe-9f7e-dde72ad809ce",
      "prices": [
        {
          "quote_price_id": "f5d52340-3661-48af-b81a-028f251ef6a9",
          "deductible": 500,
          "subtotal": 5232.12,
          "vat_percentage": 15,
          "vat": 784.82,
          "total": 6016.94
        }, ...
      ],
      "benefits": [
        {
          "quote_benefit_id": "f72846cb-98ed-4b78-b3b5-bb0d587f8da5",
          "id": "1296",
          "name": "Natural Disasters",
          "amount": 0,
          "vat": 0,
          "url": null
        }, ...
      ]
    }
  ],
  "client_id": "9f757acd-1ab4-466f-8cb2-d65ddedb2374",
  "updated_at": "2025-10-06T22:03:56.000000Z",
  "created_at": "2025-10-06T22:03:56.000000Z",
  "id": 25
}
```

#### Explaining the Quotes Request response

The ID value represents Yasmina's unique identifier for this quote request. You will later need to provide in the <a href="/car-api-reference/policies/issue-policy" target="_blank">Issue policy API</a>
as `quote_id`

The Quote reference ID must also be provided to the Issue Policy API as `quote_reference_id`. Each insurance provider has its own quote\_reference\_id.

Each insurance provider gives a `prices` array. This represents different pricing options. Each has its own deductible and total. You will need to provide `quote_price_id` when issuing a policy.

Finally we have the `benefits` array. We have two types. Some require an additional price and are optional (`amount` > 0), while others are considered free and are automatically added (`amount` = 0).

For those that have a price, you need to provide the `quote_benefit_id` in the `benefits` array in the Issue Policy API.

### List Quotes Requests

You can list a paginated list of all the quote requests that your account has generated. In order to do so, you can use the
<a href="/car-api-reference/quotes/list-quotes" target="_blank">List quote requests API</a>

You can filter these by using `owner_id` in the query string. This may be useful in case your customer navigated from one page to another and you need to show the quote requests again (rather than making a new request)

Example:
GET /car-api-reference/quotes/list-quotes?page=2\&per\_page=1\&owner\_id=1234567890

### Delete Quotes Requests

You can delete some of the requests from the system using the <a href="/car-api-reference/quotes/delete-quote" target="_blank">Delete Quotes Requests API</a>.

This is rarely used, but may be helpful if you'd like to reduce the items listed.

## Issue policy

In order to Issue a policy. You can head to the <a href="/car-api-reference/policies/issue-policy" target="_blank">Issue Policy API </a>

You need to use the fields that were retrieved in the Request Quotes API.

| Field                | Description                                                                                                                                                                                                |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `quote_request_id`   | Yasmina’s unique identifier for the quote request. This must match the `id` returned when creating a quote request.                                                                                        |
| `quote_reference_id` | The unique reference ID provided by the insurance company. Required when issuing a policy.                                                                                                                 |
| `quote_price_id`     | The selected price option ID. Each quote has multiple prices with different deductibles.                                                                                                                   |
| `benefits`           | A list of selected benefit IDs. Only required if the benefit has a cost (`amount > 0`).                                                                                                                    |
| `extra_data`         | Optional JSON object to store additional metadata or custom values that can later be used in <a href="/webhooks/guide" target="_blank">webhooks</a>. Please keep minimal as it can't exceed 255 characters |

Example of a request

```
POST /api/v1/car-comp/policies HTTP/1.1
Authorization: Bearer *****
Content-Type: application/json
Accept: application/json
Content-Length: 212

{
  "quote_request_id": 11,
  "quote_reference_id": "04486448-3433-43ef-a755-b07799d6580f",
  "quote_price_id": "e059d28e-a519-43af-b9d4-e1cc5d97ecb7",
  "benefits": [],
  "extra_data": {
      "extra_field": 1
  }
}
```

Once you make a request to the Issue Policy API, you will get the Policy object with a `201` HTTP response code. Here is an example of the Policy object.

```
{
    "id": 700,
    "meta_data": {
        "extra_data": null,
        "new_owner_id": "2528297837",
        "quote_price_id": "f5d52340-3661-48af-b81a-028f251ef6a9",
        "quote_request_id": 25,
        "previous_owner_id": "7001364939",
        "car_sequence_number": 723787810
    },
    "provider_policy_id": null,
    "provider_policy": null,
    "created_at": "2025-10-06T23:31:17.000000Z",
    "status": 0,
    "payment_link": "http://localhost:8000/short/wVln4",
    "price": 6016
}
```

This is a summary of the fields returned in the policy object

| Field                | Description                                                                                                                               |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                 | Yasmina’s unique identifier for the policy.                                                                                               |
| `meta_data`          | A JSON object that contains information about the fields that were used to generate this policy. `extra_data` will also be returned here. |
| `provider_policy_id` | The policy ID that is returned by the policy provider.                                                                                    |
| `provider_policy`    | A URL that contains the policy in PDF format.                                                                                             |
| `created_at`         | When was the policy issued.                                                                                                               |
| `status`             | 0 = Pending, 1 = Issued.                                                                                                                  |
| \`payment\_link      | A secure payment link generated by Yasmina                                                                                                |
| `price`              | The price of the policy in Saudi Riyal                                                                                                    |

### Payment and Policy activation

When you first make a request to the Issue Policy API. The Policy is not yet activated and the `status` is `0` (which means pending).

Also the `provider_policy` and `provider_policy_id` will both be `null`.

In order for the policy to be activated, the customer needs to make the purchase from the payment link. Once the customer successfully pays. The policy will be activated and the `status` becomes `1`.

<Note>Although the payment page is provided by Yasmina, it does not display the Yasmina logo or have any mention of Yasmina. <br /><br />Yasmina does not receive credit card information, instead the payment page sends card information directly to the payment vendor.</Note>

<Tip>On Sandbox, you can use a testing card with the following information: <br /> Card number: 4111 1111 1111 1111 <br /> Expiry: 02/27 <br /> CVV: 123 <br />Card owner: Yasmina test</Tip>

### Redirect URL

You can supply the payload a `redirect_url`. This is used to redirect the customer to any page or deep link you need. You can also include a query string with policyID and it will automatically replace it with the actual `id` of the policy object.

Example for policy `id` 123

```
	{
		...,
		redirect_url: "https://www.example.com?yasmina_policy_id=policyID"
	}
```

Will become on the response

```
	{
		redirect_url: "https://www.example.com?yasmina_policy_id=123"
	}
```

And the customer that purchased the policy will be redirected to
[https://www.example.com?yasmina\_policy\_id=123](https://www.example.com?yasmina_policy_id=123)

### Showing a policy

In order to get a status of a policy, you can use the <a href="/car-api-reference/policies/show-policy" target="_blank">Show Policy API</a>. This API, takes a Yasmina Policy `id` and will return the policy object
This API is ideal when you want to re-fetch a specific policy after the PDF gets generated.

Example of a request

```
GET /api/v1/car-comp/policies/123 HTTP/1.1
Host: production.yasmina.ai
Authorization: Bearer <token>
Content-Type: application/json
Accept: application/json
```

Example a response

```
{
    "id": 659,
    "meta_data": {
        "extra_data": {
        },
        "new_owner_id": "2467701575",
        "quote_price_id": "097116f9-99b1-491f-a2ab-f86b2c535cbe",
        "quote_request_id": 4,
        "previous_owner_id": "2467701575",
        "car_sequence_number": 52423810
    },
    "product_id": 4,
    "provider_policy_id": "53018c24-b246-4bef-866f-4a54c2367196",
    "provider_policy": "policy.pdf",
    "created_at": "2025-09-07T07:53:55.000000Z",
    "status": 1,
    "payment_link": null,
    "price": null
}
```

### Listing policies

You can also use the <a href="/car-api-reference/policies/list-policies" target="_blank">List Policies API</a> to get a list of all policies that were generated from our system. You might use this on your admin interface, or if you just want to check what has been generated.
