Avata Api Documentation (0.12.0)

Download OpenAPI specification:Download

Avata Api

API support: tech@avata.gg

Introduction

This API is used to communicate with the Avata services.

NFT (web3.0)

NFT flow sequence diagram

NFT sequence diagram

Proposal

Used to ask for a proposal for a policy for an NFT.

Authorizations:
api_key
header Parameters
X-Brand-Id
string
Request Body schema: application/json
required
Any of
totalValue
required
number

The total value of the purchase

chain
required
string
Enum: "ETHEREUM" "POLYGON"

The used chain for the purchase

nftContractId
required
string^0x[A-Fa-f0-9]{40}$

The smart contract address of the NFT

countryCode
string
Enum: "global" "nl" "be" "de" "gb"

ISO 3166-1 alpha-2 country code. The country code of the buyer. This code is optional for normal NFT, but required for an NFT that is a receipt for a physical product.

marketplaceContractId
string^0x[A-Fa-f0-9]{40}$

The smart contract address of the Marketplace

token
required
string
Enum: "ETH" "MATIC" "USDC" "USDT" "EUR" "USD" "GBP" "AED"

The used token for the purchase

Responses

Request samples

Content type
application/json
{
  • "totalValue": 0,
  • "chain": "ETHEREUM",
  • "nftContractId": "string",
  • "countryCode": "global",
  • "marketplaceContractId": "string",
  • "token": "ETH"
}

Response samples

Content type
application/json
{
  • "totalValue": 0,
  • "duration": 0,
  • "policyPercentage": 0,
  • "policyTermsUrl": "string",
  • "policyPrice": 0,
  • "id": "string",
  • "coveragePercentage": 0,
  • "policyLogoUrl": "string",
  • "avataLogoUrl": "string"
}

Confirm

Used to confirm a proposal for a policy for an NFT . Data needs to match proposal.

Authorizations:
api_key
header Parameters
X-Brand-Id
string
Request Body schema: application/json
required
required
object
required
object or object
object

Customer details if available for contact purpose

Responses

Request samples

Content type
application/json
{
  • "proposal": {
    },
  • "purchase": {
    },
  • "customer": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "message": "string"
}

Booking

.. Booking flow

Cancel

Used to activate a policy and cancel a booking.

Authorizations:
api_key
Request Body schema: application/json
required
Any of
policyUuid
required
string

Policy identifier

chain
required
string
Enum: "ETHEREUM" "POLYGON"

The used chain for the purchase

nftIds
required
Array of strings[^0x[A-Fa-f0-9]{64}$]

The NFT ids with capacity

walletAddress
required
string

Public wallet ID of the buyer, used for payout

token
required
string
Enum: "ETH" "MATIC" "USDC" "USDT" "EUR" "USD" "GBP" "AED"

The used token for the purchase

Request samples

Content type
application/json
{
  • "policyUuid": "string",
  • "chain": "ETHEREUM",
  • "nftIds": [
    ],
  • "walletAddress": "string",
  • "token": "ETH"
}

Confirm

Used to confirm a proposal for a policy for an Booking . Data needs to match proposal.

Authorizations:
api_key
header Parameters
X-Brand-Id
string
Request Body schema: application/json
required
required
object
required
object
object

Customer details if available for contact purpose

Responses

Request samples

Content type
application/json
{
  • "proposal": {
    },
  • "purchase": {
    },
  • "customer": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "message": "string"
}

Proposal

Used to ask for a proposal for a policy for a booking.

Authorizations:
api_key
Request Body schema: application/json
required
Any of
totalValue
required
number

The total value of the purchase

chain
required
string
Enum: "ETHEREUM" "POLYGON"

The used chain for the purchase

nftIds
required
Array of arrays

The NFT ids of the purchase

countryCode
string
Enum: "global" "nl" "be" "de" "gb"

