Skip to main content

Build it with AI — an AI coding assistant can scaffold this entire integration for you straight from these docs. See Build with AI to get started.

Introduction

This guide introduces Yasmina’s Motor Insurance Price Comparison APIs, covering both comprehensive and TPL cover (for the single-provider versions, see Comprehensive and TPL). 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

  • Request OTPs
  • Requesting and managing quotes
  • Uploading vehicle photos
  • Issuing and managing policies

Prerequisites

  1. Account in Yasmina - See the Onboarding section for details. You need “Motor Insurance Comprehensive (Price Comparison)”, “Motor Insurance TPL (Price Comparison)”, or both in the products field, depending on the cover you want quoted.
  2. Authenticated Token - You can follow the Authentication guide or head straight to the Generate Token API.
  3. Backend server - Required to securely call Yasmina APIs.

Quotes

Quotes represent the different premiums, benefits, and deductibles offered by insurance providers. Before issuing a motor insurance policy, you need to provide the car details to retrieve quotes from various insurance providers. A single quote request returns both comprehensive and TPL offers, so the same flow covers either cover type. These quotes are then used when issuing the policy.

OTP for quotations

Before requesting quotations, we need to verify the Phone number of the customer through an OTP. You can do that using the Quote OTP API You need to provide the following properties for the Quote OTP API: Example Payload
The customer should then receive an OTP. The API returns 204 No Content. This quote OTP remains valid for 8 hours and can be reused for multiple quote requests during that period. You do not need to request a new quote OTP before every quotation. The response includes:
  • X-OTP-Expires-In: Remaining validity in seconds
  • X-OTP-Expires-At: Exact expiry time in ISO 8601 format
Requesting a new quote OTP invalidates the previously issued quote OTP. After 8 hours, request a new OTP before submitting another quote request.
Afterwards you will be ready to Request Quotations.

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 logo, 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 2 minutes before making the request.
You need to provider the following properties for the Request Quotes API:

Customs card vehicle lookup

If your customer identifies vehicles only by customs card number, collect the provider-compatible maker, model, and body-type codes before requesting a quote. Do not send codes from your own vehicle catalogue. All three lookup endpoints support an optional q query parameter. It searches English and Arabic names without case sensitivity. A complete numeric value searches by exact code. The maximum search length is 100 characters.

1. Search vehicle makers

Only makers with at least one available model are returned.

2. Search models for the selected maker

maker_code is required. The returned model codes belong only to that maker.

3. Search vehicle body types

Each lookup endpoint returns an array with the same structure:
For a customs card quote, send custom_number, maker_code, model_code, and body_type_code. Omit car_sequence_number. Yasmina registers the imported vehicle with the insurance platform before requesting quotations. If the vehicle is already registered, the quotation continues normally.

Drivers Array

When providing drivers, each driver object must include the following fields:
When drivers are provided, the vehicle owner must be included among the drivers.
Example request
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, trimmed to a single provider quote:

Explaining the Quotes Request response

The response has two halves. The first is an echo of what you sentowner_id, email, phone, birthdate, the vehicle identifier, drivers, start_date. Nothing new, but it means a stored response is enough to re-render the customer’s page later without keeping your own copy of the request. The second is the offers: the top-level id, and the quotes array with one entry per offer the insurance providers returned.
The same insurance company can appear several times in quotes. Each entry is a distinct offer — a cover type (type) combined with a repair type (fix_type). Al Rajhi Takaful, for instance, commonly returns a Comprehensive/Agency offer, a Comprehensive/Workshop offer and a TPL offer: three entries, each with its own quote_reference_id, its own prices and its own benefits. Group by company_name if you want one card per company in your UI.

The shape at a glance

The identifiers you carry into issuance

Policy issuance never re-sends the car or the customer details — it points back at one exact selection inside this response. Four values do that:
All four must describe one consistent selection: the price must belong to the same quotes[] entry as the reference, and the benefits must belong to that same entry too. A quote_price_id from one provider sent with another provider’s quote_reference_id is rejected.
The Issue Policy OTP API takes the first three; the Issue Policy API takes all four. Keep the customer’s selection around between the two calls.

