Pricing API

This API is used for policy pricing, creation and resolution.

You should have received a partner-specific URL and credentials to use this API. If you didn't, please contact our support team to set up the required services and credentials.

Get information about this instance

options
Responses
200
Successful operation
application/json
options
OPTIONS /api/v0/example HTTP/1.1
Host: 
Accept: */*
200

Successful operation

{
  "risk_module": "0x79D1cA16Cf39367f9d7A66974ee2627f45857029",
  "signer": "0x79D1cA16Cf39367f9d7A66974ee2627f45857029",
  "decimals": 6,
  "topic": "dynamic-pricing"
}

Create a new quote

post
Authorizations
Query parameters
unsignedbooleanOptional

Unsigned

Body
dataobjectOptionalExample: {"internal_id":"ac3b3fe475","arrival":"2022-10-12T14:36:07.00Z","channel":"website","departure":"2022-10-12T11:36:07.00Z"}
expirationstring · date-timeOptionalExample: 2022-10-27T21:36:07.211025Z
payoutstringOptionalExample: 190.25
Responses
200
Successful operation
application/json
post
POST /api/v0/example/quote HTTP/1.1
Host: 
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 192

{
  "data": {
    "internal_id": "ac3b3fe475",
    "arrival": "2022-10-12T14:36:07.00Z",
    "channel": "website",
    "departure": "2022-10-12T11:36:07.00Z"
  },
  "expiration": "2022-10-27T21:36:07.211025Z",
  "payout": "190.25"
}
{
  "quote_id": "c06bec3e-6984-49d8-a866-b27e0cbf1f4d",
  "data_hash": "0x0a39ddc02112fd46bdd9be79f4e13f558aaf9ce02467e4b6ea7ee8a896f89008",
  "loss_prob": "0.105",
  "premium": "19.9",
  "bucket_id": "Bucket1",
  "signature": {
    "hash": "0x655daa61a6cf9d65d07329ec011c22650a05b526fb41c9b1683956e7b241a2bf",
    "r": "0xfa77cd0f2d12287d1d9e0ef367e411e8d02f59890c2977f5bdc3f1dbf30aab54",
    "vs": "0x50d6f317112b224daf7efc73ac4f294358314fe53d423a672d56844c4d6843e9"
  },
  "valid_until": 1665447869
}

Create a new policy

post
Authorizations
Header parameters
X-EIP191-SignaturestringOptional

EIP-191 signature of the body digest (SHA256 of the body, without leading '0x'). The signature must be made by an authorized signer. Signature format: r+s+v in hexadecimal. Example: "0xc9a9d2e9ebf6a9930705c4517ff7ae6aa91a4799df8f87189488e1f1396080c76cbeb698c047af21ee94d2c5bb89f72a56fb70ac58f1c2b7245e9d2b400c243f1b"

This is the preferred signing method. Only one of X-EIP191-Signature or X-Ensuro-Signature must be provided.

Pattern: 0x[0-9a-f]{130}
X-Ensuro-SignaturestringOptional

HMAC-SHA256 signature of the body, using the shared secret provided. The signature must be in hexadecimal, without including the leading "0x", for example: "41deed7140512b0d351a588d05bff44dfdc58a6a038b47edf4f5e944dd1185d6" will be the signature for body '{"foo":"bar"}' and secret 'topsecret'.

This method is not recommended, use X-EIP191-Signature whenever possible. Only one of X-EIP191-Signature or X-Ensuro-Signature must be provided.

Pattern: [0-9a-f]{64}
Body
dataobjectOptionalExample: {"internal_id":"ac3b3fe475","arrival":"2022-10-12T14:36:07.00Z","channel":"website","departure":"2022-10-12T11:36:07.00Z"}
expirationstring · date-timeOptionalExample: 2022-10-27T21:36:07.211025Z
payoutstringOptionalExample: 190.25
Responses
200
Successful operation
application/json
post
POST /api/v0/example/new-policy HTTP/1.1
Host: 
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 192

{
  "data": {
    "internal_id": "ac3b3fe475",
    "arrival": "2022-10-12T14:36:07.00Z",
    "channel": "website",
    "departure": "2022-10-12T11:36:07.00Z"
  },
  "expiration": "2022-10-27T21:36:07.211025Z",
  "payout": "190.25"
}
{
  "quote_id": "c06bec3e-6984-49d8-a866-b27e0cbf1f4d",
  "data_hash": "0x0a39ddc02112fd46bdd9be79f4e13f558aaf9ce02467e4b6ea7ee8a896f89008",
  "loss_prob": "0.105",
  "premium": "19.9",
  "bucket_id": "Bucket1",
  "signature": {
    "hash": "0x655daa61a6cf9d65d07329ec011c22650a05b526fb41c9b1683956e7b241a2bf",
    "r": "0xfa77cd0f2d12287d1d9e0ef367e411e8d02f59890c2977f5bdc3f1dbf30aab54",
    "vs": "0x50d6f317112b224daf7efc73ac4f294358314fe53d423a672d56844c4d6843e9"
  },
  "valid_until": 1665447869
}

Resolve a policy

post
Authorizations
Header parameters
X-EIP191-SignaturestringOptional

EIP-191 signature of the body digest (SHA256 of the body, without leading '0x'). The signature must be made by an authorized signer. Signature format: r+s+v in hexadecimal. Example: "0xc9a9d2e9ebf6a9930705c4517ff7ae6aa91a4799df8f87189488e1f1396080c76cbeb698c047af21ee94d2c5bb89f72a56fb70ac58f1c2b7245e9d2b400c243f1b"

This is the preferred signing method. Only one of X-EIP191-Signature or X-Ensuro-Signature must be provided.

Pattern: 0x[0-9a-f]{130}
X-Ensuro-SignaturestringOptional

HMAC-SHA256 signature of the body, using the shared secret provided. The signature must be in hexadecimal, without including the leading "0x", for example: "41deed7140512b0d351a588d05bff44dfdc58a6a038b47edf4f5e944dd1185d6" will be the signature for body '{"foo":"bar"}' and secret 'topsecret'.

This method is not recommended, use X-EIP191-Signature whenever possible. Only one of X-EIP191-Signature or X-Ensuro-Signature must be provided.

Pattern: [0-9a-f]{64}
Body
ensuro_idstringOptionalExample: 55290711940124341656440444382658655728151858290209621141129482339851750871896
payoutstringOptionalExample: 105.25
Responses
200
Successful operation
application/json
post
POST /api/v0/example/resolve-policy HTTP/1.1
Host: 
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 111

{
  "ensuro_id": "55290711940124341656440444382658655728151858290209621141129482339851750871896",
  "payout": "105.25"
}
{
  "status": "QUEUED"
}

Replace a policy

post
Authorizations
Header parameters
X-EIP191-SignaturestringOptional

EIP-191 signature of the body digest (SHA256 of the body, without leading '0x'). The signature must be made by an authorized signer. Signature format: r+s+v in hexadecimal. Example: "0xc9a9d2e9ebf6a9930705c4517ff7ae6aa91a4799df8f87189488e1f1396080c76cbeb698c047af21ee94d2c5bb89f72a56fb70ac58f1c2b7245e9d2b400c243f1b"

This is the preferred signing method. Only one of X-EIP191-Signature or X-Ensuro-Signature must be provided.

Pattern: 0x[0-9a-f]{130}
X-Ensuro-SignaturestringOptional

HMAC-SHA256 signature of the body, using the shared secret provided. The signature must be in hexadecimal, without including the leading "0x", for example: "41deed7140512b0d351a588d05bff44dfdc58a6a038b47edf4f5e944dd1185d6" will be the signature for body '{"foo":"bar"}' and secret 'topsecret'.

This method is not recommended, use X-EIP191-Signature whenever possible. Only one of X-EIP191-Signature or X-Ensuro-Signature must be provided.

Pattern: [0-9a-f]{64}
Body
all ofOptional
Responses
200
Successful operation
application/json
post
POST /api/v0/example/replace-policy HTTP/1.1
Host: 
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 288

{
  "data": {
    "internal_id": "ac3b3fe475",
    "arrival": "2022-10-12T14:36:07.00Z",
    "channel": "website",
    "departure": "2022-10-12T11:36:07.00Z"
  },
  "expiration": "2022-10-27T21:36:07.211025Z",
  "payout": "190.25",
  "old_ensuro_id": "55290711940124341656440444382658655728151858290209621141129482339851750871896"
}
{
  "quote_id": "c06bec3e-6984-49d8-a866-b27e0cbf1f4d",
  "data_hash": "0x0a39ddc02112fd46bdd9be79f4e13f558aaf9ce02467e4b6ea7ee8a896f89008",
  "loss_prob": "0.105",
  "premium": "19.9",
  "bucket_id": "Bucket1",
  "signature": {
    "hash": "0x655daa61a6cf9d65d07329ec011c22650a05b526fb41c9b1683956e7b241a2bf",
    "r": "0xfa77cd0f2d12287d1d9e0ef367e411e8d02f59890c2977f5bdc3f1dbf30aab54",
    "vs": "0x50d6f317112b224daf7efc73ac4f294358314fe53d423a672d56844c4d6843e9"
  },
  "valid_until": 1665447869
}

Signatures

For policy creation and resolution the body of the request must be signed.

There's two options available for signing:

  • Symmetric: a shared secret will be provided and it has to be used to compute an hmac digest. The digest must be sent in the X-Ensuro-Signature of the request.

  • Asymmetric: An authorized ethereum account is used to sign the body of the message. This method is safer because only the partner has access to the private key and it does not need to be sent over the internet ever. The signature is computed following the EIP191 standard. It must be sent in the X-EIP191-Signature header of the request.

Only one of the methods must be used, and "Asymmetric" is the preferred one.

See our samples repository for a js example of how to use each one.

Last updated