ISO 3166-1 alpha-2 country code. The country code of the buyer. This code is optional for normal NFT, but required for an NFT that is a receipt for a physical product.

checkInDate
required
string

The date of the checkin in ISO 8601 format yyyy-MM-dd

token
required
string
Enum: "ETH" "MATIC" "USDC" "USDT" "EUR" "USD" "GBP" "AED"

The used token for the purchase

Responses

Request samples

Content type
application/json
{
  • "totalValue": 0,
  • "chain": "ETHEREUM",
  • "nftIds": [ ],
  • "countryCode": "global",
  • "checkInDate": "string",
  • "token": "ETH"
}

Response samples

Content type
application/json
{
  • "totalValue": 0,
  • "duration": 0,
  • "policyPercentage": 0,
  • "policyTermsUrl": "string",
  • "policyPrice": 0,
  • "id": "string",
  • "coveragePercentage": 0,
  • "policyLogoUrl": "string",
  • "avataLogoUrl": "string"
}

Digital Assets (web2.0)

Digital Assets flow sequence diagram

Digital Assets sequence diagram

Proposal

Used to ask for a proposal for a policy for an NFT.

Authorizations:
api_key
header Parameters
X-Brand-Id
string
Request Body schema: application/json
required
totalValue
required
number

The total value of the purchase

countryCode
required
string
Enum: "global" "nl" "be" "de" "gb"

ISO 3166-1 alpha-2 country code

currencyCode
required
string
Value: "eur"

ISO 4217 alpha currency code

Responses

Request samples

Content type
application/json
{
  • "totalValue": 0,
  • "countryCode": "global",
  • "currencyCode": "eur"
}

Response samples

Content type
application/json
{
  • "totalValue": 0,
  • "policyPercentage": 0,
  • "policyTermsUrl": "string",
  • "policyPrice": 0,
  • "id": "string",
  • "policyLogoUrl": "string",
  • "avataLogoUrl": "string"
}

Confirm

Used to confirm a proposal for a policy for an digital-asset. Data needs to match proposal.

Authorizations:
api_key
header Parameters
X-Brand-Id
string
Request Body schema: application/json
required
required
object
required
object
required
object

Responses

Request samples

Content type
application/json
{
  • "proposal": {
    },
  • "purchase": {
    },
  • "customer": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "message": "string"
}

Policy Request

This section describes the different calls that can be made for policy requests

Policy Request Status

Used to ask for a update of the policy request status

Authorizations:
api_key
Request Body schema: application/json
required
uuid
required
string

The unique id of the policy request

Responses

Request samples

Content type
application/json
{
  • "uuid": "string"
}

Response samples

Content type
application/json
{
  • "eventType": "string",
  • "body": {
    }
}

Authenticate

This section describes the authentication process and calls. The authentication process consists of two steps.

  • Step one is requesting a nonce. The nonce can be used to sign the authentication request.
  • Step two is requesting authentication which responds with a JWT authentication token.


Authenticate flow sequence diagram

Authenticate flow sequence diagram

The authentication JWT token is required for the Policy and Claim requests. For these requests also the API key is required.

Authenticate

Used to ask an authentication token. The JWT Bearer token can be used access the API requests.

Authorizations:
api_key
Request Body schema: application/json
required
signature
required
string

The signature of the signed nonce with the wallet public key.

chainId
required
number

The chain id of the connected network chain.

publicKey
required
string

The public key of the wallet of the user.

Responses

Request samples

Content type
application/json
{
  • "signature": "string",
  • "chainId": 0,
  • "publicKey": "string"
}

Response samples

Content type
application/json
{
  • "accessToken": "string"
}

Nonce

Used to ask a nonce to sign authenticate request with. The request is called with two query parameters:

  • publicKey: the public key of the wallet to authenticate with.
  • chainid: the chain ID of the chain to authenticate with. For example 137 for Polygon.

Authorizations:
api_key

Responses

Response samples

