Insurance
Reference
Endpoint Reference

Endpoint Reference

This page summarizes each insurance endpoint. The full field descriptions, rules and examples are behind each endpoint's Details link.

  • The base address is https://api-gateway.lunixi.com.
  • Every endpoint requires a request signed with your API key: Flows › Authentication. /pay also requires a Bearer access token.
  • The common error codes (VALIDATION_ERROR, insurance.validation.invalid, insurance.idempotency.conflict, insurance.dependency.unavailable, insurance.internal.integrity) and the authentication errors apply to every endpoint: Flows › Responses and errors. The tables below give the endpoint-specific codes.
  • The body of a successful response is under data; the document endpoints return a PDF and the export endpoint returns CSV. On list endpoints, pagination information is in pageInfo: Pagination.

Summary

The Without a Lunixi payment column shows whether the endpoint can be used without taking a payment in Lunixi: Insurance-Only Integration.

MethodPathIdempotency-KeyWithout a Lunixi payment
POST/api/v1/insurance/products—Yes
GET/api/v1/insurance/products—Yes, without paymentIntentId
GET/api/v1/insurance/reference/{kind}—Yes
POST/api/v1/insurance/quotesOptionalYes, without paymentIntentId
GET/api/v1/insurance/quotes/{quoteId}—Yes
GET/api/v1/insurance/quotes/{quoteId}/facilities—Yes
POST/api/v1/insurance/ordersRequiredYes
GET/api/v1/insurance/orders—Yes
GET/api/v1/insurance/orders/{orderId}—Yes
POST/api/v1/insurance/orders/{orderId}/bind-paymentOptionalNo
POST/api/v1/insurance/orders/{orderId}/confirm-paymentRequiredYes
POST/api/v1/insurance/orders/{orderId}/issue-policyRequiredYes
POST/api/v1/insurance/orders/{orderId}/payRequiredYes
POST/api/v1/insurance/orders/{orderId}/cancelRequiredYes
POST/api/v1/insurance/orders/{orderId}/refund-premiumRequiredYes, with externalRefund
GET/api/v1/insurance/policies/{policyId}/document—Yes
GET/api/v1/insurance/policies/{policyId}/receipt—Yes
GET/api/v1/insurance/policies/{policyId}/certificate—Yes
POST/api/v1/insurance/policies/{policyId}/claimsRequiredYes
GET/api/v1/insurance/claims—Yes
GET/api/v1/insurance/claims/{claimId}—Yes
GET/api/v1/insurance/claims/{claimId}/document—Yes
POST/api/v1/insurance/leadsRequiredYes
GET/api/v1/insurance/leads—Yes
GET/api/v1/insurance/leads/{leadId}—Yes
GET/api/v1/insurance/reconciliation/summary—Yes
GET/api/v1/insurance/reconciliation/orders—Yes
GET/api/v1/insurance/reconciliation/export—Yes

Eligibility and reference

POST /api/v1/insurance/products

What it doesReturns the insurance types offered for the basket items you will send. Read-only.
Requestcurrency, context.items (1-100 items; insuranceData is not stored), optional insuranceType.
Response200; data.products[]: insuranceType, typeObject, schemaVersion, basketItemIds, title, description, fields, prefill, providedFields, quoteReady, insuranceDataIssues. An empty list means no insurance is offered.
Errors400 VALIDATION_ERROR, 422 insurance.validation.invalid
Webhook—
DetailsEligibility › Before the payment

GET /api/v1/insurance/products

What it doesWith paymentIntentId: the types offered for the items of a Lunixi payment. Without paymentIntentId: the types sold without a basket item.
RequestQuery: currency, optional paymentIntentId and insuranceType.
Response200; the same data.products[] as POST.
Errors400 VALIDATION_ERROR, 422 insurance.validation.invalid (reason: currency_mismatch)
Webhook—
DetailsEligibility › After the payment, Without a basket item

GET /api/v1/insurance/reference/{kind}

