# Documentations

\
Send Message to Recipient
-------------------------

<mark style="color:green;">`POST`</mark> `https://outbox.rest/send/message`

Service to be used to send messages to members.

#### Headers

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| Content-Type | string | `application/json` |

#### Request Body

| Name        | Type    | Description                                                                                                                                                                                                         |
| ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Unique      | string  | OFF / ON  (default = ON)                                                                                                                                                                                            |
| Recipients  | array   | <p><code>"Recipients":\[</code><br><code>{     "Recipient": "+90555xxxx",</code> <br>        <code>"Content": "Merhaba /*AD*/ ,</code> <br>     <code>"Variables": { "AD": "Test" }</code><br> <code>},]</code></p> |
| MessageID   | string  | Campaign number defined in our system                                                                                                                                                                               |
| When        | string  | Sent on a spesific date Ex."2045-12-21 23:59:59"                                                                                                                                                                    |
| Priority    | string  | NORMAL/FAST/TEST/SIMULATION                                                                                                                                                                                         |
| SendAlwyays | integer | 0/1/2                                                                                                                                                                                                               |
| MessageType | string  | SMS/MMS/EMAIL                                                                                                                                                                                                       |
| AuthKey     | string  | Authentication token for using API                                                                                                                                                                                  |

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

```javascript
{
    "result": [
        {
            "Recipient": "+90555xxxxxxxx",
            "TrackingID": "52ad371d92ce420b8f7efc567748684c"
        },
        {
            "Recipient": "+90555xxxxxxxxx",
            "TrackingID": "28bb7d67d5b6443288e0b5cfc0598b84"
        }
    ],
    "status": {
        "Accepted": 2,
        "Length": 2
    }
}
```

{% endtab %}

{% tab title="403 " %}

```javascript
{"message": "Invalid Auth Key"}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{"message": "Invalid Message Content"}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}

{% endhint %}

| ***Recipients*** |                                                                                                                                                            |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Reference        | You may use tour own single and unique tracking id you generate for each message, and you may follow delivery results with your won tracking id            |
| Attachment       | <p><em>Allowed types</em></p><ul><li>MMS: 3GP, PDF, CSV, DOC, XLS, TXT, MP3, MP4, ICS</li><li>EMAIL: PPT</li><li>IMAGE: JPG, JPEG, GIF, BMP, PNG</li></ul> |
| Variables        | Variables for dynamic contents                                                                                                                             |

| ***Priority*** |   | <ul><li>NORMAL</li><li>FAST: Deliver fast, prioritize delivery</li><li>TEST: Treat message as a test message and update   CDN and source files</li><li>SIMULATION : Send message as simulation</li></ul> |
| -------------- | - | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

| ***SendAlways*** | <p></p><ul><li>0: Obey activity filters defined in the system</li><li>1: Send normal, skip activity filters</li><li>2: Force to send</li></ul> |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |

| *Unique* | **In the same time zone, sending messages to the same person is blocked by the system. You can change it with Unique Key.** |
| -------- | --------------------------------------------------------------------------------------------------------------------------- |
| *ON*     | Enabled                                                                                                                     |
| OFF      | Disabled                                                                                                                    |
| Default  | Enabled                                                                                                                     |

###

####

##

{% tabs %}
{% tab title="Send Message Javascript/AJAX example" %}

```javascript
var responseData = {
    "AuthKey": "**********************",
    "MessageType": "SMS",
    "Recipients": [
        {
            "Recipient": "+905326124837",
            "Content": "Merhaba /*Ad*/",
            "Variables": {
                "Ad": "Aycan"
            }
        },
        {
            "Recipient": "+905398836180",
            "Content": "Merhaba /*Ad*/",
            "Variables": {
                "Ad": "Abdullah"
            }
        }
    ],
    "SendAlways": 2,
    "Priority": "FAST",
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://outbox.rest/send/message",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
  },
  "processData": false,
  "data": JSON.stringify(responseData)
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

## Get Status  of Sent Message

<mark style="color:green;">`POST`</mark> `https://outbox.rest/get/status`

Service to query the status of a sent message on a member basis.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name       | Type   | Description                                                |
| ---------- | ------ | ---------------------------------------------------------- |
| TrackingID | string | The person-based TrackingID number after sending a message |
| Language   | string | EN/TR                                                      |
| AuthKey    | string | Authentication token for using API                         |

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

```javascript
{
    "Code": 0,
    "Recipient": "90555xxxx",
    "Status": "Success"
}
```

{% endtab %}

{% tab title="403 " %}

```javascript
{"message": "Invalid Auth Key"}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{"message": "Invalid Request Body"}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}

{% endhint %}

| ***Language*** | Determine language of the result. |
| -------------- | --------------------------------- |

{% tabs %}
{% tab title="Get Status Javascript/AJAX example" %}

```javascript
var responseData = {
  "AuthKey": "***********************",
  "Language": "EN",
  "TrackingID": "********************"
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://outbox.rest/get/status",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
  },
  "processData": false,
  "data": JSON.stringify(responseData)
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

## Create Group

<mark style="color:green;">`POST`</mark> `https://outbox.rest/create/group`

Service used to create groups/list .

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name      | Type   | Description                                   |
| --------- | ------ | --------------------------------------------- |
| AutheKey  | string | Authentication token for using API            |
| GroupName | string | The given name will be used as the group name |

{% tabs %}
{% tab title="200 Group Successful created." %}

```javascript
{
    "GroupID": 12345,
    "status":200
}
```

{% endtab %}

{% tab title="400 " %}

```java
{
    "status": 400,
    "message": "GroupName not found or invalid"
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
    "status": 403,
    "message": "Invalid Auth Key"
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
    "result": 500, 
    "message": "Invalid Request Body"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Create Group Javascript/AJAX example" %}

```javascript
var responseData = {
  "AuthKey": "***********************",
  "GroupName": "test group-1"
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://outbox.rest/create/group",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
  },
  "processData": false,
  "data": JSON.stringify(responseData)
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

## Group Info

<mark style="color:green;">`POST`</mark> `https://outbox.rest/info/group`

Service used to get information about  the group/list.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name    | Type    | Description                        |
| ------- | ------- | ---------------------------------- |
| GroupID | integer | Group ID                           |
| AuthKey | string  | Authentication token for using API |

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

```javascript
{
    "message": [
        {
            "GroupID": 10,
            "GroupName": "Abdullah",
            "noofactivecontacts": 0,
            "noofcontacts": 3,
            "noofcontactsblocked": 0,
            "noofcontactsbounced": 0,
            "noofcontactsclicking": 0,
            "noofcontactscomplained": 1,
            "noofcontactsspamblocked": 0,
            "noofcontactsspamtraphits": 0,
            "noofmyactivecontacts": 0,
            "noofmycontactsclicking": 0
        }
    ],
    "status": "OK"
}
```

{% endtab %}

{% tab title="403 " %}

```java
{
    "status": 403, 
    "message": "Invalid Auth Key"
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
    "status": 404, 
    "message": "GroupID must be contain in post data"
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
    "status": 500, 
    "message": "Invalid Request Body"
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Group  Info Javascript/AJAX example" %}

```javascript
var responseData = {
  "AuthKey": "***********************",
  "GroupID":"10"
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://outbox.rest/info/group",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
  },
  "processData": false,
  "data": JSON.stringify(responseData)
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

## Add Recipient to Group

<mark style="color:green;">`POST`</mark> `https://outbox.rest/add/group/recipient`

Service used to add members to any group/list.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name         | Type    | Description                                                                                                                                                                                                                                                                                                                                                                    |
| ------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| WaitResponse | boolean | Wait for Response (default = True)                                                                                                                                                                                                                                                                                                                                             |
| Recipients   | array   | <p><strong><code>example:</code></strong><br><strong><code>\[</code></strong> <br> <strong><code>{</code></strong> <br> <strong><code>"EMail": "<test@test.com>",</code></strong> <br> <strong><code>"GSMTel1": "5555555555"</code></strong> <br> <strong><code>}</code></strong><br><strong><code>]</code></strong><br><strong><code>\*Email is required.</code></strong></p> |
| GroupID      | integer | The given ID will be used as the group ID                                                                                                                                                                                                                                                                                                                                      |
| AuthKey      | string  | Authentication token for using API                                                                                                                                                                                                                                                                                                                                             |

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

```javascript
{
    "message": [
         {
            "ContactNo": 1234,
            "GroupID": 1234,
            "recipient": "test1@test.com"
        },
         {
            "ContactNo": 1234,
            "GroupID": 1234,
            "recipient": "test2@test.com"
        },
    ],
    "status": "OK"
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
    "status": "Error",
    "message": "Invalid Token / Group ID not exist"
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
    "status": "Error",
    "message": "Error Message"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}

{% endhint %}

| Recipient |                                                                          |
| --------- | ------------------------------------------------------------------------ |
| Permit    | Used to specify permissions for adding contacts to a group. \*\*Optional |

{% tabs %}
{% tab title="Add Recipient Javascript/AJAX example" %}

```javascript
var responseData = {
    "AuthKey": "**********************",
    "GroupID": 15,
    "Recipients": [
        {
            "EMail": "aa@gmail.com",
            "GSMTel1": "5011231231",
            "FirstName": "adad",
            "LastName": "adasdasd",
            "DateOfBirth": "1900-01-01",
            "City": "",
            "Gender": "0",
            "Permit": {
                "Email": true,
                "GSM": false,
                "Push": false
            }
        }
    ]
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://outbox.rest/add/group/recipient",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
  },
  "processData": false,
  "data": JSON.stringify(responseData)
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

\
Remove Recipient From Group
---------------------------

<mark style="color:green;">`POST`</mark> `https://outbox.rest/recipient/update/status`

Service used to remove the member from the group/list.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name      | Type   | Description                                                     |
| --------- | ------ | --------------------------------------------------------------- |
| Type      | string | <p>BLOCK/UNBLOCK/SUBSCRIBE/UNSUBSCRIBE<br>CORRECT/INCORRECT</p> |
| Recipient | string | Person's mail address                                           |
| AuthKey   | string | Authentication token for using API                              |

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

```javascript
{
    "status": "OK"
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
"status": "Error", 
"message": "EMail must be contain / Not found EMail data"
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
"status": "Error", 
"message": "Error Message"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}

{% endhint %}

| Type        |                                                  |
| ----------- | ------------------------------------------------ |
| BLOCK       | Block the recipient from within the group.       |
| UNBLOCK     | Unblock the recipient from within the group.     |
| SUBSCRIBE   | Subscribe the recipient from within the group.   |
| UNSUBSCRIBE | Unsubscribe the recipient from within the group. |
| CORRECT     | Correct the recipient from within the group.     |
| INCORRECT   | Incorrect the recipient from within the group.   |

{% tabs %}
{% tab title="Recipient Update Status Javascript/AJAX example" %}

```javascript
var responseData = {
  "AuthKey": "******************",
  "EMail":"test@krea.digital",
  "Type":"SUBSCRIBE"
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://outbox.rest/recipient/update/status",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
  },
  "processData": false,
  "data": JSON.stringify(responseData)
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

## Send Message to Group

<mark style="color:green;">`POST`</mark> `https://outbox.rest/send/group/message`

Service used to send message to group/list

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name      | Type    | Description                               |
| --------- | ------- | ----------------------------------------- |
| GroupID   | integer | if not added default group to be selected |
| MessageID | integer | The id of the message from panel          |
| AuthKey   | string  | Authentication token for using API        |

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

```javascript
{
    "result": {
        "OK": "5"
    }
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
    "status": "Error", 
    "message": "GroupID/MessageID must be contain"
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
    "status": "Error", 
    "message": "Error Message"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Send message to group Javascript/AJAX example" %}

```javascript
var responseData = {
    "AuthKey": "**********************",
    "GroupID": 10,
    "MessageID":5
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://outbox.rest/send/group/message",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
  },
  "processData": false,
  "data": JSON.stringify(responseData)
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

## Message Info

<mark style="color:green;">`POST`</mark> `https://outbox.rest/info/message`

Service used to query the status of a sent message.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name       | Type    | Description                                                                        |
| ---------- | ------- | ---------------------------------------------------------------------------------- |
| Details    | boolean | if it is true, the result is a more detailed list. default contains global values. |
| EndDate    | string  | End Date for result ("yyyy-mm-dd")                                                 |
| StartDate  | string  | Start Date for result ("yyyy-mm-dd")                                               |
| SenderName | string  | Sender name                                                                        |
| MessageID  | integer | The id of the previously sent message                                              |
| AuthKey    | string  | Authentication token for using API                                                 |

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

```javascript
{
    "message": [
        {
            "id": 179,
            "lastupdate": "2019-01-08T08:00:00200:00",
            "messageid": 160,
            "noofcontacts": 968,
            "noofcontactsclicked": 53,
            "noofcontactsdeleted": 0,
            "noofcontactsdelivered": 8217,
            "noofcontactsmarkedspam": 1,
            "noofcontactsread": 329,
            "noofcontactsreplied": 33,
            "noofcontactsunsubscribed": 3,
            "noofmessagesblocked": 910,
            "noofmessagesbounced": 405,
            "noofmessagesdelivered": 8235,
            "noofmessagesnotdelivered": 337,
            "noofmessagessent": 987,
            "painitred": "",
            "sendername": "Test sender name",
            "subject": "Test Subject"
        }
    ],
    "status": "OK"
}

if Details is True 

{
    "message": [   
        {
            "color": "3399FF",
            "enddate": "2019-01-30",
            "id": 429,
            "imagepart": 3501,
            "lastupdate": "2019-02-21T09:00:00300:00",
            "messageid": 11864,
            "messagelink": "",
            "messagestatus": "ON",
            "messagetype": "EMAIL",
            "noofcontactsblocked": 0,
            "noofcontactsbounced": 1,
            "noofcontactsclicked": 16,
            "noofcontactscomplained": 3,
            "noofcontactsdelivered": 127,
            "noofcontactsread": 71,
            "noofcontactsreadondesktop": 44,
            "noofcontactsreadonmobile": 9,
            "noofcontactsreplied": 0,
            "noofmessagesdelivered": 729,
            "painitred": "ON",
            "sendername": "KREA.Digital",
            "startdate": "2019-01-01",
            "subject": "✉️ E-posta hizmetimiz ile ilgilendiğinizi gördük",
            "textpart": 38612,
            "totalmessagesize": 42113
        },
        {
            "color": "3399FF",
            "enddate": "2019-01-30",
            "id": 429,
            "imagepart": 3501,
            "lastupdate": "2018-11-19T15:10:00300:00",
            "messageid": 11863,
            "messagelink": "",
            "messagestatus": "ON",
            "messagetype": "EMAIL",
            "noofcontactsblocked": 2,
            "noofcontactsbounced": 2,
            "noofcontactsclicked": 18,
            "noofcontactscomplained": 4,
            "noofcontactsdelivered": 307,
            "noofcontactsread": 126,
            "noofcontactsreadondesktop": 63,
            "noofcontactsreadonmobile": 36,
            "noofcontactsreplied": 2,
            "noofmessagesdelivered": 1271,
            "painitred": "ON",
            "sendername": "KREA.Digital",
            "startdate": "2019-01-01",
            "subject": "Sizi Özledik ❤️",
            "textpart": 35251,
            "totalmessagesize": 38752
        }
    ],
    "status": "OK"
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
    "status": "Error", 
    "message": "MessageID must be contain"
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
    "status": "Error", 
    "message": "Error Message"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Message Info Javascript/AJAX example" %}

```javascript
var responseData = {
    "AuthKey": "**********************",
    "MessageID":5
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://outbox.rest/send/group/message",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
  },
  "processData": false,
  "data": JSON.stringify(responseData)
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

## Groups

<mark style="color:blue;">`GET`</mark> `https://outbox.rest/groups`

Service used to get detailed information about all groups/list.

#### Headers

| Name    | Type   | Description                        |
| ------- | ------ | ---------------------------------- |
| AuthKey | string | Authentication token for using API |

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

```javascript
{
    "message": [
        {
            "ActiveContacts": 12345,
            "AddedOn": "2019-01-24T09:26:37200:00",
            "Bounced": 12345,
            "Complained": 123,
            "ContactsClickingLinks": 1234,
            "Description": "",
            "GroupColor": "FFFFFF",
            "GroupID": 10,
            "GroupName": "Test Group",
            "OptinLevel": 0,
            "Source": "USER",
            "TotalContacts": 12345,
            "UpdatedOn": "2019-01-24T09:26:37200:00",
            "ValidContacts": 12345,
            "integerpercentageofactivecontactsforgroup": "28",
            "integerpercentageofcomplainedcontacts": "0",
            "integerpercentageofcontactsclickingcinksforgroup": "10",
            "integerpercentageofvalidcontactsforgroup": "61",
            "percentageofcomplainedcontacts": "0.00"
        }
    ],
    "status": "OK"
}
```

{% endtab %}

{% tab title="403 " %}

```javascript
{
    "status": "Error", 
    "message": "Invalid Token"
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
    "status": "Error", 
    "message": "Token does not exist"
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
    "status": "Error", 
    "message": "Error messages"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Groups Javascript/AJAX example" %}

```javascript
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://outbox.rest/groups",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "AuthKey": "**********************",
  },
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

## Group Recipients

<mark style="color:green;">`POST`</mark> `https://outbox.rest/group/recipients`

Service used to query the group-based member.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name    | Type    | Description                                   |
| ------- | ------- | --------------------------------------------- |
| Date    | string  | Date is user added date. Key format YYY-MM-DD |
| Page    | number  | Page number                                   |
| Limit   | number  | Default value 100, Maximum value 500          |
| GroupID | integer | Group ID                                      |
| AuthKey | string  | Authentication token for using API            |

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

```javascript
{
    "message": [
        {
            "AddedOn": "2019-02-07T13:37:09200:00",
            "Blocked": 0,
            "BrowserBlock": 0,
            "BrowserComplain": 0,
            "BrowserToken": "",
            "ClientMailsNotRead": 0,
            "Complained": 0,
            "ContactNo": 64,
            "EMailBlock": 0,
            "EMailComplain": 0,
            "GSMBlock": 0,
            "GSMComplain": 0,
            "GSMTel": "5555555255",
            "Gender": "-1",
            "GroupID": "11",
            "HardBounce": 0,
            "LastActivityWasOn": "2000-01-01T00:00:00200:00",
            "LastCity": null,
            "LastClientMailWasOn": "2000-01-01 00:00:00",
            "LastCountry": null,
            "LastMediaType": "",
            "LastPurchaseOn": "2000-01-01 00:00:00",
            "LastVisitToWebSite": "2000-01-01 00:00:00",
            "MailsLastMonth": 0,
            "MarkedAsSPAM": 0,
            "Quit": 0,
            "Risk": 70,
            "SPAMTrapHit": 0,
            "UUID": "test_2@test.com-5555555255--",
            "Unsubscribed": 0,
            "Valid": 1,
            "XPID": "",
            "XPIDBlock": 0,
            "XPIDComplain": 0,
            "recipient": "test_1@test.com"
        },
        {
            "AddedOn": "2019-02-07T13:37:09200:00",
            "Blocked": 0,
            "BrowserBlock": 0,
            "BrowserComplain": 0,
            "BrowserToken": "",
            "ClientMailsNotRead": 0,
            "Complained": 0,
            "ContactNo": 63,
            "EMailBlock": 0,
            "EMailComplain": 0,
            "GSMBlock": 0,
            "GSMComplain": 0,
            "GSMTel": "5555555555",
            "Gender": "-1",
            "GroupID": "11",
            "HardBounce": 0,
            "LastActivityWasOn": "2000-01-01T00:00:00200:00",
            "LastCity": null,
            "LastClientMailWasOn": "2000-01-01 00:00:00",
            "LastCountry": null,
            "LastMediaType": "",
            "LastPurchaseOn": "2000-01-01 00:00:00",
            "LastVisitToWebSite": "2000-01-01 00:00:00",
            "MailsLastMonth": 0,
            "MarkedAsSPAM": 0,
            "Quit": 0,
            "Risk": 70,
            "SPAMTrapHit": 0,
            "UUID": "test_2@test.com-5555555555--",
            "Unsubscribed": 0,
            "Valid": 1,
            "XPID": "",
            "XPIDBlock": 0,
            "XPIDComplain": 0,
            "recipient": "test_2@test.com"
        }
    ],
    "status": "OK"
}
```

{% endtab %}

{% tab title="403 " %}

```javascript
{
    "status": "Error", 
    "message": "Invalid Token"
}
```

{% endtab %}

{% tab title="404 " %}

```java
{
    "status": "Error", 
    "message": "Token does not exist"
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
    "status": "Error", 
    "message": "Error messages"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Group Recipients Javascript/AJAX example" %}

```javascript
var responseData = {
    "AuthKey": "**********************",
    "GroupID":10
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://outbox.rest/group/recipients",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
  },
  "processData": false,
  "data": JSON.stringify(responseData)
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

## Get Recipient

<mark style="color:green;">`POST`</mark> `https://outbox.rest/get/recipient`

Service used for member-based inquiry.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name      | Type    | Description                                                |
| --------- | ------- | ---------------------------------------------------------- |
| EMail     | integer | Recipient email address                                    |
| uniqueID  | string  | When creating a recipient, unique id is given to recipient |
| ContactNo | integer | ContactNo after added recipient                            |
| AuthKey   | string  | Authentication token for using API                         |

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

```javascript
{
    "message": [
        {
            "AddedOn": "2019-02-14T14:38:39200:00",
            "Address": null,
            "BrowserToken": "",
            "CardNo": null,
            "Children": null,
            "City": null,
            "Communication": null,
            "Company": null,
            "Consent": 1,
            "ContactNo": 1205328279,
            "Country": null,
            "DateOfBirth": null,
            "DateOfMarriage": null,
            "Department": null,
            "EMail": "test_1@test.com",
            "EMail2": null,
            "EMail3": null,
            "EMailCheck": 0,
            "Education": null,
            "ExecuteOn": null,
            "Experience": null,
            "Fax": null,
            "FieldMaps": null,
            "Files": null,
            "FirstName": null,
            "Friends": "[ { \"name\": \"facebook\",\"url\":\"\",\"count\":\"\" } , { \"name\": \"linkedin\",\"url\":\"\",\"count\":\"\" } , { \"name\": \"twitter\",\"url\":\"\",\"count\":\"\" } , { \"name\": \"instagram\",\"url\":\"\",\"count\":\"\" } , { \"name\": \"pinterest\",\"url\":\"\",\"count\":\"\" } , { \"name\": \"google\",\"url\":\"\",\"count\":\"\" }]",
            "GSMTel1": "5555555555",
            "GSMTel2": null,
            "Gender": null,
            "GroupID": 4733,
            "Hobbies": null,
            "HomeTel": null,
            "ID": 429,
            "Industry": null,
            "LS": 3,
            "LastName": null,
            "MaritalStatus": null,
            "Message": null,
            "Modified": 1,
            "Occupation": null,
            "OfficeTel": null,
            "POBox": null,
            "Photos": null,
            "Profile": null,
            "RA": 4,
            "SecurityID": null,
            "SpouseDateOfBirth": null,
            "SpouseName": null,
            "Status": "ON",
            "Variables": null,
            "XPID": "",
            "blocked": "0",
            "complained": "0",
            "hardbounced": "0",
            "uniqueID": "329",
            "unsubscribed": "0",
            "varAll1": null,
            "varAll2": null,
            "varAll3": null,
            "varDate1": null,
            "varDate2": null,
            "varDate3": null,
            "varText1": null,
            "varText10": null,
            "varText11": null,
            "varText12": null,
            "varText2": null,
            "varText3": null,
            "varText4": null,
            "varText5": null,
            "varText6": null,
            "varText7": null,
            "varText8": null,
            "varText9": null
        }
    ],
    "status": "OK"
}
```

{% endtab %}

{% tab title="403 " %}

```javascript
{
    "message": "Invalid Token",
    "status": "Error"
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
    "message": "Token does not exist",
    "status": "Error"
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
    "message": "ContactID or uniqueID must be contain in post data",
    "status": "Error"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
&#x20;uniqueID or ContactID ---> You have to send one of the two.
{% endhint %}

| **uniqueID**  | Special identification number sent from your system when adding a recipient |
| ------------- | --------------------------------------------------------------------------- |
| **ContactID** | Spesific id sent after adding recipients                                    |

{% tabs %}
{% tab title="Get Recipient Javascript/AJAX example" %}

```javascript
var responseData = {
  "AuthKdey": "*********************",
  "uniqueID":329,
  "GroupID":10

}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://outbox.rest/get/recipient",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
  },
  "processData": false,
  "data": JSON.stringify(responseData)
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