Content type
application/json
{
  • "nonce": "string"
}

Policy

This section describes the different calls that can be made for policies.

Policy Details

Used to request details for a policy.

Authorizations:
authorizerapi_key
Request Body schema: application/json
required
uuid
required
string

Required policy uuid.

Responses

Request samples

Content type
application/json
{
  • "uuid": "string"
}

Response samples

Content type
application/json
{
  • "policy": {
    }
}

Policies for wallet address

Used to request policies for a wallet address.

Authorizations:
authorizerapi_key
Request Body schema: application/json
required
wallet
required
string

Required wallet to request policies for.

chainId
required
number

Required chain ID.

Responses

Request samples

Content type
application/json
{
  • "wallet": "string",
  • "chainId": 0
}

Response samples

Content type
application/json
{
  • "policies": [
    ]
}

Claim

This section describes the different calls that can be made for claims.

NOTE: If a policy report will be uploaded this must be done in front of the create claim call. The upload call will respond with a key of the claim document file. This key must be added in the create claim call.

Upload Claim documents

Used to upload required documents for a claim.

Authorizations:
authorizerapi_key
Request Body schema: multipart/form-data
required
policyUuid
required
string <uuid>

Required policy uuid.

required
Array of objects non-empty
publicKey
required
string

The public key of the wallet of the user.

Responses

Response samples

Content type
application/json
{
  • "keys": [
    ],
  • "message": "string"
}

Get Claim Status

Used to get claim status.

Authorizations:
api_key
Request Body schema: application/json
required
policyUuid
required
string <uuid>

Required policy uuid.

Responses

Request samples

Content type
application/json
{
  • "policyUuid": "0bc4470f-d4c3-4d35-b760-d2a4163c98fa"
}

Response samples

Content type
application/json
{
  • "claim": {
    }
}

Create Claim

Used to create a claim on a policy.

Authorizations:
authorizerapi_key
Request Body schema: application/json
required
reason
required
string

The reason of the claim

policyUuid
required
string

Required policy uuid.

required
Array of objects non-empty
email
required
string <email>

Email address of the claimer

Responses

Request samples

Content type
application/json
{
  • "reason": "string",
  • "policyUuid": "string",
  • "files": [
    ],
  • "email": "user@example.com"
}

Response samples

Content type
application/json
{
  • "claim": {
    }
}

KYC

This section describes the different calls that can be made for KYC.

KYC

Used to send KYC info to.

Authorizations:
api_key
Request Body schema: application/json
required
policyUuid
required
string
provider
required
string
payload
object

Responses

Request samples

Content type
application/json
{
  • "policyUuid": "string",
  • "provider": "string",
  • "payload": { }
}

Response samples

Content type
application/json
{
  • "policyUuid": "string",
  • "provider": "string",
  • "payload": { }
}

Callbacks

The Avata API supports callbacks to the merchant. The callback is triggered when a resource is updated. The callback is triggered with a POST request to the callback URL of the merchant. The body of the request contains a JSON object with the following structure:

Field Type Description
eventType string The type of event that triggered the callback.
body object The body of the event.

The eventType can be one of the following values:

eventType Description
policy-update The policy is updated.
claim-update The claim is updated.

Policy Updates The body of the policy-update event is an object with the following structure:

Field Type Description
status PolicyStatus The status of the policy.
uuid string The uuid of the policy.
reference string The reference of the policy.
details PolicyDetails The details of the policy.

The PolicyDetails object has the following structure:

Field Type Description
policyId string The id of the policy.
policyType string The type of the policy.
startDateTime string The start date and time of the policy.
endDateTime string The end date and time of the policy.

The PolicyStatus object has the following structure:

Field Type Description
CREATED string The policy is created.
PENDING string The policy is pending.
EXPIRED string The policy is expired.
SEND string The policy is send.
ACCEPTED string The policy is accepted.
REJECTED string The policy is rejected.
ERROR string The policy has an error.
RETRYING string The policy is retrying.

