Skip to content
Demo environment. M-Pesa and DMVIC are simulated; no real money or certificates move. Sandbox details
FlexySure

Motor

3 endpoints · base URL https://flexysure.intrepidprojects.co.ke/api/v1

Price, quote and bind motor cover with Insurance Cloud field names. Amounts in requests are whole shillings; responses show whole shillings next to _minor cents. The server is authoritative on price: every save re-prices with the current rates and refuses a premium more than KES 1 away with 422 premium_mismatch (the body carries the server figures). A save creates or matches the client, stores the quote, raises the policy pending payment (cash and carry) and its debit notes (1–4 instalments), and returns the client-area credentials.

MethodPathSummaryScope
POST /api/v1/motor/quote Price a vehicle quote
POST /api/v1/motor/save_quote Save a quote for a client quote
POST /api/v1/motor/save Bind a motor policy bind
POST /api/v1/motor/quote

Price a vehicle

Returns one option per insurer that rates the class, cheapest first. Nothing is stored — use save_quote to keep a quote against a client.

Scope
quote
Authentication
Bearer token
Rate limit
60 requests per minute per token (per-client override)
Idempotency
Not keyed. Check before retrying.
Agent headers
Accepts X-Agent-Code and X-Agent-Key: the call runs as that agent and sees only the agent's own records.

Headers

HeaderMeaning
AuthorizationBearer <access_token> (scope quote)
X-Agent-CodeOptional. Agent code (see GET /api/v1/sales-people). With X-Agent-Key the agent becomes the creator and only sees their own records.
X-Agent-KeyOptional. The agent's key; required with X-Agent-Code.

Body fields

FieldTypeRequiredDescription
class string Yes Case-insensitive. Tuktuk is rated on the PSV schedule when coverage names a PSV/hire use, otherwise as a commercial vehicle. One of: Motor, Tuktuk, Motorcycle
coverage string No Private (default), a commercial class (e.g. "Commercial - own goods") or a PSV class (e.g. "PSV - matatu", "Taxi"). Maps to the rating class private, commercial or psv; motorcycles always rate as motorcycle. Example: Private
scope string Yes Case-insensitive; "Third party only" is accepted. One of: Comprehensive, TPO
cover_period string No annual (default) runs a year less a day. tor (time on risk) ends days days after the start date. The premium is the annual premium either way. One of: annual, tor
days integer No Required for tor: 1–364.
year integer Yes Year of manufacture. Example: 2018
value integer No Vehicle value in whole shillings. Required for comprehensive cover. Example: 1000000
tonnage number No Carrying capacity in tonnes (commercial). Echoed on each option and stored on the vehicle.
pll integer No Passenger legal liability: number of passengers. Echoed on each option and stored on the vehicle.
insurer_id integer[] No Limit to these insurers (a single id is accepted too). Default: every insurer on the panel.
start_date string No Flexysure only. Cover start (Y-m-d); a past date starts today.

Example

