---
description: This document will go over how to add an OptOut using our API.
---

# Add an OptOut

### <mark style="color:green;">`POST`</mark> `addressbook/optout`

Create an Opt-Out in our system.&#x20;

{% tabs %}
{% tab title="Curl" %}
```hsts
curl -X POST \
"https://api.mobivatebulksms.com/addressbook/optout" \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer [API Key]' \
-d '{ "mobile": "440011122233" }'
```
{% endtab %}

{% tab title="Python" %}
```python
import requests

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer [API Key]',
}

json_data = {
    'mobile': '440011122233',
}

response = requests.post('https://api.mobivatebulksms.com/addressbook/optout', headers=headers, json=json_data)

# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{ "mobile": "440011122233" }'
#response = requests.post('https://api.mobivatebulksms.com/addressbook/optout', headers=headers, data=data)
```
{% endtab %}
{% endtabs %}

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer [API Key]` |

**Body**

<table><thead><tr><th>Name</th><th width="131">Type</th><th width="111">Required?</th><th>Description</th></tr></thead><tbody><tr><td>mobile</td><td>string</td><td>Yes</td><td>Mobile number to add to Optout list.</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}
```json
{
   "mobile":"440011122233",
   "note":"API",
   "created":1690783496000
}
```
{% endtab %}

{% tab title="400" %}
```json
{
   "code":400,
   "message":"Invalid mobile number"
}
```
{% endtab %}

{% tab title="401" %}
```json
{
   "code":401,
   "message":"Unauthorized"
}
```
{% endtab %}
{% endtabs %}

We use conventional HTTP response codes to indicate the success or failure of an API request. In general:

**2xx** indicate success\
**4xx** indicate an error that failed given the information provided (e.g., a required parameter was omitted)\
**5xx** errors indicate an error with ours servers (these are rare).

To see a full list of our **Response codes**, please [click here](../authentication-and-integration/understanding-response-codes).