The following example shows the body of a policy-update callback request:

{
  "eventType": "policy-update",
  "body": {
    "status": "APPROVED",
    "uuid": "d7b9f5b0-4b4b-11eb-ae93-0242ac130002",
    "reference": "1234567890",
    "details": {
      "policyId": "1234567890",
      "policyType": "DIGITAL_ASSET",
      "startDateTime": "2021-01-01T00:00:00.000Z",
      "endDateTime": "2021-01-02T00:00:00.000Z"
    }
  }
}

Claim Updates

The body of the claim-update event is an object with the following structure:

Field Type Description
status ClaimStatus The status of the claim.
uuid string The uuid of the claim.
policyUuid string The uuid of the policy.
details ClaimDetails The details of the claim.

The ClaimDetails object has the following structure:

Field Type Description
claimId string The id of the claim.

The ClaimStatus object has the following structure:

Field Type Description
CREATED string The claim is created.
PENDING string The claim is pending.
REPORTED string The claim is reported.
REVIEWED string The claim is reviewed.
REJECTED string The claim is rejected.
APPROVED string The claim is approved.

Callback request example

The following example shows the body of a claim-update callback request:

{
  "eventType": "claim-update",
  "body": {
    "status": "APPROVED",
    "uuid": "d7b9f5b0-4b4b-11eb-ae93-0242ac130002",
    "policyUuid": "d7b9f5b0-4b4b-11eb-ae93-0242ac130002",
    "details": {
      "claimId": "1234567890"
    }
  }
}

Customer portal

Merchant Claim Page Guide

To direct your clients to the Merchant Claim Page, you need to construct a specific URL that includes necessary parameters. The structure of the URL is as follows:

https://portal.avata.gg/merchant-claim/{policyUuid}/{signedPolicyUuid}

In this URL:

  • {policyUuid} should be replaced with the specific policy UUID you want the client to access.
  • {signedPolicyUuid} should be replaced with a message that includes the policyUuid, signed with the private key of the owner's wallet.

Understand the Parameters

Detailed information about the parameters in the URL:

  1. policyUuid

    This is a unique identifier assigned to each policy in our system.

  2. signedPolicyUuid

    This is a message encrypted with the private key of the owner's wallet. This message should include the policyUuid. This is a crucial component as it allows us to verify the transaction with the owner's address.

Signing signedPolicyUuid

To generate the signedPolicyUuid, you need to follow the process of signing a message with the private key of the owner's wallet. It involves encrypting the policyUuid with the owner's private key. An example in Node.js:

var ethers = require('ethers');

const wallet = new ethers.Wallet.createRandom();

const message = "policyUuid";
const signature = await wallet.signMessage(message);

Merchant Claim Page Guide

To direct your clients to the Merchant Claim Page, you need to construct a specific URL that includes necessary parameters. The structure of the URL is as follows:

https://portal.avata.gg/merchant-claim/{policyUuid}/{signedPolicyUuid}

In this URL:

  • {policyUuid} should be replaced with the specific policy UUID you want the client to access.
  • {signedPolicyUuid} should be replaced with a message that includes the policyUuid, signed with the private key of the owner's wallet.

Understand the Parameters

Detailed information about the parameters in the URL:

  1. policyUuid

    This is a unique identifier assigned to each policy in our system.

  2. signedPolicyUuid

    This is a message encrypted with the private key of the owner's wallet. This message should include the policyUuid. This is a crucial component as it allows us to verify the transaction with the owner's address.

Signing signedPolicyUuid

To generate the signedPolicyUuid, you need to follow the process of signing a message with the private key of the owner's wallet. It involves encrypting the policyUuid with the owner's private key. An example in Node.js:

var ethers = require('ethers');

const wallet = new ethers.Wallet.createRandom();

const message = "policyUuid";
const signature = await wallet.signMessage(message);