CoverHound Quotes JSON API (version 1) reference

Introduction

This document describes how to utilize the CoverHound Quotes API (version 1).

Quotes API

The Quotes API provides a channel for you to post customer lead data to CoverHound and receive back quotes from our collaborating carriers.

Use of the Quotes API requires an API key and an API secret. Note that any API credentials shown in this document are examples and will not work in a real situation.

The Quotes API is JSON based, it accepts JSON input, and returns a JSON response. You can use a tool such as curl to easily try out the API.

Authentication

The Quotes API requires the use of your API key and secret to authenticate yourself and get an access token. This token will then be used to make quote requests. The token will be valid until you decide otherwise and invalidate it.

Getting an access token

  POST /api/oauth/access_token
  Accept: application/json
  Content-type: application/json
  {
    "apiKey": "eb6ad34d-6989-4f94-874d-e2f848dede63",
    "apiSecret": "1337648ad51d99be78e446f8d721e8aa",
    "grantType": "credentials"
  }

Returns your access token as a string like

"f3657af5975b2fd1b148307570a4c2fe"

Invalidating an access token

  POST /api/oauth/invalidate
  Accept: application/json
  Content-type: application/json
  {
    "apiKey": "eb6ad34d-6989-4f94-874d-e2f848dede63",
    "apiSecret": "1337648ad51d99be78e446f8d721e8aa",
    "accessToken": "f3657af5975b2fd1b148307570a4c2fe"
  }

Returns a 401 (Unauthorized) with header X-Error-Detail "Invalid token." if the token doesn't exist.

If your credentials are wrong, you will get a 401 (Unauthorized) with header X-Error-Detail "Invalid credentials".

Request

  POST https://coverhound.com/api/auto/quotes
  Accept: application/json
  Content-type: application/json
  Access-Token: f3657af5975b2fd1b148307570a4c2fe
  {
    "userId":"john.walsh.id",
    "carriers":["ESRNC"],
    "usePolling": false,
    "applicant":{
      "mailingAddress1":"1 California St",
      "mailingAddress2":"#1100",
      "mailingZip":"94111",
      "phone1":"5558675309",
      "email":"john.walsh@example.com",
      "effectiveDate":"12-07-2014",
      "vehicles":[
        {
          "vin":"1FMDU63K3U",
          "use":"Commute",
          "mileage":10000,
          "commuteDistance":9,
          "commuteFrequency":5,
          "purchaseDate":"06-15-2015",
          "ownership":"Paid in Full",
          "commuteNyNj":false,
          "primaryDriver":0
        }
      ],
      "drivers":[
        {
          "primaryApplicant":true,
          "primaryVehicle":0,
          "firstName":"John",
          "middleName":"Trevor",
          "lastName":"Walsh",
          "birthDate":"05-01-1975",
          "gender":"M",
          "marital":"Married",
          "education":"High School",
          "careerStatus":"Full-Time Student",
          "homeowner":true,
          "residenceType":"Condo",
          "ageLicensed":16,
          "goodStudent":true,
          "distantStudent": false,
          "licenseStatus":"Valid",
          "sr22":false,
          "excluded":false,
          "vehicles":[0]
        },
        {
          "primaryApplicant":false,
          "primaryVehicle":0,
          "firstName":"Janet",
          "lastName":"Walsh",
          "birthDate":"12-25-1978",
          "gender":"F",
          "marital":"Married",
          "education":"Some High School",
          "careerStatus":"Employed",
          "occupationIndustry":"Art/Design/Media",
          "occupation":"Actor",
          "homeowner":true,
          "residenceType":"Condo",
          "relationPrimary":"Spouse",
          "addressPrimarySame":true,
          "ageLicensed":20,
          "licenseStatus":"Valid",
          "sr22":false,
          "excluded":false,
          "vehicles":[0]
        }
      ],
      "incidents":[
        {
          "incidentType":"Accident",
          "incidentDetails":"At Fault (Less than $750 damage)",
          "incidentDate":"09-01-2010",
          "driverNum":0
        }
      ],
      "priorPolicy":{
        "insuredDuration": "2 years",
        "insuredDurationDetail": "2 years",
        "expirationDate": "12-01-2015",
        "priorBIPerson": 100000,
        "priorBIAccident": 300000,
        "priorCarrier": "OTHER"
      }
    },
    "coverages":{
      "policy": {
        "biPerson": 15000,
        "biAccident": 30000,
        "mp": 5000,
        "pd": 5000,
        "umpd": 0,
        "umbiPerson": 15000,
        "umbiAccident": 30000
      },
      "vehicles": [
        {
          "coll": 0,
          "comp": 0
        }
      ]
    }
  }

