Andare direttamente al contenuto

Chapka Assicurazioni viaggio

API - reference manual

 

What is the "QUOTE API"?

The QUOTE API is used to get a price for an insurance.

As input paramet- ers you should provide:

The API will reply with the insurance price.

 

What is the "NOTIFY API"?

The NOTIFY API shall be used to send us an insurance that's just been sold.

Same input parameters as above:

And more:

The API will reply to confirm that the insurance has been registered.

 

How do I send a request?

You need the API URL (e.g. https://api.chapka.fr/quote/index.php?request=quote for the QUOTE API).

Most requests are made using the POST method.

The parameters are gathered in a JSON structure, that is sent as a "raw payload" of the POST request. Alternatively, the JSON can be sent in a "form data", into a variable named "message". Both will give the same result.

 

What is the JSON like?

Here is some simple example:

{
    "SENDER" : "AGENCE-XYZ",
    "SIGN" : "123abc456def789...",


    "PRODUCT" : "CAP-EXPLORER",
    "DEPART" : "15/10/2024",
    "RETOUR" : "20/10/2024",
    …

    "REFERENCE" : "REF-123",
    "PREMIUM" : "340.00",
    "EMAIL" : "joe@mail.com",

    …
}

 

First two parameters (SENDER and SIGN) are the authentication parameters.

They are necessary for QUOTE API as well as NOTIFY API.

 

Second group (PRODUCT, ...) are the insured item characteristics (PRODUCT is the chosen insurance product, and others are things like start date, end date, destination, ...).

They are necessary for QUOTE API as well as NOTIFY API.

 

Third group (REFERENCE, EMAIL, ...) are meant for the NOTIFY API only.

 

Authentication

SENDER is your login ID. Thus, this is a fixed value, something like "MY-COMPANY": Chapka will provide this value.

SIGN is a cryptographic signature. To compute the signature, you need two things: the JSON and a secret key provided by Chapka.

 

Here is how you compute the signature:

 

Step 1: get the JSON parameter labels and sort them in ascending order (but do not include "SIGN").

In the prior example, the labels are: SENDER, PRODUCT, DEPART, RETOUR, REFERENCE, PREMIUM, EMAIL.

In ascending order you get: DEPART, EMAIL, PREMIUM, PRODUCT, REFERENCE, RETOUR, SENDER.

 

Step 2: concatenate the values in the order of sorted labels (do not include any separator).

In the prior example, you'll get a string like: "15/10/2024joe@mail.com340.00CAP-EXPLORERREF-12320/10/2024AGENCE-XYZ".

 

Step 3: add up the secret key.

This will lead to a longer string: "15/10/2024joe@mail.com340.00CAP-EXPLORERREF-12320/10/2024AGENCE-XYZ1a2b3c4d5e6f..."

(key is colored in red).

 

Step 4: compute the SHA1 of this string.

The result is the signature that shall be put into "SIGN" parameter.

NOTE: SHA1 produces a 160 bits string, which leads to a 20 bytes string, which results into a 40 characters string. Hence, leading zeros, if they exist, shall not be destroyed!!!

 

QUOTE API

The QUOTE API URL is:

https://api.chapka.fr/quote/?request=quote

Payload example:

{
    "SENDER":"MY-COMPANY",
    "SIGN":"123abc456def789...",
    "PRODUCT":"CAP-EXPLORER",
    "NOMBRE":2,
    "DEPART":"01/04/2024",
    "RETOUR":"30/04/2024",
    "FORMULE":"AS",
    "PROVENANCE":"FR",
    "DESTINATION":"US,CA"
}

The QUOTE API will give three types of response:

The HTTP status code will be 400.

The HTTP text response will be a JSON like:

{
    "status": "KO",
    "err": "Missing signature 'SIGN'"
}
  • There is a pricing issue (e.g. departure date is in the past, destination is forbidden, ...);

The HTTP status code will be 200.

The HTTP text reponse will be a JSON like:

{

    "status": "KO",
    "err": "#DATES"
}
  • The pricing is successful;

The HTTP status code will be 200.

The HTTP text response will be a JSON like:

{
    "status": "OK",
    "premium": "90.00",
    "currency": "EUR",
    "cg_url": "https://www.chapkadirect.fr/open.php?file=doc&idpro=824&type=cg1&langue=fr",
    "cs_url": "https://www.chapkadirect.fr/open.php?file=doc&idpro=824&type=cs&langue=fr",
    "ipid_url": "https://www.chapkadirect.fr/open.php?file=doc&idpro=824&type=ipid1&langue=fr"
}

 

QUOTE API - other functionalities

This URL can also be used:

https://api.chapka.fr/quote/?request=product

 

With payload:

{
    "SENDER":"MY-COMPANY",
    "SIGN":"123abc456def789...",
}

This will list all available product codes.

Example:

{
    "status": "OK",
    "products": [
        "CAP-EXPLORER",
        "CAP-STUDENT"
    ]
}

And with payload:

{
    "SENDER":"MY-COMPANY",
    "PRODUCT":"CAP-EXPLORER",
    "SIGN":"123abc456def789...",
}

This will list parameters to be provided for quote.

Example:

{
    "status": "OK",
    "params": [
        "NOMBRE=NBR",
        "DEPART=DATE",
        "RETOUR=DATE",
        "FORMULE=OPTION(AN,AS,CB,MR)",
        "DATE_RESA=DATE",
        "MONTANTS=AMOUNT(i)",
        "MONTANT_TOTAL=AMOUNT",
        "PROVENANCE=COUNTRY",
        "DESTINATION=COUNTRIES",
        "SAR=OPTION(N,O)"
    ]
}

Note that not all parameters are necessary to get a quote.

Examples:

 

QUOTE API for affiliates

Affiliates are not selling the insurance. They can quote, but customers will buy on Chapka's website.

To quote, an affiliate shall:

Example:

{
    "affiliate":"<code here>",
    "language":"es",
    "product":"CAPTRIP+",
    "nombre":"1",
    "depart":"01/05/2024",
    "retour":"20/05/2024",
    "provenance":"ES",
    "destination":"DE",
    "formule":"P",
    "annulation":"N"
}

The response will likely be:

{
    "status": "OK",
    "premium": "54.80",
    "currency": "EUR",
    "quote_url": "https://www.chapkadirect.es/index.php?action=sous&id=877&app=<code here>&...",
    "product_url": "https://www.chapkadirect.es/index.php?action=produit&id=877&app=<code here>",
    "cg_url": "https://www.chapkadirect.es/open.php?file=doc&idpro=877&type=cg1&langue=es",
    "cs_url": "https://www.chapkadirect.es/open.php?file=doc&idpro=877&type=cs&langue=es",
    "ipid_url": "https://www.chapkadirect.es/open.php?file=doc&idpro=877&type=ipid1&langue=es"
}
Note that it adss two extra parameters:
  • "quote_url" will lead to the relevant quote on Chapka's website.
  • "product_url" will lead to the product page on Chapka's website.

 

NOTIFY API

The NOTIFY API offers multiple transactions:

Create

Sample payload:

{
    "SENDER":"MY-COMPANY",
    "SIGN":"123abc456def789...",
    "PRODUCT":"CAP-EXPLORER",
    "NOMBRE":2,
    "DEPART":"01/04/2024",
    "RETOUR":"30/04/2024",
    "FORMULE":"AS",
    "PROVENANCE":"FR",
    "DESTINATION":"US,CA",
    "REFERENCE":"REF-123",
    "EMAIL":"joe@mail.com",
    "PREMIUM":"90.00",
    "GENRE1":"Mr",
    "PRENOM1":"John",
    "NOM1":"Rambo",
    "GENRE2":"Miss",
    "PRENOM2":"Sarah",
    "NOM2":"Connor"
}

Note: there are as many "GENREi", "PRENOMi", "NOMi", as indicated by "NOMBRE".

Typical reply (when no error is reported) will be:

{
    "id":12415,
    "status":200,
    "msg":"successfully created"
}

 

Note 1: that "id" is a unique number refering to the message received. This is not the created policy number.

Should you need to get the insurance policy details (e.g. the URL to download the insurance documents), you might want to look into the webhook paragraph, below.

 

Note 2: NOTIFY is a notification protocol. Should you receive a failure, a loss of connection, a timeout, ... be aware that your message probably hasn't been received. Thus your system should handle a retry queue, in order to retry some moments later.

 

NOTIFY - Webhook

When calling the "create" transaction, you are being returned a simple confirmation along with an ID that is the confirmation that your request has been received.

But should you need to get some more information, like the policy number or the URL leading to the insurance policy documents, then you might want to request Chapka to setup a webhook.

The webhook is a URL in your platform, that Chapka will call everytime a policy is created. The call transports a couple parameters (policy number, document URL, ...). 

 

Product specific information

Find below some products and the requested JSON parameters.

 

Parameters for product CAP EXPLORER

CAP EXPLORER is a general travel insurance product, gathering multiple covers.

For product cover details and pricing, please see here.

The parameter "PRODUCT" (or "PRODUIT") will have the following value: "CAP-EXPLORER".

Below are the product specific parameters:

 

Parameter name Example Meaning
DEPART 01/02/2021 Departure date (format dd/mm/yyyy)
RETOUR 15/02/2021 Return date (format dd/mm/yyyy)
FORMULE MR

AN=Annulation seule (Cancellation only)

MR=MultiRisque (Comprehensive)

CB=Complémentaire carte Bancaire (French card holder only)

AS=ASsistance seule (Assistance only)

PROVENANCE FR

Country of origin ISO code (2 characters; FR=France, ES=Spain, IT=Italy, etc.)

DESTINATION US,CA

Country of destination ISO code(s). When multiple destinations, use a comma.

MONTANTi 1234.56

Booking amount for insured i (currency is EUR).

For i ranging from 1 to the number of insured (see common parameters).

 

Parameters for product TRANQUILOC

TRANQUILOC has been advised to you if you offer appartments or villas for rent.

For product cover details and pricing, please see here.

The parameter "PRODUCT" (or "PRODUIT") will have the following value: "TRANQUILOC".

Below are the product specific parameters:

 

Parameter name Example Meaning
NUMPAX 4

Total number of participants.

Idealy, NUMPAX=NUMBER, meaning all participants are listed.

But, should you have only one name, then: NUMBER=1, hence only one insured name is listed (TITLE1, FIRSTNAME1, LASTNAME1), but NUMPAX gives the total number of participants.

ARRIVEE 01/02/2021 Date of arrival of guests (format dd/mm/yyyy)
DEPART 15/02/2021 Date of departure of guests (format dd/mm/yyyy)
DATE_RESA 28/11/2020

Date of booking (format dd/mm/yyyy)

FORMULE 1

1=Annulation seule (Cancellation only)

2=MultiRisque (Comprehensive)

MONTANT 1234.56

Total amount of rent (currency is EUR).

PROVENANCE FR

Country of origin ISO code (2 characters; FR=France, ES=Spain, IT=Italy, etc.)

DESTINATION IT

Country of destination ISO code.

 

Parameters for product CAP ANNULATION

CAP ANNULATION is a cancellation only insurance.

The product specific parameters are:

Parameter name Example Meaning
DATE_RESA 31/12/2021 Booking date (format dd/mm/yyyy)
DEPART 05/03/2022 Departure date (...)
RETOUR 31/03/2022 Return date (...)
PROVENANCE FR Country of origin
DESTINATION TZ Country of destination
MONTANTi 1234.56 Amount for pax i. Present for each pax.