# Network Double Opt-in (NDOI)

### <mark style="color:green;">`GET`</mark> `/api/doi/<account_id>/<api_key>/`

Initiate a network DOI subscription.&#x20;

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

```hsts
curl -XGET -H "Content-type: application/json" 'https://hostname/api/doi/<account_id>/<api_key>/?source=<shortcode>&destination=<msisdn>&keyword=<kw>&frequency=7&amount=100&campaign=Test&provider=<networkprovider>&reference=<your internal reference>'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

headers = {
    'Content-type': 'application/json',
}

response = requests.get(
    'https://hostname/api/doi/<account_id>/<api_key>/?source=<shortcode>&destination=<msisdn>&keyword=<kw>&frequency=7&amount=100&campaign=Test&provider=<networkprovider>&reference=<your internal reference>',
    headers=headers,
)
```

{% endtab %}
{% endtabs %}

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `No Auth`          |

**Required Body**

| Parameter   | Type    | Example                          | Description                                           |
| ----------- | ------- | -------------------------------- | ----------------------------------------------------- |
| account\_id | string  | 43e36f50aaf111e272639171000000a9 | Your unique Mobivate account id.                      |
| api\_key    | string  | 3b41d767316541bacef19d1382ac1e12 | Your unique associated Mobivate account api-key.      |
| source      | integer | 12345                            | The associated shortcode for your service.            |
| destination | integer | XX7432104492                     | The recipient you want to send this message to.       |
| keyword     | string  | mv-100620006                     | Your unique Mobivate keyword for your service.        |
| amount      | integer | 10                               | The amount your message will be billed for receiving. |
| reference   | string  | ABC1234                          | Your internal unique reference.                       |
| provider    | string  | safaricom                        | The network provider this message will be sent via.   |

**Optional Body**

| Parameter | Type    | Example                          | Description                                                 |
| --------- | ------- | -------------------------------- | ----------------------------------------------------------- |
| campaign  | string  | 87e36f50aaf113e272629971000000a3 | Your unique Mobivate campaign id.                           |
| frequency | integer | 7                                | Billing frequency, in this case 7 is weekly.                |
| stop      | string  | stop                             | To indicate a user is being unsubscribed from your service. |

**Response**

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

```json
{
  "200": "MT-c65561314eb34088b6df42d8241aace0"
}
```

{% endtab %}

{% tab title="541" %}

```json
{
  "error": "541"
}
```

{% endtab %}
{% endtabs %}

### Asynchronous Final Notification <a href="#asynchronous_final_notification" id="asynchronous_final_notification"></a>

Asynchronous final notification will be delivered to your standard DR Path with codes:

<table><thead><tr><th width="141">Code</th><th>Description</th><th>Your action</th></tr></thead><tbody><tr><td>540</td><td>DOI Confirmed by user</td><td>Continue with the subscription (ie. send welcome messages and content)</td></tr><tr><td>541</td><td>Message delayed while waiting for DOI</td><td>Existing NDOI exists. Please hold before retrying</td></tr><tr><td>542</td><td>Message rejected due to DOI</td><td>The user has not confirmed the NDOI yet. Please wait before retrying.</td></tr><tr><td>543</td><td>DOI Unconfirmed / Awaiting user action</td><td>The user has not confirmed the NDOI yet. Please wait before retrying.</td></tr><tr><td>544</td><td>DOI Declined by user</td><td>The user declined NDOI. You should wait for the user to initiate a request again.</td></tr><tr><td>545</td><td>DOI Failed</td><td>Network DOI failed. Try again or contact Mobivate support to investigate further.</td></tr></tbody></table>

{% hint style="info" %}
For a full list of response codes, please [click here](https://gateway.mobivate.com/response_codes/).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.mobivate.com/network-double-opt-in/network-double-opt-in-ndoi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