General

userId

usePolling

carriers

Applicant (attribute: applicant)

General

mailingAddress1

mailingAddress2

mailingZip

phone1

phone2

email

effectiveDate

Vehicles (attribute: vehicles)

vin

use

mileage

commuteDistance

commuteFrequency

purchaseDate

ownership

commuteNyNj

primaryDriver

Drivers (attribute: drivers)

primaryApplicant

firstName

lastName

middleName

birthDate

gender

marital

dlNum

dlState

education

careerStatus

occupationIndustry

occupation

goodStudent

distantStudent

homeowner

residenceType

relationPrimary

addressPrimarySame

ageLicensed

licenseStatus

sr22

ssn

excluded

vehicles

primaryVehicle

Incidents (attribute: incidents)

incidentType

incidentDetails

incidentDate

driverNum

Prior Policy (attribute: priorPolicy)

insuredDuration

insuredDurationDetail

lapseDuration

expirationDate

priorBIPerson

priorBIAccident

priorCarrier

Coverages (attribute: coverages)

Policy (attribute: policy)

Vehicles (attribute: vehicles)

For each vehicle, in the same order as the vehicles attribute, list all the coverages in an object.

Responses

Successful Response - Successful Quote

Status code: 201, Success

  {
    "userId":"john.walsh.id",
    "transactionId":"232c552e-3756-43a6-a641-be32755e28d3",
    "customerId":628171,
    "coverages":{
      "policy":{
        "biPerson":15000
        "biAccident":30000,
        "mp":5000,
        "pd":5000,
        "umpd":0,
        "umbiPerson":0,
        "umbiAccident":0
      },
      "vehicles":[
        {
          "coll":0,
          "comp":0,
          "tl":0,
          "rrDay":0,
          "rrMonth":0
        }
      ]
    },
    "quotes":[
      {
        "carrierCode":"ESRNC",
        "carrierName":"Esurance",
        "payPlans":[
          {
            "payPlanName":"Pay in Full",
            "payPlanDesc":"Pay in Full",
            "termLength":6,
            "downPayment":"376.9",
            "installment":"0.0",
            "numInstallments":0,
            "nextInstallment":"08-01-2014",
            "totalPremium":"376.9"
          },
          {
            "payPlanName":"Monthly, Automatic Payments",
            "payPlanDesc":"Monthly, Automatic Payments",
            "termLength":6,
            "downPayment":"126.33",
            "installment":"67.63",
            "numInstallments":4,
            "nextInstallment":"08-01-2014",
            "totalPremium":"396.85"
          }
        ]
      }
    ],
    "purchaseUrl":"https://coverhound.com/resume/167565ae-83f4-45d5-b8e1-21032c29e41a?source=202",
    "purchasePhone":"8556419932"
  }

Successful Response - Carrier does not wish to write the risk

  {
    "userId":"john.walsh.id",
    "transactionId":"232c552e-3756-43a6-a641-be32755e28d3",
    "customerId":628171,
    "coverages":{
      "policy":{
        "biPerson":15000
        "biAccident":30000,
        "mp":5000,
        "pd":5000,
        "umpd":0,
        "umbiPerson":0,
        "umbiAccident":0
      },
      "vehicles":[
        {
          "coll":0,
          "comp":0,
          "tl":0,
          "rrDay":0,
          "rrMonth":0
        }
      ]
    },
    "quotes":[
      {
        "carrierCode":"ESRNC",
        "carrierName":"Esurance",
        "error":"Esurance does not wish to quote this risk type"
      }
    ],
    "purchaseUrl":"https://coverhound.com/resume/167565ae-83f4-45d5-b8e1-21032c29e41a?source=202",
    "purchasePhone":"8556419932"
  }

