rpa-api

Insurance Broker API — API Reference

API Reference

Complete documentation for the rpa-api Insurance Broker Automation API.

Getting Started

This API automates UAE motor insurance quoting across multiple carrier portals. Submit a customer intake with vehicle details and documents, then poll for quote results. When the broker approves a quote, trigger a payment link send to the customer.

Authentication

All endpoints except /health require an API key. Pass it in the x-api-key header.

x-api-key: YOUR_API_KEY

Rate Limits

ScopeLimitApplies to
Quote submission10 / minPOST /api/quotes
Sell / payment link5 / minPOST /api/quotes/:jobId/sell
Global100 / minAll endpoints combined

Endpoints

GET/health

Returns the health status of the API, including connectivity to Postgres and Temporal. Use this to verify the system is operational before sending requests.

Response Example

200 OK
{
  "status": "ok",
  "postgres": "up",
  "temporal": "up",
  "timestamp": "2026-05-26T12:00:00.000Z"
}

Status Codes

200All systems operational
503One or more dependencies are down

Example

curl
curl https://api.rpai.vionark.com/health
POST/api/quotesAuth required

Submit a motor insurance quote request. Accepts multipart/form-data with a JSON intake object and document files (mulkiya, EID, licence). Returns a jobId you can poll for results.

Request Body

FieldTypeRequiredDescription
customer.fullNamestringyesFull name as on Emirates ID
customer.emiratesIdstringyesEmirates ID (format: 784-YYYY-NNNNNNN-C)
customer.emiratesIdExpirystringyesEID expiry date (YYYY-MM-DD)
customer.nationalitystringyesISO 3166-1 alpha-2 country code (e.g. "IN", "AE")
customer.genderstringyes"Male" or "Female"
customer.mobileNumberstringyesUAE mobile (e.g. +971501234567)
customer.emailstringyesCustomer email for payment link
motor.vehicle.chassisNumberstringyes17-character VIN / chassis number
motor.vehicle.plateCodestringyesPlate code (e.g. "1", "2")
motor.vehicle.plateNumberstringyesPlate number
motor.vehicle.registrationEmiratestringyesEmirate of registration
motor.vehicle.numOfPassengersnumbernoPassenger count from Mulkiya (falls back to VIN decoder)
motor.vehicle.numOfDoorsnumbernoDoor count (falls back to VIN decoder)
motor.licence.numberstringyesDriving licence number
motor.previousPolicyExpirystringyesPrevious policy expiry (YYYY-MM-DD)
coverage.schemesstring[]yesScheme codes: "65S" (Comprehensive) and/or "66S" (TPL)
targetInsurersstring[]yesInsurer IDs to quote (e.g. ["dni"])

Response Example

200 OK
{
  "jobId": "job_abc123def456",
  "status": "queued",
  "deduped": false
}

Status Codes

200Quote request accepted and queued
400Validation failed — missing or invalid fields
401Missing or invalid API key
429Rate limit exceeded (max 10/min)

Example

curl
curl -X POST https://api.rpai.vionark.com/api/quotes \
  -H "x-api-key: YOUR_API_KEY" \
  -F 'intake={"customer":{"fullName":"John Doe","emiratesId":"784-1990-1234567-1","nationality":"IN","gender":"Male","mobileNumber":"+971501234567","email":"john@example.com","emiratesIdExpiry":"2027-12-31"},"motor":{"vehicle":{"chassisNumber":"SJNFAAE11U1234567","plateCode":"1","plateNumber":"12345","registrationEmirate":"Abu Dhabi","color":"WHITE","engineNumber":"ABC12345","firstRegistrationDate":"2020-01-15"},"licence":{"number":"1234567","issueEmirate":"Abu Dhabi","tcNumber":"12345678","expiryDate":"2027-06-30"},"previousPolicyExpiry":"2026-06-01","transactionType":"New"},"coverage":{"schemes":["65S"]},"targetInsurers":["dni"]}' \
  -F 'mulkiya=@/path/to/mulkiya.pdf'
GET/api/quotes/:jobIdAuth required

Poll the status and results of a quote job. Returns the job status plus an array of quote run results (one per insurer/scheme combination). Poll every 2 seconds until status is "completed" or "failed".

Response Example

200 OK
{
  "jobId": "job_abc123def456",
  "status": "completed",
  "results": [
    {
      "id": "run_xyz789",
      "insurer": "dni",
      "schemeCode": "65S",
      "status": "success",
      "premium": 1785,
      "vat": 89.25,
      "total": 1874.25,
      "quotationRef": "MT-2026-4262234"
    },
    {
      "id": "run_xyz790",
      "insurer": "dni",
      "schemeCode": "66S",
      "status": "success",
      "premium": 728,
      "vat": 36.4,
      "total": 764.4,
      "quotationRef": "MT-2026-4262877"
    }
  ]
}

Status Codes

200Job found — check status field
404Job not found
401Missing or invalid API key

Example

curl
curl https://api.rpai.vionark.com/api/quotes/job_abc123def456 \
  -H "x-api-key: YOUR_API_KEY"
