# Delivery Reports via API

When sending a message with Panacea Mobile, you can track the delivery of these messages. If using HTTPS, you need to add two additional fields to your request:

* **report\_url:** The HTTP URL for us to request when the status changes
* **report\_mask:** Which status messages you would like to receive

### What is a report mask?

The report mask is what is known as a bitmask field indicating which status messages you want to receive.

### What are the different delivery status codes?

| Status Code | Description       |
| ----------- | ----------------- |
| 1           | Delivered         |
| 2           | Undelivered       |
| 4           | Queued at network |
| 8           | Sent to network   |
| 16          | Failed at network |

### How to calculate the report mask?

To calculate the report mask, you need to pick the status codes you want to receive, and then add them together! And that’s your report mask.

For example, I want to know whether my message was delivered or failed. (1, 2, and 16)

report\_mask = 1 + 2 + 16 = 19

So, in your next request, send report\_mask=19 and we’ll send you these status messages where applicable.

### Give me an example:

Ok, so we want to send a message and receive status reports to our server when the message is delivered or fails.

Our request parameters will look like this:

| Parameter    | Example Value                                                            |
| ------------ | ------------------------------------------------------------------------ |
| username     | myusername                                                               |
| password     | mypassword                                                               |
| to           | 27821340000                                                              |
| from         | 271112221113                                                             |
| text         | Hello there, we are testing delivery reports!                            |
| report\_mask | 19                                                                       |
| report\_url  | <http://myserver.com/receive\\_report.php>? myMessageId=12345\&status=%d |

**The resulting URL (once we encode the data) for the request will look like this:**

`https://eu-api.panaceamobile.com/json?action=message_send&username=myusername&password=mypassword&to=27821340000&from=271112221113&text=Hello+there%2C+we+are+testing+delivery+reports%21&report_mask=19&report_url=http%3A%2F%2Fmyserver.com%2Freceive_report.php%3FmyMessageId%3D12345%26status%3D%25d`

{% hint style="warning" %}
Please get in touch with your Account Manager or Support to confirm your API URL as this may vary depending on your specific account configuration.&#x20;
{% 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://panaceamobile.gitbook.io/panacea-mobile-help-centre/developers/https-api/delivery-reports-via-api.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.
