Issue policy
curl --request POST \
--url https://sandbox.yasmina.ai/api/v1/life-snp/policies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"offer_id": "<string>",
"applicant_id": "<string>",
"date_of_birth": "2023-12-25",
"smoker": true,
"policy_term_years": 22,
"agreed_premium": 51,
"start_date": "2023-12-25",
"beneficiaries": [
{
"name": "<string>",
"national_id": "<string>",
"share_percentage": 50
}
],
"consent": true
}
'import requests
url = "https://sandbox.yasmina.ai/api/v1/life-snp/policies"
payload = {
"offer_id": "<string>",
"applicant_id": "<string>",
"date_of_birth": "2023-12-25",
"smoker": True,
"policy_term_years": 22,
"agreed_premium": 51,
"start_date": "2023-12-25",
"beneficiaries": [
{
"name": "<string>",
"national_id": "<string>",
"share_percentage": 50
}
],
"consent": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
offer_id: '<string>',
applicant_id: '<string>',
date_of_birth: '2023-12-25',
smoker: true,
policy_term_years: 22,
agreed_premium: 51,
start_date: '2023-12-25',
beneficiaries: [{name: '<string>', national_id: '<string>', share_percentage: 50}],
consent: true
})
};
fetch('https://sandbox.yasmina.ai/api/v1/life-snp/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.yasmina.ai/api/v1/life-snp/policies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'offer_id' => '<string>',
'applicant_id' => '<string>',
'date_of_birth' => '2023-12-25',
'smoker' => true,
'policy_term_years' => 22,
'agreed_premium' => 51,
'start_date' => '2023-12-25',
'beneficiaries' => [
[
'name' => '<string>',
'national_id' => '<string>',
'share_percentage' => 50
]
],
'consent' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.yasmina.ai/api/v1/life-snp/policies"
payload := strings.NewReader("{\n \"offer_id\": \"<string>\",\n \"applicant_id\": \"<string>\",\n \"date_of_birth\": \"2023-12-25\",\n \"smoker\": true,\n \"policy_term_years\": 22,\n \"agreed_premium\": 51,\n \"start_date\": \"2023-12-25\",\n \"beneficiaries\": [\n {\n \"name\": \"<string>\",\n \"national_id\": \"<string>\",\n \"share_percentage\": 50\n }\n ],\n \"consent\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.yasmina.ai/api/v1/life-snp/policies")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"offer_id\": \"<string>\",\n \"applicant_id\": \"<string>\",\n \"date_of_birth\": \"2023-12-25\",\n \"smoker\": true,\n \"policy_term_years\": 22,\n \"agreed_premium\": 51,\n \"start_date\": \"2023-12-25\",\n \"beneficiaries\": [\n {\n \"name\": \"<string>\",\n \"national_id\": \"<string>\",\n \"share_percentage\": 50\n }\n ],\n \"consent\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.yasmina.ai/api/v1/life-snp/policies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"offer_id\": \"<string>\",\n \"applicant_id\": \"<string>\",\n \"date_of_birth\": \"2023-12-25\",\n \"smoker\": true,\n \"policy_term_years\": 22,\n \"agreed_premium\": 51,\n \"start_date\": \"2023-12-25\",\n \"beneficiaries\": [\n {\n \"name\": \"<string>\",\n \"national_id\": \"<string>\",\n \"share_percentage\": 50\n }\n ],\n \"consent\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"client_id": "<string>",
"provider_policy_id": 123,
"provider_policy": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"policy_term_years": 123,
"sum_assured": 123,
"premium_amount": 123,
"premium_frequency": "<string>",
"approval_status": 123,
"order_status": 123,
"status": "active",
"beneficiaries": [
{
"name": "<string>",
"national_id": "<string>",
"relationship": "<string>",
"share_percentage": 123
}
],
"iban_masked": "SA03*****************519",
"is_claimed": true,
"canceled_at": "<string>",
"invoice": "<string>",
"cancellation_document": "<string>",
"meta_data": {},
"created_at": "<string>",
"updated_at": "<string>"
}{
"code": "40101",
"message": "Unauthenticated"
}{
"code": "<string>",
"message": "<string>"
}Issue policy
Issue a Life S&P policy based on a selected offer.
POST
/
policies
Issue policy
curl --request POST \
--url https://sandbox.yasmina.ai/api/v1/life-snp/policies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"offer_id": "<string>",
"applicant_id": "<string>",
"date_of_birth": "2023-12-25",
"smoker": true,
"policy_term_years": 22,
"agreed_premium": 51,
"start_date": "2023-12-25",
"beneficiaries": [
{
"name": "<string>",
"national_id": "<string>",
"share_percentage": 50
}
],
"consent": true
}
'import requests
url = "https://sandbox.yasmina.ai/api/v1/life-snp/policies"
payload = {
"offer_id": "<string>",
"applicant_id": "<string>",
"date_of_birth": "2023-12-25",
"smoker": True,
"policy_term_years": 22,
"agreed_premium": 51,
"start_date": "2023-12-25",
"beneficiaries": [
{
"name": "<string>",
"national_id": "<string>",
"share_percentage": 50
}
],
"consent": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
offer_id: '<string>',
applicant_id: '<string>',
date_of_birth: '2023-12-25',
smoker: true,
policy_term_years: 22,
agreed_premium: 51,
start_date: '2023-12-25',
beneficiaries: [{name: '<string>', national_id: '<string>', share_percentage: 50}],
consent: true
})
};
fetch('https://sandbox.yasmina.ai/api/v1/life-snp/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.yasmina.ai/api/v1/life-snp/policies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'offer_id' => '<string>',
'applicant_id' => '<string>',
'date_of_birth' => '2023-12-25',
'smoker' => true,
'policy_term_years' => 22,
'agreed_premium' => 51,
'start_date' => '2023-12-25',
'beneficiaries' => [
[
'name' => '<string>',
'national_id' => '<string>',
'share_percentage' => 50
]
],
'consent' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.yasmina.ai/api/v1/life-snp/policies"
payload := strings.NewReader("{\n \"offer_id\": \"<string>\",\n \"applicant_id\": \"<string>\",\n \"date_of_birth\": \"2023-12-25\",\n \"smoker\": true,\n \"policy_term_years\": 22,\n \"agreed_premium\": 51,\n \"start_date\": \"2023-12-25\",\n \"beneficiaries\": [\n {\n \"name\": \"<string>\",\n \"national_id\": \"<string>\",\n \"share_percentage\": 50\n }\n ],\n \"consent\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.yasmina.ai/api/v1/life-snp/policies")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"offer_id\": \"<string>\",\n \"applicant_id\": \"<string>\",\n \"date_of_birth\": \"2023-12-25\",\n \"smoker\": true,\n \"policy_term_years\": 22,\n \"agreed_premium\": 51,\n \"start_date\": \"2023-12-25\",\n \"beneficiaries\": [\n {\n \"name\": \"<string>\",\n \"national_id\": \"<string>\",\n \"share_percentage\": 50\n }\n ],\n \"consent\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.yasmina.ai/api/v1/life-snp/policies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"offer_id\": \"<string>\",\n \"applicant_id\": \"<string>\",\n \"date_of_birth\": \"2023-12-25\",\n \"smoker\": true,\n \"policy_term_years\": 22,\n \"agreed_premium\": 51,\n \"start_date\": \"2023-12-25\",\n \"beneficiaries\": [\n {\n \"name\": \"<string>\",\n \"national_id\": \"<string>\",\n \"share_percentage\": 50\n }\n ],\n \"consent\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"client_id": "<string>",
"provider_policy_id": 123,
"provider_policy": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"policy_term_years": 123,
"sum_assured": 123,
"premium_amount": 123,
"premium_frequency": "<string>",
"approval_status": 123,
"order_status": 123,
"status": "active",
"beneficiaries": [
{
"name": "<string>",
"national_id": "<string>",
"relationship": "<string>",
"share_percentage": 123
}
],
"iban_masked": "SA03*****************519",
"is_claimed": true,
"canceled_at": "<string>",
"invoice": "<string>",
"cancellation_document": "<string>",
"meta_data": {},
"created_at": "<string>",
"updated_at": "<string>"
}{
"code": "40101",
"message": "Unauthenticated"
}{
"code": "<string>",
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Offer identifier returned by /offers.
Pattern:
^\d{10}$Available options:
male, female Required range:
5 <= x <= 40Available options:
monthly, quarterly, semi_annual, annual Required range:
x >= 50Minimum array length:
1Customer consents to policy issuance and bank auto-debit.
Required range:
x >= 10000Customer bank IBAN for premium collection.
Example:
"SA0380000000608010167519"
Optional key-value extras (max JSON-encoded size 255 chars).
Response
Created
Example:
"active"
Example:
"SA03*****************519"
⌘I