Top-level fields

integer
Yasmina’s identifier for this quote request. Send it as quote_request_id when issuing, and use it to fetch the request again with the Show Quote Request API.
object[]
The offers returned by the insurance providers. Empty if no provider priced this vehicle and driver combination. Each entry is described under Each offer (quotes[]) below.
object | null
The five vehicle photos once they have been uploaded, keyed by position (front, back, right, left, chassis). null until you call the Upload Vehicle Photos API.
string (uuid)
Your client identifier. Same value on every quote request you create.
string (date-time)
When the quote request was made. Useful together with quote_expiry_date when deciding whether to re-quote.
string (date-time)
When the record last changed — for example after vehicle photos were uploaded.
Alongside those, the request values come back unchanged: owner_id, email, phone, birthdate, is_ownership_transfer, current_car_owner_id, car_estimated_cost, car_model_year, start_date and drivers, plus the vehicle identifier you used. Two details are worth knowing:
  • current_car_owner_id is filled with owner_id when is_ownership_transfer is false.
  • The customs-card fields (custom_number, maker_code, model_code, body_type_code) appear only for imported vehicles; car_sequence_number appears only for locally registered ones.
Anything not listed here or below is internal bookkeeping. Do not build against fields this page does not document — they can change without notice.

Each offer (quotes[])

string (uuid)
The provider’s identifier for this offer. Send it as quote_reference_id when issuing. It is unique per offer, not per company: a company returning three cover types returns three different reference IDs.
string
English name of the insurance company, e.g. Al Rajhi Takaful.
string
Arabic name of the same company. Falls back to the English name if a company is not yet mapped.
string (uri)
Absolute CDN URL of the company’s wide logo — the one to put on a quote card. Empty string if the company has no logo on file. The CDN host differs between sandbox and production, so always render the URL as returned rather than rebuilding it.
string (uri)
Absolute CDN URL of the same company’s square logo, for avatars, list rows and other tight spaces. Empty string if none is on file.
Deprecated. A path relative to Yasmina’s own web app, not a usable URL from your side. Kept for backward compatibility only — use company_logo_url.
string
The normalised cover category, and the field to filter and group on. Always one of:
string
The provider’s own wording for the same product, unnormalised — TPL Plus, TPL + OD, Wafi Smart, and so on. Show this to the customer; filter on type.
string
Arabic translation of insurance_type_display. Falls back to the English value for provider-specific products that have no translation yet.
string
Where a claim gets repaired: Agency (the manufacturer’s authorised dealer, more expensive) or workshop (an approved independent garage). Empty for TPL offers, which carry no own-damage repair. This is the single biggest reason two offers from the same company differ in price, so it is worth surfacing in the UI.
number
The vehicle value this offer was priced against, in SAR. Normally the provider’s own valuation; it falls back to the car_estimated_cost you sent when the provider does not return one. Worth showing on Comprehensive offers, since it is the ceiling of an own-damage payout.
string (date-time)
When the provider’s offer lapses. Validity varies by provider and by product — some offers stand for days, others for months. After this moment the offer can no longer be issued, so request fresh quotes rather than replaying a stored response.
object[]
The price options for this offer, one per deductible. See below.
object[]
The benefits attached to this offer, both included and optional. See below.

Price options (quotes[].prices[])

One offer carries several prices — the same cover at different deductibles. The deductible is what the customer pays out of their own pocket on a claim, so a higher deductible buys a lower premium. A comprehensive offer routinely comes with ten or more of these; a TPL offer usually has exactly one.
string (uuid)
Identifies the price the customer picked. Send it as quote_price_id when issuing, and to the Upload Vehicle Photos API.
number | null
The excess in SAR that the customer bears on each claim. null on TPL offers, which have no deductible.
number
The premium for this option in SAR, before VAT.
number
The VAT rate applied, as a percentage. 15 in Saudi Arabia today.
number
The VAT amount in SAR for this option.
number
subtotal + vat — what the customer pays for the cover itself. It does not include any optional benefits — see What the customer actually pays below.