Request cURL
curl -X POST 'https://flexysure.intrepidprojects.co.ke/api/v1/motor/quote' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Accept: application/json' \
  -H 'X-Agent-Code: KK01' \
  -H "X-Agent-Key: $AGENT_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "class": "Motor",
    "coverage": "Private",
    "scope": "Comprehensive",
    "cover_period": "annual",
    "year": 2018,
    "value": 1000000,
    "pll": 4,
    "insurer_id": [
        1,
        2
    ]
}'
Request body (JSON)
Request body JSON
{
    "class": "Motor",
    "coverage": "Private",
    "scope": "Comprehensive",
    "cover_period": "annual",
    "year": 2018,
    "value": 1000000,
    "pll": 4,
    "insurer_id": [
        1,
        2
    ]
}
Response JSON
{
    "message": "2 options found.",
    "quote": {
        "class": "Motor",
        "coverage": "Private",
        "scope": "Comprehensive",
        "vehicle_class": "private",
        "cover_type": "comprehensive",
        "cover_period": "annual",
        "days": 365,
        "start_date": "2026-10-14",
        "end_date": "2027-10-13",
        "year": 2018,
        "tonnage": null,
        "pll": 4,
        "value": 1000000,
        "value_minor": 100000000
    },
    "options": [
        {
            "insurer_id": 1,
            "insurer_name": "Savanna General",
            "monogram": "SG",
            "motor_product_id": 11,
            "vehicle_class": "private",
            "cover_type": "comprehensive",
            "rate": 3.5,
            "rate_bps": 350,
            "value": 1000000,
            "value_minor": 100000000,
            "basic_premium": 35000,
            "basic_premium_minor": 3500000,
            "taxes": [
                {
                    "code": "TL",
                    "name": "Training levy",
                    "amount": 70,
                    "amount_minor": 7000
                },
                {
                    "code": "PHCF",
                    "name": "Policyholders compensation fund",
                    "amount": 88,
                    "amount_minor": 8800
                },
                {
                    "code": "SD",
                    "name": "Stamp duty",
                    "amount": 40,
                    "amount_minor": 4000
                }
            ],
            "taxes_total": 198,
            "taxes_total_minor": 19800,
            "total": 35198,
            "total_minor": 3519800,
            "commission_rate_bps": 1000,
            "benefits": [
                {
                    "id": "3a9c1f0e7b2d",
                    "name": "Windscreen up to KES 50,000"
                },
                {
                    "id": "b81e2c4d5f60",
                    "name": "Towing"
                }
            ],
            "limits_of_liability": [
                {
                    "benefit_id": "3a9c1f0e7b2d",
                    "item": "Windscreen",
                    "limit": 50000
                },
                {
                    "benefit_id": "b81e2c4d5f60",
                    "item": "Towing",
                    "limit": null
                }
            ],
            "excess": "2.5% of claim, min KES 15,000",
            "pll": 4,
            "tonnage": null,
            "instalments": [
                {
                    "parts": 1,
                    "amounts": [
                        35198
                    ],
                    "amounts_minor": [
                        3519800
                    ]
                },
                {
                    "parts": 2,
                    "amounts": [
                        17599,
                        17599
                    ],
                    "amounts_minor": [
                        1759900,
                        1759900
                    ]
                }
            ],
            "ipf_offers": [
                {
                    "tenor_months": 6,
                    "deposit": 7040,
                    "deposit_minor": 704000,
                    "instalment": 5397,
                    "instalment_minor": 539700,
                    "apr_bps": 4200,
                    "lender_name": "Flexysure Premium Finance"
                }
            ],
            "ipf_reason": null
        }
    ]
}

Responses

StatusMeaning
200 Options
422 validation_failed, or no_quote when no insurer rates the class

Errors are problem documents; the common codes (401, 403 insufficient_scope, 422, 429) apply to every endpoint.

POST /api/v1/motor/save_quote

Save a quote for a client

Creates or matches the client and stores the quote with every insurer's option (valid for 14 days). Each entry in quotes[] is checked against the server price.

Scope
quote
Authentication
Bearer token
Rate limit
60 requests per minute per token (per-client override)
Idempotency
Required: send an Idempotency-Key; a retry with the same key replays the first response.
Agent headers
Accepts X-Agent-Code and X-Agent-Key: the call runs as that agent and sees only the agent's own records.

Headers

HeaderMeaning
AuthorizationBearer <access_token> (scope quote or bind)
Idempotency-KeyRequired. A unique value per save (a UUID). Retrying with the same key and body returns the first response with Idempotent-Replayed: true.
X-Agent-CodeOptional. Agent code (see GET /api/v1/sales-people). With X-Agent-Key the agent becomes the creator and only sees their own records.
X-Agent-KeyOptional. The agent's key; required with X-Agent-Code.

Body fields

