NAV Navbar
Lifeguard Docs
shell python javascript
  • Introduction
  • API Keys
  • Connect
  • Carriers
  • Auth
  • Quotes
  • Referrals
  • Errors
  • Introduction

    Welcome to the Lifeguard API! You can use our API to access Lifeguard API endpoints, which can get information on various cats, company, and breeds in our database.

    API Keys

    To authorize, use this code:

    import lifeguard
    
    api = lifeguard.authorize('r2d24ab-8509-c3po-aa9e-13ae7917e1b8')
    
    # With shell, you can just pass the correct header with each request
    curl "api_endpoint_here"
      -H "Authorization: r2d24ab-8509-c3po-aa9e-13ae7917e1b8"
    
    const lifeguard = require('lifeguard');
    
    let api = lifeguard.authorize('r2d24ab-8509-c3po-aa9e-13ae7917e1b8');
    

    Make sure to replace r2d24ab-8509-c3po-aa9e-13ae7917e1b8 with your API key.

    Lifeguard uses API keys to allow access to the API. You can register a new Lifeguard API key at our developer portal.

    Lifeguard expects for the API key to be included in all API requests to the server in a header that looks like the following:

    Authorization: r2d24ab-8509-c3po-aa9e-13ae7917e1b8

    Connect

    The connect javascript library provides a simple "out-of-the-box" solution for integration our APIs

    <script type="text/javascript" src="https://www.lifeguard.insure/static_/v1/connect.js" ></script>
    <script>
        Lifeguard.apiKey = '<<insert API Key here>>';
    </script>
    
    <button onclick="Lifeguard.connect('Demo', 'Auto', Lifeguard.quote);">Get an Auto Quote</button>
    <button onclick="Lifeguard.connect('Demo', 'Home', Lifeguard.quote);">Get an Home Quote</button>
    <button onclick="Lifeguard.connect('Demo', 'Life', Lifeguard.quote);">Get an Life Quote</button>
    

    Carriers

    POST https://www.lifeguard.insure/v1/carriers

    import lifeguard
    
    api = lifeguard.authorize('r2d24ab-8509-c3po-aa9e-13ae7917e1b8')
    api.carrier.get()
    
    curl "https://www.lifeguard.insure/v1/carrier"
      -H "Authorization: r2d24ab-8509-c3po-aa9e-13ae7917e1b8"
    
    const lifeguard = require('lifeguard');
    
    let api = lifeguard.authorize('r2d24ab-8509-c3po-aa9e-13ae7917e1b8');
    let carrier = api.carrier.get();
    

    The above command returns JSON structured like this:

    {
      "status":"success",
      "data":{
        "carriers":[
          {
            "id": 1123,
            "name": "Clearcover",
            "display_rank": 1,
            "color": "#092f56",
            "url": "https://clearcover.com/",
            "products":{
              "auth": false,
              "quote": true
            },
            "logo_wheel":{
              "wlogo":"https://www.lifeguard.insure/static_/img/logos/21stcenturyinsurance-w.png",
              "blogo":"https://www.lifeguard.insure/static_/img/logos/21stcenturyinsurance.png",
              "slogo":"https://www.lifeguard.insure/static_/img/logos/21stcenturyinsurance-1.png"
            },
            "requires_mfa": false,
            "categories": ["Auto"]
          },
          ...
      }
    }
    

    This endpoint retrieves all carriers.

    HTTP Request

    GET https://www.lifeguard.insure/v1/carrier

    Query Parameters

    Parameter Type Required Notes
    category String ('Auto', 'Home', 'Life', 'Health') True

    Auth

    import lifeguard
    
    api = lifeguard.authorize('r2d24ab-8509-c3po-aa9e-13ae7917e1b8')
    api.auth.get(username, password)
    
    curl "https://www.lifeguard.insure/v1/auth"
      -H "Authorization: r2d24ab-8509-c3po-aa9e-13ae7917e1b8"
      -H "Content-Type: application/json"
      -d '{"username": "abc@example.com", "password": "example123", "carrier": 65, "category": "Auto"}'
    
    const lifeguard = require('lifeguard');
    
    let api = lifeguard.authorize('r2d24ab-8509-c3po-aa9e-13ae7917e1b8');
    let data = api.auth.get(username, password);
    

    The above command returns JSON structured like this:

    {
       "data":{
          "policies":[
             {
                "id":"014b1740-5b26-11e8-8da1-0242ac110002",
                "address": {
                   "city": "San Diego",
                   "state": "CA",
                   "street": "1234 Main Street",
                   "zipcode": "90293",
                   "homeowner": true,
                   "residence_type":"Condo",
                },
                "carrier": 16,
                "category": "Auto",
                "policy_number": "JH4DA344XGS004311",
                "term_in_years": null,
                "premium": {
                   "cost_per_month": 100,
                   "deductible": 500,
                   "number_of_months": 6,
                   "renewal_date": "2019-07-05",
                },
                "persons": [{
                   "age": 33,
                   "email": "john.doe@gmail.com",
                   "first_name": "John",
                   "middle_name":"Trevor",
                   "last_name": "Doe",
                   "gender": "Male",
                   "height_in": null,
                   "weight_lbs": null,
                   "uses_nicotine": null,
                   "overall_health_index": null,
                   "primary": true,
                   "primaryApplicant":true,
                   "primaryVehicle":0,
                   "birth_date":"05-01-1975",
                   "marital":"Married",
                   "education":"High School",
                   "career_status":"Full-Time Student",
                   "age_licensed": 16,
                   "good_student": true,
                }],
                "vehicles": [{
                  "make": "BMW",
                  "model": "i3",
                  "year": 2015,
                  "annual_mileage": 10000,
                  "vin": "1FMDU63K3U",
                  "use": "Commute",
                  "commute_distance": 9,
                  "commute_frequency": 5,
                  "purchase_date" :"06-15-2015",
                  "ownership": "Paid in Full",
                  "primary_driver": 0
                }]
             },
             ...
          ]
       },
       "status": "success"
    }
    

    This endpoint retrieves an insurance information based on the credentials provided.

    HTTP Request

    POST https://www.lifeguard.insure/v1/auth

    Query Parameters

    Parameter Type Required Notes
    carrier Integer True Must match to carrier id from Carrier API
    username String True Can be email or policy number
    password String True

    Quotes

    import lifeguard
    
    api = lifeguard.authorize('r2d24ab-8509-c3po-aa9e-13ae7917e1b8')
    api.quote.get()
    
    curl "https://www.lifeguard.insure/v1/quote" \
      -H "Authorization: r2d24ab-8509-c3po-aa9e-13ae7917e1b8" \
      -X POST \
      -H 'Content-Type: application/json' \
      -d '{
            "id":"014b1740-5b26-11e8-8da1-0242ac110002",
            "address": {
                "city": "San Diego",
                "state": "CA",
                "street": "1234 Main Street",
                "zipcode": "90293",
                "homeowner": true,
                "residence_type":"Condo",
            },
            "carrier": 16,
            "category": "Auto",
            "policy_number": "JH4DA344XGS004311",
            "term_in_years": null,
            "premium": {
                "cost_per_month": 100,
                "deductible": 500,
                "number_of_months": 6,
                "renewal_date": "2019-07-05",
            },
            "persons": [{
                "age": 33,
                "email": "john.doe@gmail.com",
                "first_name": "John",
                "middle_name":"Trevor",
                "last_name": "Doe",
                "gender": "Male",
                "height_in": null,
                "weight_lbs": null,
                "uses_nicotine": null,
                "overall_health_index": null,
                "primary": true,
                "primaryApplicant":true,
                "primaryVehicle":0,
                "birth_date":"05-01-1975",
                "marital":"Married",
                "education":"High School",
                "career_status":"Full-Time Student",
                "age_licensed": 16,
                "good_student": true,
            }],
            "vehicles": [{
              "make": "BMW",
              "model": "i3",
              "year": 2015,
              "annual_mileage": 10000,
              "vin": "1FMDU63K3U",
              "use": "Commute",
              "commute_distance": 9,
              "commute_frequency": 5,
              "purchase_date" :"06-15-2015",
              "ownership": "Paid in Full",
              "primary_driver": 0
            }]
          }'
    
    
    const lifeguard = require('lifeguard');
    
    let api = lifeguard.authorize('r2d24ab-8509-c3po-aa9e-13ae7917e1b8');
    let quote = api.quote.get(zipcode, gender, age);
    

    The above command returns JSON structured like this:

    {
      "status":"success",
      "data":{
        "quotes":[
          {
            "id":"014b1740-5b26-11e8-8da1-0242ac110002",
            "carrier_id":17,
            "carrier_name":"American Family Insurance",
            "price_per_month":138.52,
            "confidence":48.84,
            "bindable":false
          },
          ...
        ]
      }
    }
    

    This takes a product object similar to the one returned by the Auth object and retrieves an insurance quote. Please note, that not all fields in this object are required and quote module should be able to process a partial object. The more information, the more accurate the quote.

    Some carriers need all information completed to provide a bindable quote. If key data fields are missing, we will return a non-bindable estimate.

    HTTP Request

    POST https://www.lifeguard.insure/v1/quote

    Referrals

    This endpoint is used to create an insure referral

    HTTP Request

    POST https://www.lifeguard.insure/v1/referral

    Query Parameters

    Parameter Type Required Notes
    quote_id String True This ID must come from either the Auth or the Quote APIs

    Errors

    The Lifeguard API uses the following error codes:

    Error Code Meaning
    400 Bad Request -- Your request is invalid.
    401 Unauthorized -- Your API key is wrong.
    403 Forbidden -- The kitten requested is hidden for administrators only.
    404 Not Found -- The specified kitten could not be found.
    405 Method Not Allowed -- You tried to access a kitten with an invalid method.
    406 Not Acceptable -- You requested a format that isn't json.
    410 Gone -- The kitten requested has been removed from our servers.
    418 I'm a teapot.
    429 Too Many Requests -- You're requesting too many companies! Slow down!
    500 Internal Server Error -- We had a problem with our server. Try again later.
    503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.