## Get Recipients with Status

<mark style="color:green;">`POST`</mark> `https://outbox.rest/status/recipients`

Service based on two dates between status of the member to query Ex. 01.01.2019-01.02.2019 between dates of leaving the membership

#### Headers

| Name        | Type   | Description      |
| ----------- | ------ | ---------------- |
| Contet-Type | string | application/json |

#### Request Body

| Name      | Type    | Description                                                                                                    |
| --------- | ------- | -------------------------------------------------------------------------------------------------------------- |
| Count     | string  | Page size limit                                                                                                |
| EndDate   | string  | Query Date Finish (yyyy-mm-dd)                                                                                 |
| StartDate | string  | Query Date Start (yyyy-mm-dd)                                                                                  |
| Page      | number  | Page number (default '1' )                                                                                     |
| Type      | string  | <p>READERS/MYREADER/<br>CLICKERS/MYCLIKERS/<br>VALID/BOUNCED/COMPLAINED/<br>BLOCKS/BLOCKED/<br>INVALID/ALL</p> |
| GroupID   | integer | GroupID                                                                                                        |
| AuthKey   | string  | Authentication token for using API                                                                             |

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

```javascript
{
    "message": [
        {
            "AddedOn": "2019-02-14T11:49:32200:00",
            "Blocked": 0,
            "BrowserBlock": 0,
            "BrowserComplain": 0,
            "BrowserToken": "",
            "ClientMailsNotRead": 0,
            "Complained": 0,
            "ContactNo": 120538276,
            "EMailBlock": 0,
            "EMailComplain": 1,
            "GSMBlock": 0,
            "GSMComplain": 0,
            "GSMTel": "5555555555",
            "Gender": "-1",
            "GroupID": "4733",
            "HardBounce": 0,
            "LastActivityWasOn": "2000-01-01T00:00:00200:00",
            "LastCity": null,
            "LastClientMailWasOn": "2000-01-01 00:00:00",
            "LastCountry": null,
            "LastMediaType": "",
            "LastPurchaseOn": "2000-01-01 00:00:00",
            "LastVisitToWebSite": "2000-01-01 00:00:00",
            "MailsLastMonth": 0,
            "MarkedAsSPAM": 0,
            "Quit": 1,
            "Risk": 70,
            "SPAMTrapHit": 0,
            "UUID": "test_1@test.com@krea.digital-5555555555--",
            "Unsubscribed": 1,
            "Valid": 0,
            "XPID": "",
            "XPIDBlock": 0,
            "XPIDComplain": 0,
            "recipient": "test_1@test.com"
        }
    ],
    "status": "OK"
}
```