What it doesLists the Lunixi reference codes used in type fields (country, city, district, brand, model, occupation, address chain and so on). Provider codes are never returned.
RequestPath: kind. Query: parentCode, limit (1-100, default 25), cursor; vehicleTypeCode and modelYear in vehicle lists; outerDoorNumber in the building list.
Response200; data.items[]: code, label, parentCode; pageInfo.
Errors400 VALIDATION_ERROR; 422 insurance.validation.invalid (field: kind, reason: unknown_reference_kind or live_reference_unavailable; field: parentCode, reason: required, not_applicable, invalid_reference_code or invalid_enum); 422 insurance.reference.unknown
Webhook—
DetailsInsurance Types and Schemas › Reference codes

Quotes

POST /api/v1/insurance/quotes

What it doesPrices the insurance type for the insured and the insured items; returns one or more options.
RequestinsuranceType, currency, the basket source (context.items or paymentIntentId; neither for types sold without a basket item), optional schemaVersion and merchantOrderId, and by type policyholder, insured[] and the type object. The items' context and pre-fill data complete the body; with paymentIntentId the body may be empty (Quote with pre-fill data).
Response201; data: insuranceType, schemaVersion, options[], excludedOptions[].
Errors412 insurance.type.not_available, 412 insurance.provider.not_integrated, 422 insurance.reference.unknown, 422 insurance.quote.declined, 503 insurance.provider.unavailable
Webhook—
DetailsQuotes › Getting a quote, Option

GET /api/v1/insurance/quotes/{quoteId}

What it doesReturns a single option; an expired option is returned with status: EXPIRED.
RequestPath: quoteId (insq_…).
Response200; data: the option object.
Errors404 insurance.quote.not_found
Webhook—
DetailsQuotes › Retrieving a quote

GET /api/v1/insurance/quotes/{quoteId}/facilities

What it doesReturns the option's contracted health facilities in the given city.
RequestPath: quoteId. Query: cityCode (01-81).
Response200; data.items[]: name, cityCode. No pagination.
Errors404 insurance.quote.not_found, 412 insurance.facility.not_supported, 422 insurance.validation.invalid (field: cityCode)
Webhook—
DetailsQuotes › Contracted facilities

Orders and collection

POST /api/v1/insurance/orders

What it doesCreates an order with the option the buyer confirmed. Sends no request to the provider and moves no money.
RequestquoteId, consent.termsVersion, consent.termsSha256, consent.acceptedAt, optional merchantOrderId.
Response201; data: the order object (paymentMode: NO_PAYMENT).
Errors404 insurance.quote.not_found, 409 insurance.quote.expired, 409 insurance.order.state_conflict (reason: quote_already_ordered), 422 insurance.validation.invalid (reason: terms_mismatch)
Webhook—
DetailsOrders › Creating an order, Order object

GET /api/v1/insurance/orders

What it doesLists your orders, newest first; Checkout Form orders are included.
RequestQuery: limit (1-100, default 25), cursor, paymentIntentId, merchantOrderId.
Response200; data.items[]: the order object; pageInfo.
Errors422 insurance.validation.invalid (field: cursor)
Webhook—
DetailsOrders › Listing

GET /api/v1/insurance/orders/{orderId}

What it doesReturns a single order; you track the policy and document status with this endpoint.
RequestPath: orderId (inso_…).
Response200; data: the order object.
Errors404 insurance.order.not_found
Webhook—
DetailsOrders › Retrieving

POST /api/v1/insurance/orders/{orderId}/bind-payment

What it doesBinds the order to a Lunixi payment created with insured items. Used only in the flow linked to a Lunixi payment.
RequestpaymentIntentId.
Response200; data: the order object (paymentMode: LUNIXI_PAYMENT).
Errors404 insurance.order.not_found, 409 insurance.quote.expired, 409 insurance.quote.stale, 409 insurance.order.state_conflict, 409 insurance.order.premium_item_mismatch, 412 insurance.order.payment_not_recorded
WebhookPolicy events after the payment is captured: insurance.policy.issued, insurance.policy.failed, insurance.refund.required, insurance.policy.document_ready.
DetailsOrders › Binding to a payment, Premium and Payment › With a Lunixi payment

POST /api/v1/insurance/orders/{orderId}/confirm-payment

What it doesReports a premium you collected outside Lunixi; Lunixi forwards the notification to your provider through your connection.
Requestpayment.externalPaymentId, payment.paidAmount, payment.paidCurrency, payment.paidAt, optional payment.paymentProvider.
Response200; data: the order object (paymentMode: EXTERNAL_PAYMENT, collectionStatus: COLLECTED).
Errors404 insurance.order.not_found, 409 insurance.quote.expired, 409 insurance.order.state_conflict (reason: lunixi_payment, external_payment, collected_by_provider), 422 insurance.validation.invalid (reason: premium_amount_mismatch or premium_currency_mismatch)
Webhook—
DetailsOrders › Reporting a premium collected outside Lunixi

