Affinity

Get Affinity Partnership

Retrieve information about the current Affinity Partnership. It will return available products and current status with insurers.

GET /v1/affinity/partnership

Response

The above request returns JSON structured like this:

ParameterDescription
customerThe complete customer data
productsList of products available for this affinity partnership
products.idThe ID of the current product
products.nameThe name of the current product
products.assistsList of assists available for the product
products.coveragesList of coverages available for the product
{
  "customer": {},
  "products": [
    {
      "id": "string",
      "name": "string",
      "assists": [],
      "coverages": []
    }
  ]
}

Create Affinity Request

Before trying to create an affinity, you must create a affinity_request to “prepare” the process of contracting, receiving useful data for the rest of the process and to help proponent select desired configurations.

POST /v1/affinity/request

Body Parameters

The request has the following parameters in body:

ParameterDescription
product_idThe ID of the product selected for your partnershipRequired
{
  "product_id": "string"
}
Response

The above request returns JSON structured like this:

ParameterDescription
idThe ID of the Affinity Request
plansList of plans available for the product
plans.idThe ID of the current plan
plans.nameThe name of the current plan
plans.assistsList of assists specified for the plan
plans.coveragesList of coverages specified for the plan
{
  "id": "string",
  "plans": [
    {
      "id": "string",
      "name": "string",
      "assists": [],
      "coverages": []
    }
  ]
}

Create Affinity

POST /v1/affinity

Body Parameters

The request has the following parameters in body:

ParameterDescription
affinity_request_idThe ID of the affinity requestRequired
lifetime_startThe lifetime start dateRequired
lifetime_endThe lifetime end dateRequired
plan_idThe ID of the plan chosen for this affinityOptional
affinity_holderThe affinity holder dataOptional
itemThe item associated with this affinityOptional

The affinity_holder and item parameters from Create Affinity can vary depending on which type of insurance product your are contracting. See our guides to understand the possible values for each product.

{
  "affinity_request_id": "string",
  "lifetime_start": "string",
  "lifetime_end": "string",
  "plan_id": "string",
  "affinity_holder": {},
  "item": {}
}
Response

The above request returns JSON structured like this:

ParameterDescription
idThe ID of the Affinity
statusThe status of affinity
attachmentsThe attachments and result of the affinity itself for each item
attachments.typeThe attachment type
attachments.urlThe attachment url
The affinity status can be:
StatusName
1Issued
2Canceled
3Expired
4Renewed
5Pending
The affinity attachment types can be:
StatusName
1Coi (Certificate of Insurance)
2General Condition
3Capitalization Regulation
4Cancel
{
  "id": "string",
  "status": 0,
  "attachments": [
    {
      "type": 0,
      "url": "string"
    }
  ]
}

List Affinity

GET /v1/affinity

URL Parameters
ParameterDescription
rowsA limit of objects to be returned, between 1 and 100 itemsOptional
pageThe page for the list of objects to returnOptional
cursorThe cursor of the current page list of objectsOptional
Response

The above request returns JSON structured like this:

ParameterDescription
totalThe total of items
itemsThe complete affinity data
{
  "total": 0,
  "items": [
    {
      "id": "string",
      ...
    }
  ]
}

Cancel Affinity

DELETE /v1/affinity/{affinity_id}

URL Parameters
ParameterDescription
affinity_idThe ID of affinity to cancel
Response

The above request returns JSON structured like this:

ParameterDescription
idThe ID of the Affinity
statusThe status canceled for the Affinity
date_endThe date affinity was canceled
{
  "id": "string",
  "status": 0,
  "date_end": "string"
}

Webhooks

In most cases, affinities may introduce a complexity that requires an async process in order to update their data. In order to keep users updated about Affinity status, attachments, and another details from Insurer, you can make the use of Webhooks to get the updates and do the necessary business logic in your system if necessary.

The endpoint that our API uses to communicate with your server is configured in our stack. To configure your endpoint or change it, please, get in touch with our support.

When an update occur, the following request will be make to your endpoint:

POST 'YOUR_ENDPOINT'

In the body at the request, the complete data of the Affinity will be sent as well:

{
  "affinity_request_id": "string",
  "lifetime_start": "string",
  "lifetime_end": "string",
  "plan_id": "string",
  "affinity_holder": {},
  "item": {},
  "status": 0,
  "attachments": [
    {
      "type": 0,
      "url": "string"
    }
  ]
}

Your server must return a HTTP Status Code 200. Otherwise, new requests will be made periodically until your server returns the expected Http Status Code. If multiple requests to your server endpoint fails, the updates/requests will be dammed, than requests will be made in sequence and order as soon as they were successful.