{% endtab %}

{% tab title="403 " %}

```javascript
{
    "message": "Invalid Token",
    "status": "Error"
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
    "message": "Token does not exist",
    "status": "Error"
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
    "message": "GroupID and Type must be contain in post data",
    "status": "Error"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
\****The number of pages varies depending on the key sent with the Count key.***
{% endhint %}

| Type       |                                                   |
| ---------- | ------------------------------------------------- |
| MYREADERS  | Include people who have seen the messages before  |
| READERS    | Show the recipients frequently seen in the group  |
| CLICKERS   | Include people who have click the messages before |
| MYCLICKERS | Show the recipients frequently click in the group |
| VALID      | Show valid recipients in group.                   |
| BOUNCED    | Show extracted recipients.                        |
| COMPLAINED | Show complaining recipients.                      |
| BLOCKS     | Show blocked recipients in all groups.            |
| BLOCKED    | Show blocked recipients in group.                 |
| INVALID    | Show invalid recipients in group.                 |
| ALL        | all recipients                                    |

{% tabs %}
{% tab title="Status Recipients Javascript/AJAX example" %}

```javascript
var responseData = {
  "AuthKey": "*************************",
  "Type":"ALL",
  "GroupID":10,
  "Count":20,
  "Page":2,
  "StartDate":"2018-01-01",
  "EndDate":"2018-12-30"
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://outbox.rest/status/recipients",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
  },
  "processData": false,
  "data": JSON.stringify(responseData)
}

