# Analytics API Endpoint

{% hint style="info" %}
If you have been provided with a staging key, you must use the staging Base URL for API Endpoints: <https://staging.comparocms.com/api>
{% endhint %}

{% hint style="info" %}
Base URL for API Endpoints: <https://comparocms.com/api>
{% endhint %}

{% hint style="danger" %}
It's your responsibility to secure the token shared by the API team, using it publically allows anyone to access and make requests on behalf of you for the service.
{% endhint %}

{% hint style="warning" %}
For token related queries, contact your Comparo Media partner or send an email to <ps@comparo-media.com>.
{% endhint %}

## Flow: MSIDN INSERT / PIN SUBMIT

<mark style="color:green;">`POST`</mark> `/analytics`

MSIDN Insert flow for NTH / PIN Submit flow for NTH

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

<table data-full-width="false"><thead><tr><th width="193">Name</th><th width="104" data-type="checkbox">Required</th><th width="100">Type</th><th width="167">Example</th><th>Description</th></tr></thead><tbody><tr><td><code>mobile_number</code></td><td>true</td><td><code>string</code></td><td></td><td>Mobile number / MSIDN of the user, required for MSIDN INSERT flow / Pin submit flow. Prefix mobile number with: 00{country_code_without_+_symbol}</td></tr><tr><td><code>aff_parameters</code></td><td>false</td><td><code>object</code></td><td></td><td>Object with clickid and trackid details, passed as-is to ABO Manager, optional</td></tr><tr><td><code>aff_parameters.clickid</code></td><td>false</td><td><code>string</code></td><td><code>123456</code></td><td>Click ID, passed to ABO Manager as-is</td></tr><tr><td><code>aff_parameters.trid</code></td><td>false</td><td><code>string</code></td><td><code>123456</code></td><td>Track ID, passed to ABO Manager as-is</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}
{% code title="Successful request" overflow="wrap" lineNumbers="true" %}

```json
{
    "responseStatus": "200",
    "message": "6HT",
    "opportunityEndUserId": "144370666",
    "page_next": "INFO"
}
```

{% endcode %}
{% endtab %}

{% tab title="400" %}
{% code title="Missing Mobile Number" overflow="wrap" lineNumbers="true" %}

```json
{
    "status": false,
    "message": "Please add Mobile Number"
}
```

{% endcode %}
{% endtab %}

{% tab title="401" %}
{% code title="Missing Auth Token" overflow="wrap" lineNumbers="true" %}

```json
{
    "status": false,
    "message": "HTTP/1.0 401 Unauthorized. Token not found in request."
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Flow: Click 2 SMS

<mark style="color:green;">`POST`</mark> `/analytics`

Click 2 SMS flow for NTH

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

<table data-full-width="false"><thead><tr><th width="192">Name</th><th width="104" data-type="checkbox">Required</th><th width="100">Type</th><th width="167">Example</th><th>Description</th></tr></thead><tbody><tr><td><code>aff_parameters</code></td><td>false</td><td><code>object</code></td><td></td><td>Object with clickid and trackid details, passed as-is to ABO Manager, optional</td></tr><tr><td><code>aff_parameters.clickid</code></td><td>false</td><td><code>string</code></td><td><code>123456</code></td><td>Click ID, passed to ABO Manager as-is</td></tr><tr><td><code>aff_parameters.trid</code></td><td>false</td><td><code>string</code></td><td><code>123456</code></td><td>Track ID, passed to ABO Manager as-is</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}
{% code title="Successful request" overflow="wrap" lineNumbers="true" %}

```json
{
    "responseStatus": "200",
    "sms_code": "6HT",
    "opportunityEndUserId": "144370666",
    "page_next": "INFO",
    "KW": "FRT",
    "SHID": "860860"
}
```

{% endcode %}
{% endtab %}

{% tab title="401" %}
{% code title="Missing Auth Token" overflow="wrap" lineNumbers="true" %}

```json
{
    "status": false,
    "message": "HTTP/1.0 401 Unauthorized. Token not found in request."
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Flow:  Verify Pin

<mark style="color:green;">`POST`</mark> `/pin_verify`

Verify the pin with MSISDN

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

<table><thead><tr><th width="191">Name</th><th width="109" data-type="checkbox">Required</th><th width="104">Type</th><th>Example</th><th>Description</th></tr></thead><tbody><tr><td><code>mobile_number</code></td><td>true</td><td><code>string</code></td><td></td><td>Mobile number / MSIDN of the user, required for MSIDN INSERT flow / Pin submit flow. Prefix mobile number with: 00{country_code_without_+_symbol}</td></tr><tr><td><code>pin</code></td><td>true</td><td><code>string</code></td><td></td><td>Pin to verify the MSISDN.</td></tr><tr><td><code>opportunityEndUserId</code></td><td>true</td><td><code>number</code></td><td></td><td>The number that you get in the first API response.</td></tr><tr><td><code>aff_parameters</code></td><td>false</td><td><code>object</code></td><td></td><td>Object with clickid and trackid details, passed as-is to ABO Manager, optional</td></tr><tr><td><code>aff_parameters.clickid</code></td><td>false</td><td><code>string</code></td><td>123456</td><td>Click ID, passed to ABO Manager as-is</td></tr><tr><td><code>aff_parameters.trid</code></td><td>false</td><td><code>string</code></td><td><code>123456</code></td><td>Track ID, passed to ABO Manager as-is</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "responseStatus": "200",
    "message": "6HT",
    "opportunityEndUserId": "144370666",
    "page_next": "INFO"
}
```

{% endtab %}

{% tab title="401" %}

```json
{
    "status": false,
    "message": "HTTP/1.0 401 Unauthorized. Token not found in request."
}
```

{% endtab %}
{% endtabs %}
