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
chevron-right
200

Successful operation

application/json
risk_modulestringOptionalExample: 0x79D1cA16Cf39367f9d7A66974ee2627f45857029
signerstringOptionalExample: 0x79D1cA16Cf39367f9d7A66974ee2627f45857029
decimalsintegerOptionalExample: 6
topicstringOptionalExample: dynamic-pricing
options
/example
200

Successful operation

Create a new quote

post
Authorizations
x-api-keystringRequired
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
chevron-right
200

Successful operation

application/json
quote_idstringOptional

Quote unique identifier, used across Ensuro's APIs

Example: c06bec3e-6984-49d8-a866-b27e0cbf1f4d
data_hashstringOptional

Hash that uniquely identifies this policy

Example: 0x0a39ddc02112fd46bdd9be79f4e13f558aaf9ce02467e4b6ea7ee8a896f89008
loss_probstringOptional

Loss probability for the policy, 0 < loss_prob < 1

Example: 0.105
premiumstringOptional

The premium that must be sent to the contract. If null send MAX_UINT256

Example: 19.9
bucket_idstringOptional

[optional] Pricing bucket id, only if the riskmodule is a SignedBucketRiskModule

Example: Bucket1
valid_untilintegerOptional

Quote expiration as seconds since epoch

Example: 1665447869
post
/example/quote

Create a new policy

post
Authorizations
x-api-keystringRequired
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
chevron-right
200

Successful operation

application/json
quote_idstringOptional

Quote unique identifier, used across Ensuro's APIs

Example: c06bec3e-6984-49d8-a866-b27e0cbf1f4d
data_hashstringOptional

Hash that uniquely identifies this policy

Example: 0x0a39ddc02112fd46bdd9be79f4e13f558aaf9ce02467e4b6ea7ee8a896f89008
loss_probstringOptional

Loss probability for the policy, 0 < loss_prob < 1

Example: 0.105
premiumstringOptional

The premium that must be sent to the contract. If null send MAX_UINT256

Example: 19.9
bucket_idstringOptional

[optional] Pricing bucket id, only if the riskmodule is a SignedBucketRiskModule

Example: Bucket1
valid_untilintegerOptional

Quote expiration as seconds since epoch

Example: 1665447869
post
/example/new-policy

Resolve a policy

post
Authorizations
x-api-keystringRequired
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
chevron-right
200

Successful operation

application/json
statusstringOptionalExample: QUEUED
post
/example/resolve-policy

Replace a policy

post
Authorizations
x-api-keystringRequired
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
Responses
chevron-right
200

Successful operation

application/json
quote_idstringOptional

Quote unique identifier, used across Ensuro's APIs

Example: c06bec3e-6984-49d8-a866-b27e0cbf1f4d
data_hashstringOptional

Hash that uniquely identifies this policy

Example: 0x0a39ddc02112fd46bdd9be79f4e13f558aaf9ce02467e4b6ea7ee8a896f89008
loss_probstringOptional

Loss probability for the policy, 0 < loss_prob < 1

Example: 0.105
premiumstringOptional

The premium that must be sent to the contract. If null send MAX_UINT256

Example: 19.9
bucket_idstringOptional

[optional] Pricing bucket id, only if the riskmodule is a SignedBucketRiskModule

Example: Bucket1
valid_untilintegerOptional

Quote expiration as seconds since epoch

Example: 1665447869
post
/example/replace-policy

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 EIP191arrow-up-right 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 repositoryarrow-up-right for a js example of how to use each one.

Last updated