Subscriptions
Endpoints
PATCH
DELETE
GET
Overview
Subscriptions are generated from the creation of a Risk Item, which includes a package containing pre-configured settings for recurring payments. These subscriptions can be daily, weekly, monthly, or annual, and may feature a trial period. Additionally, they can specify whether the payment is charged at the end of the month, at the beginning, or upon the expiration of the last payment.
The process begins with the creation of a Risk Item. A webhook then evaluates whether the Risk Item is a one-time payment or a subscription. For one-time payments, an order is created immediately, and the Risk Item is protected until the specified end_date
. For subscriptions, protection is provided based on payment renewal, using the end_date
as the final date of the subscription (with the option to set the end_date
to null
to indicate that the subscription does not expire).
Once the subscription and the first order are created, the next payment date is generated and stored in the database. A CRON job runs daily at night to generate new orders for subscriptions, continuing this process until the subscription ends.
Use cases include daily, weekly, monthly, and annual subscriptions, where Risk Items are protected and orders are generated according to the specified intervals. Subscriptions can also include a trial period, delaying the first payment for a defined duration. The payment schedule is flexible, allowing payments to be scheduled at the end of the month, the beginning of the month, or upon the expiration of the last payment, based on the package configuration.
Cancelations
To cancel a subscription, you need the ID or UID of the Risk Item to be canceled. This allows you to terminate the subscription or modify its end date. It is important to note that if you cancel midway through a monthly subscription, you remain protected for the month you paid for, and protection ceases once the paid subscription period ends.
PATCH
https://app.insurehero.io/api/shield/v1/risk-items/:riskItemId/cancel
Headers
Authorization*
string
Bearer access token
Path Parameters
riskItemId
*
string
Risk item identifier
Body
end_date*
date
End date of the Risk item. If you send "cancel" the current date is sent.
Example response
Attributes
data
object
aObject containing information about a risk item
id
uuid
Unique identifier for the risk item
policy_id
uuid
Unique identifier for the associated policy
authorized_claimants
object []
List of authorized claimants
authorized_claimants.email
string
Email of the authorized claimant
authorized_claimants.name
string
Name of the authorized claimant
authorized_claimants.phone
string
Phone number of the authorized claimant
package_id
uuid
Unique identifier for the coverage package
start_date
string
Start date of the coverage period
end_date
string
End date of the coverage period
beneficiaries
object []
List of beneficiaries
beneficiaries.email
string
Email of the beneficiary
beneficiaries.name
string
Name of the beneficiary
beneficiaries.phone
string
Phone number of the beneficiary
beneficiaries.group_uid
string
Unique identifier for the beneficiary’s group
insured_subject
object
Details of the insured subject
insured_subject.identifier_value
string
Identifier of the insured subject
insured_subject.identifier_type
string
Type of identifier
insured_subject.ruc
string
Taxpayer identification number
insured_subject.driver_id
string
Driver's identification number
insured_subject.group_uid
string
Unique identifier of the insured group
insured_subject.group_name
string
Name of the insured group
insured_subject.policy_note
string
Policy coverage notes
insured_subject.guide_number
string
Tracking number for the shipment
insured_subject.plate_number
string
License plate of the transport vehicle
insured_subject.subject_type
string
Type of insured subject
insured_subject.invoice_count
number
Number of invoices related to the insured subject
insured_subject.departure_city
string
City of departure
insured_subject.departure_date
string
Departure date and time
insured_subject.content_category
string
Category of the transported content
insured_subject.departure_coords
string
GPS coordinates of departure location
insured_subject.destination_city
string
Destination city
insured_subject.driver_full_name
string
Full name of the driver
insured_subject.primary_category
string
Main category of insured items
insured_subject.business_industry
string
Industry related to the insured subject
insured_subject.policy_observations
string
Additional observations about the policy
insured_subject.total_insured_value
number
Total insured value in policy currency
status
string
Current status of the risk item
uid
string
Unique identifier
assets
object[]
List of associated assets
metadata
object
Additional structured data
metadata.delivery_stops
object
Details of delivery stops
metadata.delivery_stops.[key]
object
Delivery stop information
metadata.delivery_stops.[key].items
object[]
List of items delivered at this stop
metadata.delivery_stops.[key].items.item_sku
string
Stock-keeping unit (SKU) of the item
metadata.delivery_stops.[key].items.item_cost
number
Cost of the item
metadata.delivery_stops.[key].items.item_name
string
Name of the item
metadata.delivery_stops.[key].items.item_expiry
string
Expiry date of the item
metadata.delivery_stops.[key].items.item_quantity
number
Quantity of the item
metadata.delivery_stops.[key].final_coords
string
GPS coordinates of delivery stop
metadata.delivery_stops.[key].destination_invoice_id
string
Invoice ID for delivered items
Risk Item Rescission
This endpoint is useful for canceling a risk-item immediately
DELETE
https://app.insurehero.io/api/shield/v1/risk-items/:riskItemId/rescission
Headers
Authorization*
string
Bearer access token
Path Parameters
riskItemId
*
string
Risk item identifier
Example response
Attributes
data
object
Object containing information about a risk item
id
uuid
Unique identifier for the risk item
policy_id
uuid
Unique identifier for the associated policy
authorized_claimants
object[]
List of authorized claimants
authorized_claimants.email
string
Email of the authorized claimant
authorized_claimants.name
string
Name of the authorized claimant
authorized_claimants.phone
string
Phone number of the authorized claimant
package_id
uuid
Unique identifier for the coverage package
start_date
string
Start date of the coverage period
end_date
string
End date of the coverage period
beneficiaries
object []
List of beneficiaries
beneficiaries.email
string
Email of the beneficiary
beneficiaries.name
string
Name of the beneficiary
beneficiaries.phone
string
Phone number of the beneficiary
beneficiaries.group_uid
string
Unique identifier for the beneficiary’s group
insured_subject
object
Details of the insured subject
insured_subject.identifier_value
string
Identifier of the insured subject
insured_subject.identifier_type
string
Type of identifier
insured_subject.ruc
string
Taxpayer identification number
insured_subject.driver_id
string
Driver's identification number
insured_subject.group_uid
string
Unique identifier of the insured group
insured_subject.group_name
string
Name of the insured group
insured_subject.policy_note
string
Policy coverage notes
insured_subject.guide_number
string
Tracking number for the shipment
insured_subject.plate_number
string
License plate of the transport vehicle
insured_subject.subject_type
string
Type of insured subject
insured_subject.invoice_count
number
Number of invoices related to the insured subject
insured_subject.departure_city
string
City of departure
insured_subject.departure_date
string
Departure date and time
insured_subject.content_category
string
Category of the transported content
insured_subject.departure_coords
string
GPS coordinates of departure location
insured_subject.destination_city
string
Destination city
insured_subject.driver_full_name
string
Full name of the driver
insured_subject.primary_category
string
Main category of insured items
insured_subject.business_industry
string
Industry related to the insured subject
insured_subject.policy_observations
string
Additional observations about the policy
insured_subject.total_insured_value
number
Total insured value in policy currency
status
string
Current status of the risk item
uid
string
Unique identifier
assets
object[]
List of associated assets
metadata
object
Additional structured data
metadata.delivery_stops
object
Details of delivery stops
metadata.delivery_stops.[key]
object
Delivery stop information
metadata.delivery_stops.[key].items
object[]
List of items delivered at this stop
metadata.delivery_stops.[key].items.item_sku
string
Stock-keeping unit (SKU) of the item
metadata.delivery_stops.[key].items.item_cost
number
Cost of the item
metadata.delivery_stops.[key].items.item_name
string
Name of the item
metadata.delivery_stops.[key].items.item_expiry
string
Expiry date of the item
metadata.delivery_stops.[key].items.item_quantity
number
Quantity of the item
metadata.delivery_stops.[key].final_coords
string
GPS coordinates of delivery stop
metadata.delivery_stops.[key].destination_invoice_id
string
Invoice ID for delivered items
Get all the subscriptions
GET
https://app.insurehero.io/api/shield/v1/subscriptions
Headers
Authorization*
string
Bearer access token
Query Parameters
from*
string
Starting record index
to*
string
Ending record index
Example response
Attributes
id
uuid
Unique identifier for the subscription.
risk_item_id
uuid
ID of the associated risk item.
customer_id
uuid
ID of the customer associated with the subscription.
last_payment
string
Timestamp of the last payment.
next_payment
string
Timestamp of the next scheduled payment.
expires_at
string
Expiration date of the subscription.
channel_id
string
ID of the channel through which the subscription was created.
interval
string
Frequency of the subscription.
active
boolean
Indicates if the subscription is currently active.
interval_count
string
Number of intervals before the next payment.
trial_period
string
Trial period duration in days.
Last updated