> For the complete documentation index, see [llms.txt](https://bitel.gitbook.io/bitel/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bitel.gitbook.io/bitel/master/sms/sms-detail.md).

# SMS Detail

## How to get SMS request detail

There are two ways to retrieve the detail of a SMS request:

**Single SMS**: if the single sms API is used then the response contains a requestId from which the request detail can be retrieved using the [**Single SMS Request API**](/bitel/master/sms/sms-detail.md#single-sms-detail-by-requestid)

**Batch SMS:** if the batch sms api is used(batch and p2p) then the response contains a batchId from which the request detail can be retrieved using [**Batch SMS Detail API** ](/bitel/master/sms/sms-detail.md#batch-sms-detail-by-batchid)

## Single SMS detail by requestId

<mark style="color:blue;">`GET`</mark> `https://api.bitel.rest/api/v1/sms/detail/single/:requestId`

#### Path Parameters

| Name      | Type   | Description                                 |
| --------- | ------ | ------------------------------------------- |
| requestId | string | requestId retrieved from single sms request |

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

```javascript
{
  "result": {
    "id": "7123c2cec14c43ac944553f15f3aab18",
    "message": "Hi there",
    "phoneNumber": "0912*******",
    "requestDate": 1542434545,
    "result": "ok",
    "smsCount": 1,
    "balanceSubtracted": 100
  },
  "error": null
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "result": null
  "error": "NotFound"
}
```

{% endtab %}
{% endtabs %}

## Batch SMS detail by batchId

<mark style="color:blue;">`GET`</mark> `https://api.bitel.rest/api/v1/sms/detail/batch/:batchId`

#### Path Parameters

| Name    | Type   | Description                                    |
| ------- | ------ | ---------------------------------------------- |
| batchId | string | batchId retrieved from batch / p2p sms request |

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

```javascript
{
  "result": [
    {
      "id": "7123c2cec14c43ac944553f15f3aab18",
      "message": "Hi there",
      "phoneNumber": "0912*******",
      "requestDate": 1542434545,
      "result": "ok",
      "smsCount": 1,
      "balanceSubtracted": 100
    }
  ],
  "error": null
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "result": null
  "error": "NotFound"
}
```

{% endtab %}
{% endtabs %}

## Detail Description

| Key                | Type          | Description                                                                                                                                                        |
| ------------------ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Id                 | string        | request identifier                                                                                                                                                 |
| text               | string        | text of message                                                                                                                                                    |
| phoneNumber        | string        | phone number the message was sent to                                                                                                                               |
| requestDate        | int64         | date the request was created in epoch format                                                                                                                       |
| deliveryStatus     | string        | delivery status of the request(refer to table [DeliveryStatus](/bitel/master/sms/sms-detail.md#delivery-status-table))                                             |
| deliveryStatusCode | int           | same as delivery status, but returns status numeric code instead of string(refer to table [DeliveryStatus](/bitel/master/sms/sms-detail.md#delivery-status-table)) |
| smsCount           | int           | how many part the message comprise                                                                                                                                 |
| balanceSubtracted  | float(double) | the cost of request in Toman                                                                                                                                       |

## Delivery Status Table

| String Code      | Numeric Code | Description                                                                                 |
| ---------------- | ------------ | ------------------------------------------------------------------------------------------- |
| WAITING          | 0            | The message is in process of being sent                                                     |
| DELIVERED        | 1            | The message was successfully delivered                                                      |
| DELIVERY\_FAILED | 4            | The message was sent to operator but the user was probably unreachable                      |
| BLACKLIST        | 5            | The message was not sent, because the user has blocked this number                          |
| ERROR            | 9            | The message was not sent, due to an error(invalid phone number or connectivity error, etc.) |
| CHECK\_ERROR     | 10           | The message was not sent, because operator denied the access                                |