POST /api/v1/insurance/orders/{orderId}/issue-policy

What it doesRequests the policy after a premium collected outside Lunixi. No body is sent.
RequestPath: orderId.
Response200; data: the order object (policyStatus: PENDING). The policy is issued in the background.
Errors404 insurance.order.not_found, 409 insurance.order.state_conflict (reason: refund_started or collected_by_provider), 412 insurance.premium.not_captured
Webhookinsurance.policy.issued, insurance.policy.failed, insurance.refund.required, insurance.policy.document_ready
DetailsOrders › Requesting the policy

POST /api/v1/insurance/orders/{orderId}/pay

What it doesStarts the premium charge on an order whose premium the provider collects (premiumCollectedBy: PROVIDER). Once the premium is charged, the policy is requested automatically.
AuthenticationA Bearer access token and the signature headers together.
Requestcard for a CARD product (PCI-DSS certified merchants only), optional returnUrl.
Response200; data.order (the order object) and data.providerPayment (insurancePaymentId, status, paymentInput, amount, currency, failureCode, nextAction).
Errors403 insurance.card.pci_required, 404 insurance.order.not_found, 409 insurance.order.state_conflict, 409 insurance.quote.expired, 412 insurance.payment.merchant_payment_not_captured, 422 insurance.payment.method_not_supported, 422 insurance.card.invalid, 422 insurance.reference.unknown, 422 insurance.quote.declined, 503 insurance.provider.unavailable
WebhookPolicy events once the premium is charged; insurance.policy.failed (errorCode: insurance.payment.declined) if the charge is declined.
DetailsProvider Collection

Cancellation and refund

POST /api/v1/insurance/orders/{orderId}/cancel

What it doesOpens a cancellation request at the provider for every issued policy. The result is finalized later. Cancelling does not refund the premium. No body is sent.
RequestPath: orderId.
Response200; data: the order object (policyStatus: CANCEL_PENDING).
Errors404 insurance.order.not_found, 409 insurance.order.state_conflict (reason: policy_not_issued), 412 insurance.provider.not_integrated
Webhookinsurance.policy.cancelled. If the provider rejects the cancellation, no event is sent; errorCode becomes insurance.policy.cancel_failed.
DetailsCancellation and Premium Refund › Policy cancellation

POST /api/v1/insurance/orders/{orderId}/refund-premium

What it doesRefunds the premium in a Lunixi payment, or records a refund you made outside Lunixi. Not used when the provider collected the premium.
RequestNo body for a Lunixi payment. For a premium collected outside Lunixi, externalRefund.externalRefundId and externalRefund.refundedAt.
Response200; data: the order object (refundStatus: PENDING or REFUNDED).
Errors404 insurance.order.not_found, 409 insurance.order.state_conflict (reason: policy_active, policy_in_progress, already_refunded, collected_by_provider), 412 insurance.premium.not_captured, 422 insurance.validation.invalid
Webhookinsurance.refund.completed
DetailsCancellation and Premium Refund › Premium refund

Policy documents

Documents are not stored by Lunixi; they are fetched from the provider on every request. A successful response is the PDF file itself (Content-Type: application/pdf, Cache-Control: no-store); an error response is the JSON error envelope. A document is available while the policy is ISSUED or CANCEL_PENDING.

GET /api/v1/insurance/policies/{policyId}/document

What it doesReturns the policy document as a PDF.
RequestPath: policyId (insp_…).
Response200; PDF, file name <policyId>.pdf.
Errors404 insurance.policy.not_found, 409 insurance.order.state_conflict (reason: policy_not_issued or policy_cancelled), 503 insurance.document.unavailable
Webhookinsurance.policy.document_ready when the document is ready.
DetailsPolicy Document

GET /api/v1/insurance/policies/{policyId}/receipt

What it doesReturns the policy's premium receipt as a PDF if the product provides a receipt.
RequestPath: policyId.
Response200; PDF, file name <policyId>-receipt.pdf.
ErrorsThose of the policy document, plus 412 insurance.document.not_supported
Webhook—
DetailsPolicy Document › Receipt