$.ajax(settings).done(function (response) {
  console.log(response);
});c
```

{% endtab %}
{% endtabs %}

## Send Message to Recipient (XML)

<mark style="color:green;">`POST`</mark> `https://outbox.rest/send/xml/message`

Send Message API with XML

#### Headers

| Name         | Type   | Description     |
| ------------ | ------ | --------------- |
| Content-Type | string | application/xml |

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

```markup
<result type="dict">
    <message type="list">
        <item type="dict">
            <TrackingID type="str">d06ea38ca2714e16afafc6a2ceada88e</TrackingID>
            <Recipient type="str">+9053xxxxxxxx</Recipient>
        </item>
    </message>
    <status type="dict">
        <Length type="int">1</Length>
        <Accepted type="int">1</Accepted>
    </status>
</result>
```

{% endtab %}

{% tab title="403 " %}

```markup
<result type="dict">
    <message type="str">Invalid Auth Key</message>
</result>
```

{% endtab %}

{% tab title="500 " %}

```markup
<result type="dict">
    <message type="str">Invalid Message Content</message>
</result>
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Send Message XML example" %}

```markup
<?xml version="1.0" encoding="UTF-8"?>
<data>
   <AuthKey>***********************</AuthKey>
   <MessageType>SMS</MessageType>
   <Priority>NORMAL</Priority>
   <MessageID>15</MessageID>
	<Recipients>
	      <SenderName>Test</SenderName>
         <Content>test</Content>
         <Recipient>+9053xxxxxxxx</Recipient>
   </Recipients>
   <SendAlways>2</SendAlways>