Benefits (quotes[].benefits[])

Benefits are the add-ons that come with an offer. amount alone tells you which of the two kinds you are looking at:
string (uuid)
Identifies this benefit on this offer. Collect the IDs of the paid benefits the customer ticked and send them as the benefits array to the Issue Policy API. The ID is specific to one offer — a benefit that also appears on another provider’s offer has a different quote_benefit_id there.
string
The provider’s benefit code, e.g. 600100 for roadside assistance. Stable across quote requests, so it is the right key if you want to remember a customer’s preferences or map benefits to your own icons and copy.
string
English name of the benefit, e.g. Roadside assistance service.
string
Arabic name of the same benefit.
number
Price of the benefit in SAR, excluding VAT. 0 means it is included in the cover at no extra cost.
number
VAT on amount, in SAR. 0 for included benefits.
string | null
A provider link with the benefit’s terms, when the provider supplies one. Usually null — render the link only when it is present.

What the customer actually pays

prices[].total is the price of the cover on its own. Every paid benefit the customer adds is charged on top of it, with its own VAT. Taking the example response above, with the 500 SAR deductible and roadside assistance added: You do not have to compute this yourself to charge the customer — the Issue Policy API returns the final price on the policy object and generates a payment link for exactly that amount. Compute it only to show the customer a breakdown before they commit.
Included benefits (amount = 0) never change the price. Adding them to the benefits array when issuing is unnecessary.

Arabic localisation fields

Each quote object includes Arabic counterparts for the fields that typically appear in the UI. Use these when rendering an Arabic experience: type is a normalised category value used for filtering and grouping (TPL, TPL +, Comprehensive) and has no Arabic equivalent — use insurance_type_display_ar for display purposes. Both languages are present in every quote, so rendering an Arabic quote card never takes a second call.

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 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 Delete Quotes Requests API. This is rarely used, but may be helpful if you’d like to reduce the items listed.

Vehicle photos

If the customer has selected a comprehensive policy, upload the five photos before you issue the policy — front, back, right, left, and the chassis (VIN) number. Use the Upload Vehicle Photos API, against the quote request and the price the customer selected.
This step is required for comprehensive cover. If the photos are not uploaded, the customer cannot continue with the purchase. It must happen before you request the payment OTP.
Example of a request
Example of a response

Rules

  • All five together. A partial upload is rejected with a 422.
  • JPG or PNG, up to 3 MB each. Other formats and anything larger are rejected.
  • Once per vehicle. The insurance provider keeps the first set it accepts. A later upload for the same vehicle still returns 200, with already_registered: true in the response, but the registered photos do not change. Check the photos before sending them.
  • Comprehensive only. A quote_price_id belonging to a TPL quote is rejected.

Issuing policies

Issue Policy OTP

When a customer selects a quotation, they need to go through another OTP check. This time you need to request it through the Issue OTP API The Issue Policy OTP requires the following fields: The three quote identifiers must come from the response returned by the earlier POST /quote-requests call. Use the provider quote and price selected by the customer from that same response. Example request:
The customer will receive a separate policy issuance OTP, and the API returns 204 No Content on success. This OTP is valid for 15 minutes and must be supplied to the Issue Policy API within that period. If it expires, request a new issuance OTP before issuing the policy.
The 8-hour quote OTP validity does not apply here. The policy issuance OTP expires after 15 minutes.

Issuing a policy

In order to Issue a policy. You can head to the Issue Policy API Use the same three identifiers previously sent to the Issue Policy OTP API. They must all come from the earlier POST /quote-requests response and represent one consistent customer selection. Example of a request
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.
This is a summary of the fields returned in the policy object

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.
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.
On 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

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
Will become on the response
And the customer that purchased the policy will be redirected to https://www.example.com?yasmina_policy_id=123

Showing a policy

In order to get a status of a policy, you can use the Show Policy API. 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
Example a response

Listing policies

You can also use the List Policies API 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.