GET /api/v1/insurance/policies/{policyId}/certificate

What it doesReturns the policy's certificate as a PDF if the product provides a certificate.
RequestPath: policyId.
Response200; PDF, file name <policyId>-certificate.pdf.
ErrorsThose of the policy document, plus 412 insurance.document.not_supported
Webhook—
DetailsPolicy Document › Certificate

Claims

POST /api/v1/insurance/policies/{policyId}/claims

What it doesReports a claim for an in-force policy to the provider. The documents are sent to the provider in this request and are not stored by Lunixi.
RequestPath: policyId. Body: incidentAt, documents[].
Response201; data: the claim (status: SUBMITTED or UNKNOWN).
Errors404 insurance.policy.not_found, 409 insurance.claim.state_conflict, 412 insurance.claim.not_supported, 422 insurance.claim.rejected, 503 insurance.provider.unavailable
Webhookinsurance.claim.submitted, insurance.claim.failed
DetailsClaims › Filing a claim

GET /api/v1/insurance/claims

What it doesLists your claims, newest first.
RequestQuery: limit (1-100, default 25), cursor, orderId, policyId, status.
Response200; data.items[]: the claim; pageInfo.
Errors422 insurance.validation.invalid (field: cursor)
Webhook—
DetailsClaims › Listing

GET /api/v1/insurance/claims/{claimId}

What it doesReturns a single claim.
RequestPath: claimId (insclm_…).
Response200; data: the claim.
Errors404 insurance.claim.not_found
Webhook—
DetailsClaims › Retrieving

GET /api/v1/insurance/claims/{claimId}/document

What it doesReturns the document the provider issued for the claim as a PDF; the claim must be SUBMITTED.
RequestPath: claimId.
Response200; PDF, file name <claimId>.pdf.
Errors404 insurance.claim.not_found, 409 insurance.claim.state_conflict (reason: claim_not_submitted), 503 insurance.document.unavailable
Webhook—
DetailsClaims › The provider's claim document

Leads

POST /api/v1/insurance/leads

What it doesFor insurance types that return no quote, passes the buyer's details to the provider as a lead. There is no quote, premium, policy or document.
RequestinsuranceType, optional schemaVersion, by type policyholder, the type object and company, optional note.
Response201; data: the lead (status: SUBMITTED or UNKNOWN).
Errors412 insurance.type.not_available, 422 insurance.lead.rejected, 503 insurance.provider.unavailable
Webhookinsurance.lead.submitted
DetailsLeads › Submitting a lead

GET /api/v1/insurance/leads

What it doesLists your leads, newest first; personal data is masked.
RequestQuery: limit (1-100, default 25), cursor, insuranceType, status.
Response200; data.items[]: the lead; pageInfo.
Errors422 insurance.validation.invalid (field: cursor)
Webhook—
DetailsLeads › Listing

GET /api/v1/insurance/leads/{leadId}

What it doesReturns a single lead; personal data is masked.
RequestPath: leadId.
Response200; data: the lead.
Errors404 insurance.lead.not_found
Webhook—
DetailsLeads › Retrieval

Reconciliation

GET /api/v1/insurance/reconciliation/summary

What it doesReturns the policy and premium totals of the period per connection, currency and premium collector.
RequestQuery: from, to, optional connectionId, insuranceType, currency.
Response200; data: period, filters, groups[], generatedAt.
Errors422 insurance.validation.invalid (field: filter.from or filter.to)
Webhook—
DetailsReconciliation Report › Summary

GET /api/v1/insurance/reconciliation/orders

What it doesLists the orders behind the summary together with their policies.
RequestThe filter parameters, limit (1-100, default 100), cursor.
Response200; data.items[]: the report row; pageInfo.
Errors422 insurance.validation.invalid (field: filter.* or cursor)
Webhook—
DetailsReconciliation Report › Rows

GET /api/v1/insurance/reconciliation/export

What it doesReturns the report rows as CSV; each policy is one line.
RequestThe filter parameters, cursor to continue a truncated file.
Response200; text/csv, at most 20,000 orders per file.
Errors422 insurance.validation.invalid (field: filter.*)
Webhook—
DetailsReconciliation Report › CSV

Related