FieldTypeRequiredDescription
client object Yes The insured. An existing client is reused only when the ID number or KRA PIN matches, the name agrees and the caller may see that client; any other match (phone only, a different name, someone else's client) is 409 duplicate_client listing the matches (client_no only for clients you can see). Then send client_no to link a client you can see, or force: true to add a new one. An existing client's sales person and risk manager are never changed by a save.
client.name string Yes Example: Wanjiru Kamau
client.phone string Yes Kenyan mobile, any format (0712…, +254712…). Example: 0712345678
client.email string No Example: wanjiru@example.co.ke
client.idno string No National ID or passport number (id_no also accepted). Example: 23456789
client.pin string No KRA PIN (kra_pin also accepted).
client.risk_manager_id integer No From GET /api/v1/risk-managers.
client.branch_id integer No From GET /api/v1/branches.
client.sales_person_id integer No From GET /api/v1/sales-people. agentcode (an agent code) is accepted instead.
client.client_no string No Flexysure only: link this existing client (one you can see) explicitly instead of matching.
client.force boolean No Flexysure only: add a new client even though duplicate_client matches exist.
client.type string No One of: individual, corporate
vehicle object Yes
vehicle.value integer No
vehicle.year integer Yes
vehicle.reg_no string No
vehicle.coverage string No
vehicle.scope string Yes
vehicle.make string No
vehicle.model string No
vehicle.class string No Motor (default), Tuktuk or Motorcycle.
quotes array No The options you showed the client: insurer_id, rate, basic, taxes, total (whole shillings), benefits[].

Example

Request cURL
curl -X POST 'https://flexysure.intrepidprojects.co.ke/api/v1/motor/save_quote' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Idempotency-Key: e2f28ecb-6739-4578-aa49-6d7d9e104339' \
  -H 'X-Agent-Code: KK01' \
  -H "X-Agent-Key: $AGENT_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "client": {
        "name": "Otieno Ouma",
        "email": "otieno@example.co.ke",
        "phone": "0722000111",
        "idno": "30111222",
        "agentcode": "KK01"
    },
    "vehicle": {
        "value": 1000000,
        "year": 2018,
        "reg_no": "KDB 456B",
        "coverage": "Private",
        "scope": "Comprehensive",
        "make": "Mazda",
        "model": "Demio"
    },
    "quotes": [
        {
            "insurer_id": 1,
            "rate": 3.5,
            "basic": 35000,
            "taxes": 198,
            "total": 35198,
            "benefits": []
        }
    ]
}'
Request body (JSON)
Request body JSON
{
    "client": {
        "name": "Otieno Ouma",
        "email": "otieno@example.co.ke",
        "phone": "0722000111",
        "idno": "30111222",
        "agentcode": "KK01"
    },
    "vehicle": {
        "value": 1000000,
        "year": 2018,
        "reg_no": "KDB 456B",
        "coverage": "Private",
        "scope": "Comprehensive",
        "make": "Mazda",
        "model": "Demio"
    },
    "quotes": [
        {
            "insurer_id": 1,
            "rate": 3.5,
            "basic": 35000,
            "taxes": 198,
            "total": 35198,
            "benefits": []
        }
    ]
}
Response JSON
{
    "message": "Quote saved.",
    "id": 88,
    "uuid": "5b0f…",
    "quote_no": "Q-000088",
    "client_no": "C-000124",
    "valid_until": "2026-10-28",
    "data": {
        "uuid": "5b0f…",
        "product_line": "motor",
        "status": "presented",
        "options": [
            {
                "option_id": 301,
                "insurer_id": 1,
                "insurer_name": "Savanna General",
                "rate": 3.5,
                "total": 35198,
                "total_minor": 3519800
            }
        ]
    }
}

Responses

StatusMeaning
201 Quote saved
422 validation_failed, premium_mismatch or no_quote

Errors are problem documents; the common codes (401, 403 insufficient_scope, 422, 429) apply to every endpoint.

POST /api/v1/motor/save

Bind a motor policy

Re-prices with the chosen insurer and compares policy.premium (and total_basic, taxes when sent); a difference over KES 1 is refused with premium_mismatch. Then matches or creates the client (risk manager, branch and sales person set on new clients only), stores the quote and raises the policy pending payment with 1–4 instalment debit notes. client_key is issued only when the client has no client-area key yet; otherwise it is null with portal.note, and existing keys keep working. A replay returns the key as null (replay_note). One vehicle per save — add more with POST /api/v1/policies/{uuid}/endorse (add_vehicle). Flexysure needs the chassis number (chassis_no) for the DMVIC certificate.

