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 walks you through integrating Yasmina’s SME Medical Insurance Price Comparison APIs into your platform (for the single-provider version, click here). These APIs let you retrieve and compare medical insurance packages from several insurance providers before issuing policies to a company’s employees. Using our secure and reliable endpoints, you’ll be able to request and manage policies, and issue claims. Everything you need to deliver insurance services seamlessly within your application.Basic Journey
- Authorize: Get an access token to authenticate all API requests.
- Create a Company: Register the SME that will provide medical insurance for its employees.
- Add the Employees: Save the company’s employees, each with the tier they want.
- Get Prices: One request prices those employees with every insurance provider at once.
- Issue the Policy: Pick a quote and issue the company’s policy from it.
- Health Declarations: Get the declaration questions, download a printable form, or fill them in on the employees’ behalf.
- Payment: Receive a secure payment link to finalize the purchase, and get the policy document once it clears.
Authorization
To access any of our API’s. You need to authorize yourself using the Generate Token API. We are using the standard OAuth 2.0 client credentials.The Generate Token API requires
client_id and client_secret. You can get these from your portal.After making the request, you will get access_token in the response. The
access_token must be used on all future Yasmina APIs and be supplied in the Authorization Header in the following form
Authorization: Bearer {access_token}
Companies
Create a Company record
After acquiring an access_token, you can begin using the APIs. Before you produce policies for a company, you must create a company record. After creating the company record, you can request to issue policies to the employees of that company. The The Create Company API, will require a few fields that define details of the company such as Email, Phone, the company’s unified national number, a 10-digit sponsor number, and a 10-digit commercial registration number that starts with 7. It will return a response with a unique identifier (id). Here is an example of the response from the POST companies API.Prices
Compare the packages
Every insurance provider sells the same four tiers, so an employee’s choice can be priced by all of them:basic, standard, premium and executive. What each provider puts inside a tier, and what it charges for it, is its own. The Categories API shows one provider’s tiers at a time; call it once per provider, passing insurance_provider as one of the values below, or omit it for MedGulf.
Each response carries the provider as
insurance_provider and its display name as insurance_provider_name, then:
- The Insurance provider PDF
- Contains an overview picture of what is provided by the Insurance provider
- The translations
- The translations includes keys that map to the instructional text in Arabic and English that were provided by the insurance provider.
- The categories
- One entry per tier, with the coverage values and the yearly
priceper person
- One entry per tier, with the coverage values and the yearly
Add the employees
The Employees API holds the company’s employee list: who is covered, their dependents, and the tier each has picked. It prices nothing. Send the whole list; each call replaces the one before, and you can read it back at any time.John is Saudi (
nationality_iso is SA), so we supply his nationality_id. Richard is not Saudi, so we supply his iqama_id instead. The API rejects the request if a Saudi employee has no nationality_id or a non-Saudi employee has no iqama_id. Every identifier, for employees and dependents alike, must be exactly 10 digits, and every employee needs a mobile_number.category is one of the four tiers. Employees can be on different tiers.
Dependents
An employee can bring family members onto the policy through thedependents array. Each dependent needs a name, a relationship to the employee (spouse, child or parent), a nationality_iso, a date_of_birth, and the same identifier rule as the employee: a 10-digit nationality_id for Saudis, a 10-digit iqama_id for everyone else. Dependents do not carry their own mobile number. Dependents are covered under the employee’s tier; they cannot have one of their own. Leave the array out, or send it empty, for an employee with no dependents.
Dates of birth
Send everydate_of_birth as YYYY-MM-DD. Saudi nationals whose national id starts with 1 give the Hijri (Umm al-Qura) date printed on their id, as John and his family do above; everyone else gives a Gregorian date. Employees must be between 18 and 110 years old; dependents can be any age.
Get prices from every provider
Call the Quote request API with thecompany_id and you get one response with a quote from every insurance provider, each priced for the employees saved above at the tiers they picked. Every quote carries a quote_price_id; the response itself carries an id, the quote_request_id. Keep both for the next step.
total_price is what the company pays for a year of cover with that provider, and the employees lines show where it comes from. A quote prices the employees as they stood when it was asked for; change the list and ask again.
Policies
Issue the policy
A company buys one policy, and its employees are the members on it, which is how the insurer issues it and how the policy document reads. Call the Issue policy API with thequote_request_id and the quote_price_id of the quote the company chose, and you get that one policy back: the provider that priced it, the quoted total as price, and every employee inside meta_data.insured.
Health declaration forms
Insurers require a past medical history from every employee before they will cover them. Yasmina publishes the questions and prints the form; the company collects the answers itself, on paper or inside your own platform.- The questions: the Medical form API returns every question, grouped the way the insurers ask them, so you can build your own screen for it.
-
The printable form: the Download declaration form API returns the same declaration as a PDF. Pass a
company_idand the file carries one page per employee you have already enrolled, with their name, id and package filled in, ready to print or email. Leavecompany_idout for a single blank form. -
Filling them in for the employees: a company admin can answer on their behalf with the Fill medical forms API. It takes the
company_id,all_employees, the default answers for everyone, andids_or_emails, the employees whose answers differ. Name an employee by theirnationality_idoriqama_id; one that matches nobody in the company is rejected. The answers are stored against each employee’s policy, and the response tells you how many are now declared and how many are still missing. For example, if nobody has had surgery except [email protected], declareNoforpast_surgeriesunderall_employeesand override that one employee:
Payment
Every employee must have a health declaration on file before a company can pay. Ask for a payment link while any of them is missing one and the API answers
422, naming the employees still to declare.price is in the categories response, so you can show the bill before anyone pays.
Then get a link with the Payment link API and share it in your platform. It opens Yasmina’s secure card page, where the company pays for all of its employees in one go. The link is signed and expires after 15 minutes, so fetch it when the buyer is ready to pay rather than storing it. A company with nothing outstanding gets a 422 instead of a link.
Payment and Policy activation
When you first issue the policy, it 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, and the policy schedule listing every member becomes available through the List policies API.
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.
Redirect URL
You can supply the payload aredirect_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