Successful Response - Carrier integration issue

  {
    "userId":"john.walsh.id",
    "transactionId":"232c552e-3756-43a6-a641-be32755e28d3",
    "customerId":628171,
    "coverages":{
      "policy":{
        "biPerson":15000
        "biAccident":30000,
        "mp":5000,
        "pd":5000,
        "umpd":0,
        "umbiPerson":0,
        "umbiAccident":0
      },
      "vehicles":[
        {
          "coll":0,
          "comp":0,
          "tl":0,
          "rrDay":0,
          "rrMonth":0
        }
      ]
    },
    "quotes":[
      {
        "carrierCode":"ESRNC",
        "carrierName":"Esurance",
        "error":"We are currently unable to provide a quote from Esurance for an unexpected reason. We will look to resolve shortly."
      }
    ],
    "purchaseUrl":"https://coverhound.com/resume/167565ae-83f4-45d5-b8e1-21032c29e41a?source=202",
    "purchasePhone":"8556419932"
  }

userId

transactionId

customerId

coverages

quotes

purchaseUrl

purchasePhone

Response with errors

Status code: 400, Bad syntax or bad data. If JSON is well formed, the errors object will describe any data problems.

  {
    "status":400,
    "message":"applicant[vehicles][ownership] does not have a valid value",
    "errors":{
      "applicant[vehicles][ownership]":[
        "does not have a valid value"
      ]
    }
  }

Status code: 401, Bad API key. Either the API key is missing or invalid.

  {
    "status":"Fail",
    "error_message":"Bad Key"
  }

Status code: 503, Timeout. Service unavailable or carrier unresponsive.

  {
    "status":503,
    "message":"The service is currently unavailable due to a server failure."
  }

Status code: 5xx, Something is wrong on CoverHound's side.

Polling

Why should I use polling?

There are two major benefits to using polling:

Speed

If you request quotes from multiple carriers, polling allows you to receive quotes as they become available. When using a single request, you need to wait until all quotes are available before you receive any. So if Carrier A is ready in 6 seconds and Carrier B takes 30 seconds, polling allows you to receive and display the Carrier A quote in 6 seconds and the Carrier B quote in 30 seconds. If you use a single, long-running request you will receive quotes from both Carrier A and Carrier B after 30 seconds.

Scaling

Polling allows us to serve many concurrent requests because all of the requests can be answered quickly. If you send many concurrent long-running requests, our servers may become overloaded and performance will suffer

How do I use polling?

In your initial request, send a top-level entry for "usePolling": true. You will get back a response that looks something like this:

  {
    "userId":"john.walsh.id",
    "transactionId":"232c552e-3756-43a6-a641-be32755e28d3",
  }

You can then use that transactionId and check this endpoint for updates:

  GET https://coverhound.com/api/auto/quotes/[transactionId]
  Accept: application/json
  Content-type: application/json
  Access-Token: f3657af5975b2fd1b148307570a4c2fe

We suggest a polling interval of 5 seconds. The responses mirror those without polling where quotes are added as they complete. Quotes can have statuses of started, error or complete.

  {
    [...]
    "quotes": [
      {
        "carrierCode": "SAFEC",
        "carrierName": "Safeco",
        "status": "error",
        "error": "Safeco does not wish to quote this risk type."
      },
      {
        "carrierCode": "CSEI",
        "carrierName": "CSE",
        "status": "started"
      },
      {
        "carrierCode": "PROGR",
        "carrierName": "Progressive",
        "status": "complete",
        "payPlans": [...],
        "purchaseUrl": ""
      }
    ]
  }