Insurance Endpoint
Purchase insurance policies.
Endpoint
URL: /api/insureapi
Methods: POST, GET
Description
This API endpoint allows users to purchase third party insurance.
Authentication
To access this endpoint, users must include their API key and secret key in the request headers.
Request Headers
- api-key (string, required): The API key of the user.
- secret-key (string, required): The secret key of the user.
Request Body (POST)
- firstLevel (string, required): The insurance product to purchase.
- secondLevel (string, required): The insurance package to purchase.
- phone (string, required): The phone number of the recipient.
- number (string, required): The plate number of the vehicle.
- Insured_Name (string, required): The name of the recipient.
- Engine_Number (string, required): The engine number of the vehicle.
- Chasis_Number (string, required): The chassis number of the vehicle.
- Vehicle_Make (string, required): The make of the vehicle.
- Vehicle_Color (string, required): The color of the vehicle.
- Vehicle_Model (string, required): The model of the vehicle.
- Year_of_Make (string, required): The year of manufacture of the vehicle.
- Contact_Address (string, required): The contact address of the insured.
Usage Example
POST request to purchase insurance:
Content-Type: application/json
api-key: your-api-key
secret-key: your-secret-key
{
"firstLevel": "3rd party insurance", // value of this key can either be firstLevel or fId, e.g. "3rd-party-insurance" fId is more accurate
"secondLevel": "Private", // value of this key can either be secondLevel or sId, e.g. "private" sId is more accurate
"phone": "08032566178",
"number": "ABC123",
"Insured_Name": "John Doe",
"Engine_Number": "1234567890",
"Chasis_Number": "ABCDEFGHIJKL12345",
"Vehicle_Make": "Toyota",
"Vehicle_Color": "Blue",
"Vehicle_Model": "Camry",
"Year_of_Make": "2020",
"Contact_Address": "123 Main St, City",
}
Response:
{
"message": "Transaction successful",
"data": {
"transactionId": "1234567890",
"email": "user@example.com",
"activity": "3rd party insurance",
"message": "Order Submitted Successfully",
"recipient": "08032566178",
"amount": 15000,
"initialBalance": 20000,
"finalBalance": 5000,
"number": "ABC123",
"Insured_Name": "John Doe",
"Engine_Number": "1234567890",
"Chasis_Number": "ABCDEFGHIJKL12345",
"Vehicle_Make": "Toyota",
"Vehicle_Color": "Blue",
"Vehicle_Model": "Camry",
"Year_of_Make": "2020",
"Contact_Address": "123 Main St, City",
"Method": API,
}
}Failed Response Format
{
"message": "Transaction failed",
"data": {
"transactionId": "1234567890",
"email": "user@example.com",
"activity": "3rd party insurance",
"message": "Order Failed",
"recipient": "08032566178",
"amount": 15000,
"initialBalance": 20000,
"finalBalance": 20000,
"number": "ABC123",
"Insured_Name": "John Doe",
"Engine_Number": "1234567890",
"Chasis_Number": "ABCDEFGHIJKL12345",
"Vehicle_Make": "Toyota",
"Vehicle_Color": "Blue",
"Vehicle_Model": "Camry",
"Year_of_Make": "2020",
"Contact_Address": "123 Main St, City",
"Method": API,
}
}GET Request
Get the list of available firstLevel and secondLevel:
Content-Type: application/json api-key: your-api-key secret-key: your-secret-key
Response:
{
"3rd party insurance": {
"available": true,
"secondLevel": [
"Private",
"Commercial",
"Tricycles",
"Motorcycle"
],
"amount": [
15000,
20000,
5000,
3000
]
}
}