</data>
```

{% endtab %}
{% endtabs %}

## Get Status of Sent Message (XML)

<mark style="color:green;">`POST`</mark> `https://outbox.rest/get/xml/status`

Get Status API with XML

#### Path Parameters

| Name         | Type   | Description     |
| ------------ | ------ | --------------- |
| Content-Type | string | application/xml |

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

```markup
<result type="dict">
    <Recipient type="str">9053********</Recipient>
    <Code type="int">0</Code>
    <Status type="str">Success</Status>
</result>
```

{% endtab %}

{% tab title="403 " %}

```markup
<result type="dict">
    <message type="str">Invalid Token</message>
    <status type="int">403</status>
</result>
```

{% endtab %}

{% tab title="404 " %}

```markup
<result type="dict">
    <message type="str">Token does not exist</message>
    <status type="int">404</status>
</result>
```

{% endtab %}

{% tab title="500 " %}

```markup
<result type="dict">
    <message type="str">An error occurred while getting status</message>
    <status type="int">500</status>
</result>
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Get Status XML example" %}

```markup
<?xml version="1.0" encoding="UTF-8"?>
<data>
   <AuthKey>****************************</AuthKey>
   <Language>EN</Language>
   <TrackingID>d3d54b027b674e2abd98fea967238908</TrackingID>
</data>
```

{% endtab %}
{% endtabs %}

## Update Status Message

<mark style="color:blue;">`GET`</mark> `https://outbox.rest/update/status/message`

Update status to message

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name      | Type   | Description                        |
| --------- | ------ | ---------------------------------- |
| Type      | string | ON/STOP/PAUSE                      |
| MessageID | string | MessageID for update status        |
| AuthKey   | string | Authentication token for using API |

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

```javascript
{
    "status": "OK"
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
    "message": "Token does not exist",
    "status": "Error"
}
```

{% endtab %}

{% tab title="500 " %}

```javascript
{
    "message": "MessageID or Type not found",
    "status": "Error"
}

//
{
    "message": "Status Type not Acceptable",
    "status": "Error"
}
```

{% endtab %}
{% endtabs %}

```javascript
var responseData = {
  "AuthKey": "*************************",
  "Type":"ON",
  "MessageID":12345
}
/*
  ON = Start Message
  STOP = Stop Message
  PAUSE = Pause Message
*/
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://outbox.rest/update/status/message",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
  },
  "processData": false,
  "data": JSON.stringify(responseData)
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```


---

# 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://outbox.gitbook.io/outbox-documentations/master.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.