Scope
bind
Authentication
Bearer token
Rate limit
3 requests per 15 seconds per API client (plus the platform limit).
Idempotency
Required: send an Idempotency-Key; a retry with the same key replays the first response.
Agent headers
Accepts X-Agent-Code and X-Agent-Key: the call runs as that agent and sees only the agent's own records.

Headers

HeaderMeaning
AuthorizationBearer <access_token> (scope bind)
Idempotency-KeyRequired. A unique value per save (a UUID). Retrying with the same key and body returns the first response with Idempotent-Replayed: true.
X-Agent-CodeOptional. Agent code (see GET /api/v1/sales-people). With X-Agent-Key the agent becomes the creator and only sees their own records.
X-Agent-KeyOptional. The agent's key; required with X-Agent-Code.

Body fields

FieldTypeRequiredDescription
client object Yes The insured. An existing client is reused only when the ID number or KRA PIN matches, the name agrees and the caller may see that client; any other match (phone only, a different name, someone else's client) is 409 duplicate_client listing the matches (client_no only for clients you can see). Then send client_no to link a client you can see, or force: true to add a new one. An existing client's sales person and risk manager are never changed by a save.
client.name string Yes Example: Wanjiru Kamau
client.phone string Yes Kenyan mobile, any format (0712…, +254712…). Example: 0712345678
client.email string No Example: wanjiru@example.co.ke
client.idno string No National ID or passport number (id_no also accepted). Example: 23456789
client.pin string No KRA PIN (kra_pin also accepted).
client.risk_manager_id integer No From GET /api/v1/risk-managers.
client.branch_id integer No From GET /api/v1/branches.
client.sales_person_id integer No From GET /api/v1/sales-people. agentcode (an agent code) is accepted instead.
client.client_no string No Flexysure only: link this existing client (one you can see) explicitly instead of matching.
client.force boolean No Flexysure only: add a new client even though duplicate_client matches exist.
client.type string No One of: individual, corporate
policy object Yes
policy.start_date string Yes Y-m-d; a past date starts today.
policy.end_date string No Ignored for annual cover; for tor without days it sets the number of days.
policy.insurer_id integer Yes
policy.class string Yes One of: Motor, Tuktuk, Motorcycle
policy.coverage string No
policy.scope string Yes One of: Comprehensive, TPO
policy.cover_period string No One of: annual, tor
policy.days integer No
policy.total_basic number No Whole shillings; checked when sent.
policy.taxes number No Whole shillings; checked when sent.
policy.premium number Yes Gross premium, whole shillings. Must be within KES 1 of the server price.
policy.premium_instalments integer No 1–4 (default 1). One debit note per instalment, a month apart; the first one activates cover.
policy.payment_mode string No Flexysure only. ipf = premium finance (always one instalment). One of: full, ipf
policy.limits_of_liability array No [{benefit_id, item, limit}] kept on the policy.
taxes array No [{tax_id, rate, amount}] — accepted for compatibility; the server computes levies.
vehicles array Yes Exactly one: {regno|reg_no, chassis_no, make, model, yom, value, coverage, engine_no?, body_type?, tonnage?, pll?, basic_premium?, rate?, benefits[]?}.

Example

Request cURL
curl -X POST 'https://flexysure.intrepidprojects.co.ke/api/v1/motor/save' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Idempotency-Key: b9edfb62-3030-416a-a99e-b1a4b4c824ce' \
  -H 'X-Agent-Code: KK01' \
  -H "X-Agent-Key: $AGENT_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "client": {
        "name": "Wanjiru Kamau",
        "email": "wanjiru@example.co.ke",
        "phone": "0712345678",
        "idno": "23456789",
        "risk_manager_id": 2,
        "branch_id": 1,
        "sales_person_id": 4
    },
    "policy": {
        "start_date": "2026-10-14",
        "end_date": "2027-10-13",
        "insurer_id": 1,
        "class": "Motor",
        "coverage": "Private",
        "scope": "Comprehensive",
        "total_basic": 35000,
        "taxes": 198,
        "premium": 35198,
        "premium_instalments": 2,
        "limits_of_liability": [
            {
                "benefit_id": "3a9c1f0e7b2d",
                "item": "Windscreen",
                "limit": 50000
            }
        ]
    },
    "taxes": [
        {
            "tax_id": 1,
            "rate": 0.2,
            "amount": 70
        }
    ],
    "vehicles": [
        {
            "coverage": "Private",
            "regno": "KDA 123A",
            "chassis_no": "NZE161-3012456",
            "make": "Toyota",
            "model": "Axio",
            "yom": 2018,
            "value": 1000000,
            "basic_premium": 35000,
            "rate": 3.5,
            "benefits": []
        }
    ]
}'
Request body (JSON)
Request body JSON
{
    "client": {
        "name": "Wanjiru Kamau",
        "email": "wanjiru@example.co.ke",
        "phone": "0712345678",
        "idno": "23456789",
        "risk_manager_id": 2,
        "branch_id": 1,
        "sales_person_id": 4
    },
    "policy": {
        "start_date": "2026-10-14",
        "end_date": "2027-10-13",
        "insurer_id": 1,
        "class": "Motor",
        "coverage": "Private",
        "scope": "Comprehensive",
        "total_basic": 35000,
        "taxes": 198,
        "premium": 35198,
        "premium_instalments": 2,
        "limits_of_liability": [
            {
                "benefit_id": "3a9c1f0e7b2d",
                "item": "Windscreen",
                "limit": 50000
            }
        ]
    },
    "taxes": [
        {
            "tax_id": 1,
            "rate": 0.2,
            "amount": 70
        }
    ],
    "vehicles": [
        {
            "coverage": "Private",
            "regno": "KDA 123A",
            "chassis_no": "NZE161-3012456",
            "make": "Toyota",
            "model": "Axio",
            "yom": 2018,
            "value": 1000000,
            "basic_premium": 35000,
            "rate": 3.5,
            "benefits": []
        }
    ]
}
Response JSON
{
    "message": "Policy saved successfully.",
    "id": 452,
    "uuid": "0d7b1f1e-7a2c-4f3b-9a8e-2c1d5f6a7b8c",
    "risknote": "RN-000452",
    "policy_no": "POL-000452",
    "client_no": "C-000123",
    "client_key": "fxck_…",
    "status": "pending_payment",
    "product_line": "motor",
    "start_date": "2026-10-14",
    "end_date": "2027-10-13",
    "payment_mode": "full",
    "instalments": 2,
    "premium": {
        "basic_premium": 35000,
        "basic_premium_minor": 3500000,
        "taxes": 198,
        "taxes_minor": 19800,
        "total": 35198,
        "total_minor": 3519800
    },
    "debit_note": {
        "number": "DN-000452-1/2",
        "due_on": "2026-10-14",
        "amount": 17599,
        "amount_minor": 1759900,
        "instalments": [
            {
                "number": "DN-000452-1/2",
                "instalment_no": 1,
                "due_on": "2026-10-14",
                "amount": 17599,
                "amount_minor": 1759900
            },
            {
                "number": "DN-000452-2/2",
                "instalment_no": 2,
                "due_on": "2026-11-14",
                "amount": 17599,
                "amount_minor": 1759900
            }
        ]
    },
    "portal": {
        "client_no": "C-000123",
        "client_key": "fxck_…"
    },
    "links": {
        "policy": "https://app.flexysure.com/api/v1/policies/0d7b1f1e-7a2c-4f3b-9a8e-2c1d5f6a7b8c"
    }
}

Responses

StatusMeaning
201 Policy saved (Insurance Cloud shape plus uuid, policy_no, debit_note, portal)
403 actor_forbidden when the acting user may not create policies
409 price_changed when rates changed mid-save; duplicate_client when the client is not matched automatically
422 validation_failed, premium_mismatch, no_quote or domain_rule
429 More than 3 saves in 15 seconds for this API client

Errors are problem documents; the common codes (401, 403 insufficient_scope, 422, 429) apply to every endpoint.