Introduction
This guide introduces Yasmina’s TPL Motor Insurance APIs for Multiple Insurance Providers (for the single-provider version, click here). 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 systemsWhat you will learn
- Requesting and managing quotes
- Issuing and managing policies
- Starting a claim
Prerequisites
- Account in Yasmina - See the Onboarding section for details. You need to add “TPL Motor Insurance (Multiple Providers)” in the products field.
- Authenticated Token - Follow the Authentication guide to generate one.
- 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 Request Quotes API. 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).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.
Field | Example Value | Description |
---|---|---|
owner_id | 2234567890 | The owner’s national ID. Must be 10 digits and typically starts with 1, 2, or 7. |
email | [email protected] | 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 | 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 | Saudi mobile number. Must start with 05 and be exactly 10 digits. |
car_sequence_number | 52423810 | The car’s sequence number (8–9 digits). |
is_ownership_transfer | false | Boolean flag. true if the car is being transferred to a new owner, otherwise false . |
current_car_owner_id | 1234567890 | The current owner’s national ID. Only required if is_ownership_transfer = true . |
car_estimated_cost | 45000 | Estimated market cost of the car in SAR. |
car_model_year | 2026 | Year of manufacture of the car. Must be between 1950 and the next year. |
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 Issue policy API asquote_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 List quote requests API You can filter these by usingowner_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 Delete Quotes Requests API. 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 Issue Policy API 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 webhooks. Please keep minimal as it can’t exceed 255 characters |
201
HTTP response code. Here is an example of 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 |
Understanding Payment and Policy activation
When you first make a request to the Issue Policy API. The Policy is not yet activated and thestatus
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
.
Although the payment page is provided by Yasmina, it does not display the Yasmina logo or have any mention of Yasmina.
Yasmina does not receive credit card information, instead the payment page sends card information directly to the payment vendor.
Yasmina does not receive credit card information, instead the payment page sends card information directly to the payment vendor.
On Staging and Sandbox, you can use a testing card with the following information:
Card number: 4111 1111 1111 1111
Expiry: 02/27
CVV: 123
Card owner: Yasmina test
Card number: 4111 1111 1111 1111
Expiry: 02/27
CVV: 123
Card owner: Yasmina test
Showing a policy
In order to get a status of a policy, you can use the Show Policy API. This API, takes a Yasmina Policyid
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