POST/api/quotes/:jobId/sellAuth required

Trigger sending the payment link to the customer for an accepted quote. Requires explicit broker consent (checkbox + timestamp). The insurer sends the payment email directly to the customer.

Request Body

FieldTypeRequiredDescription
quoteRunIdstringyesID of the specific quote run to sell
customerEmailstringyesCustomer email to send payment link
brokerConsentGivenbooleanyesMust be true — broker confirms they reviewed the quote
brokerConsentAtstringyesISO timestamp of when broker gave consent

Response Example

200 OK
{
  "saleAttemptId": "sale_abc123",
  "status": "pending",
  "quotationRef": "MT-2026-4262234"
}

Status Codes

200Sale attempt started
400Missing consent or invalid fields
401Missing or invalid API key
404Job or quote run not found
429Rate limit exceeded (max 5/min)

Example

curl
curl -X POST https://api.rpai.vionark.com/api/quotes/job_abc123def456/sell \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"quoteRunId":"run_xyz789","customerEmail":"john@example.com","brokerConsentGiven":true,"brokerConsentAt":"2026-05-26T12:00:00Z"}'
GET/api/quotes/:jobId/saleAuth required

Poll the status of a sale attempt (payment link send). Returns the latest sale attempt for the job. Status progresses: pending -> payment-link-sent -> failed.

Response Example

200 OK
{
  "saleAttempt": {
    "id": "sale_abc123",
    "status": "payment-link-sent",
    "quotationRef": "MT-2026-4262234",
    "sentAt": "2026-05-26T12:00:15.000Z"
  }
}

Status Codes

200Sale attempt found (or null if none started)
401Missing or invalid API key
404Job not found

Example

curl
curl https://api.rpai.vionark.com/api/quotes/job_abc123def456/sale \
  -H "x-api-key: YOUR_API_KEY"

Quote Result Statuses

GET /api/quotes/:jobId returns { job, results[] } — one results entry per insurer/scheme. The poll itself returns HTTP 200; the quote outcome lives in each entry’s status. Keep polling until every entry is a settled state (not queued/running).

statusWhat it means
successQuote priced. The quote object carries premium, vatAmount, totalAmount and insurerQuoteRef. Sellable via the /sell endpoint.
duplicateThis chassis was already quoted at the carrier. quote.existingQuotations lists the existing references — no new quote is created.
referralThe carrier’s underwriter must price this manually. A reference may be issued but there is no automatic price — not auto-sellable.
rejectedThe carrier declined for a business reason. See error.code / error.message. Re-submitting the same data will not change the outcome.
failedThe quote could not be completed. See error.code — many causes are transient and safe to retry.
queued / runningStill in progress. Keep polling until every result is one of the settled states above.

Quote Error Codes

When a result is rejected or failed, it carries an error object with code, message and stepFailed. The code is a stable string you can branch on; message is human-readable and safe to show an end user.

error.codeRetry?Meaning
INSURER_INTERNAL_ERRORYes — soonThe carrier’s own system errored (e.g. its vehicle-data feed was down). Not the customer’s data. Retry in a few minutes.
INSURER_UNAVAILABLEYes — soonThe carrier’s site was too slow or unreachable. Usually temporary — retry shortly.
NON_GCCNoVehicle is not GCC-spec; the carrier will not write comprehensive cover for it.
INSERT_QUOTATION_REJECTEDNoThe carrier declined at quote creation. The reason is in the message.
QUOTE_CONDITION_FAILEDNoA carrier eligibility condition failed. The failing condition is in the message.
QUOTE_BLOCKEDNoThe carrier blocked this quote.
DNI_DUPLICATE_NO_REFNoChassis already quoted, but the carrier returned no reference. Check the carrier portal.
VALIDATION_FAILEDAfter fixRequired data was missing or invalid (e.g. passenger or door count). Correct the intake and resubmit.
FILE_CORRUPTAfter fixAn uploaded document could not be read. Re-upload a clean file.
PORTAL_LOGIN_FAILEDYesCould not sign in to the carrier portal.
CAPTCHA_UNSOLVABLEYesCould not solve the carrier’s login captcha.
PORTAL_RATE_LIMITEDBack offThe carrier throttled access. Wait, then retry.
PORTAL_MAINTENANCELaterThe carrier portal is in scheduled maintenance.
FAST_PATH_FAILEDMaybeAn unexpected error during quoting. Details are in the message.
INTERNALYesUnexpected error on our side. Retry; contact support if it persists.

HTTP / Transport Errors

These are returned as the HTTP status of the request itself (request rejected before any quote runs) — distinct from the per-quote outcomes above.

CodeHTTPDescription
VALIDATION_FAILED400Request body failed schema validation. Check the errors array in the response.
UNAUTHORIZED401Missing or invalid x-api-key header.
RATE_LIMITED429Too many requests. Wait and retry after the window resets.
TEMPORAL_UNAVAILABLE503Workflow engine is down. Quotes cannot be processed.
INTERNAL500Unexpected server error. Check logs or contact support.