Collect the quote form

Each insurer designs its own form for the answers it needs to price a product. You fetch the form, render it in your app, and send the answers as formData.

1. Fetch the formlink

curl "https://insure-api.netapps.ng/api/v1/products/66f1c2a9e4b0d3a1c8e7f512/prod_motor_comprehensive_v3/form?context=quote" \
  -H "x-api-key: $INSURETECH_API_KEY"

Keep formId and formVersion. Quoting requires both, and a form version you never fetched is refused when you quote.

contextUse it for
quoteThe answers needed to price the product.
purchaseExtra details the insurer asks for when you buy.
claimThe answers needed to file a claim.
endorsementThe answers needed to change a policy mid-term.

2. Render itlink

document holds steps, each with sections of fields. Every field has an id, a type, a label and its rules, such as required, min, max and maxLength. Render one input per field, in order, and apply the rules in your app so your customer sees mistakes before you quote.

3. Load remote choiceslink

Some fields load their choices from the insurer, such as the models for a vehicle make. Their field declares an options URL. Load the choices once your customer has answered the fields it depends on:

curl -X POST https://insure-api.netapps.ng/api/v1/forms/66f1c2a9e4b0d3a1c8e7f512/form_motor_quote/1/options \
  -H "x-api-key: $INSURETECH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "fieldId": "vehicle.model", "values": { "vehicle.make": "TOYOTA" }, "query": "Cor" }'

Show each option's label and submit its value. Skip options marked disabled.

4. Build formDatalink

Answers are nested by field id: the field vehicle.make becomes vehicle, then make. A money field takes amountMinor and currency.

{
  "vehicle": {
    "make": "TOYOTA",
    "age": 4,
    "sumInsured": { "amountMinor": 600000000, "currency": "NGN" }
  }
}

Fileslink

Forms never take files directly. To send a file, such as a photo for a claim, reserve a slot with POST /uploads, upload the bytes, and attach the fileId. Handle claims shows how.

Nextlink

Price a quote with the answers you collected.