# Message inbox API

## getInboxMessages

Returns the list of Inbox messages for a specified HWID.

`POST` `https://api.pushwoosh.com/json/1.3/getInboxMessages`

#### Request headers

| Name          | Required | Value         | Description                                                |
|---------------|----------|---------------|------------------------------------------------------------|
| Authorization | Yes      | Token `XXXX`  | [API Device Token](/developer/api-reference/api-access-token/#device-api-token) to access Device API. Replace `XXXX` with your actual Device API token. |

#### Request Body

| Name                                          | Type    | Description                                                                                                         |
| --------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------- |
| application\* | string  | [Pushwoosh application code](/developer/api-reference/api-identifiers/#application-code)                                                                                              |
| userId\*      | string  | If no custom [User ID](/developer/api-reference/api-identifiers/#user-id) is set, use HWID.                                                                              |
| hwid                                          | string  | [Hardware ID of a device](/developer/api-reference/api-identifiers/#hardware-id) to get the Inbox messages for.                                                              |
| last\_code                                    | string  | Code of the last message retrieved in the previous response. If empty, the first messages are returned.             |
| count                                         | integer | The number of messages to be showed in a single response; used for pagination. 0 for loading all messages in Inbox. |



<Tabs>
<TabItem label="200">
```json
{
  "response": {
    "messages": [{                      // array of messages currently stored in user's Inbox
      "inbox_id": "avde1c792cd",
      "rt": "146078676",                // date to remove the message from Inbox
      "send_date": "1459758676",        // date when the message was saved to Inbox
      "order": "59138176",              // position in Inbox presentation order
      "title": "New Rich Media in inbox!",
      "text": "Hi! New feature is available right now!",
      "action_type": "RichMedia",
      "action_params": {                // payload describing the actions on push opening
        "rm": "{\"url\":\"https:\/\/richmedia.pushwoosh.com\/C82F7-51FC1.zip\",\"ts\":\"1459758676\",\"tags\":{\"tagName\":\"tagValue\"}}"
      },
      "status": 1,                      // 1 - delivered, 2 - read, 3 - opened,
                                        // 4 - deleted(by a user), 5 - deleted from Control Panel
      "hash":"1C"                       // hash code of push notification
    }, {
      ...
    }],
    "next":"afarew511",                 // the next Inbox code to be returned by
                                        // the following /getInboxMessages request
    "deleted": ["bbaf85ab", "a41957b"], // the list of messages deleted from Control Panel
    "new_inbox": 6                      // the number of delivered Inbox messages for that user (can be used for badge)
  }
}
```
</TabItem>
</Tabs>



```json title="Example Request"
{
  "request": {
    "application": "XXXXX-XXXXX", // required. Pushwoosh app code
     "userId": "user_name_1",     // required. User ID registered in Pushwoosh
     "device_type": 1             // optional. For device types refer to /registerDevice
  }
}
```

<Aside type="note">
For iOS, please make sure that you have added the Notification Service Extension to your project for tracking push delivery.[ Learn more](/developer/pushwoosh-sdk/ios-sdk/ios-message-delivery-tracking/)
</Aside>

## inboxStatus

Updates the status of a particular Inbox message.

`POST` `https://api.pushwoosh.com/json/1.3/inboxStatus`

#### Request headers

| Name          | Required | Value         | Description                                                |
|---------------|----------|---------------|------------------------------------------------------------|
| Authorization | Yes      | Token `XXXX`  | [API Device Token](/developer/api-reference/api-access-token/#device-api-token) to access Device API. Replace `XXXX` with your actual Device API token. |

#### Request Body

| Name                                          | Type    | Description                                                                                                                     |
| --------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- |
| application\* | string  | [Pushwoosh application code](/developer/api-reference/api-identifiers/#application-code)                                                                                                             |
| inbox\_code\* | string  | <p>could be obtained from Message details in Control Panel or from the "order" parameter of the `/geInboxMessages` request</p> |
| hash                                          | string  | Hash code of Inbox message.                                                                                                     |
| hwid                                          | string  | [Hardware ID of the device](/developer/api-reference/api-identifiers/#hardware-id ) to update Inbox status for.                                                                           |
| time                                          | string  | Send date timestamp.                                                                                                            |
| userID\*      | string  | If no custom [User ID](/developer/api-reference/api-identifiers/#user-id) is set, use HWID.                                                                                          |
| status\*      | integer | 1 - delivered, 2 - read, 3 - opened, 4 - deleted by a user.                                                                     |
| device\_type                                  | integer | [See possible values](/developer/api-reference/api-identifiers/#device-type).                                                                                                      |

<Tabs>
<TabItem label="200">
```json
{
  "status_code": 200,
  "status_message": "OK",
  "response": null
}
```
</TabItem>
</Tabs>

```json title="Example"
{
  "request": {
    "application": "XXXXX-XXXXX",    // required. Pushwoosh application code
    "inbox_code": "874393934032909", // required. "order" parameter of /getInboxMessages request
    "hash": "1C",                    // optional.
    "userId": "some_user",           // required.
    "status": 2,                     // required. status to set: 1-delivered, 2-read, 3-opened, 4-deleted (by a user)
    "device_type": 3                 // optional.
  }
}

```