curl --request POST \
--url https://api.otpiq.com/api/reports/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"startDate": "2026-01-01T00:00:00.000Z",
"endDate": "2026-01-31T23:59:59.999Z"
}
'{
"_id": "65a1b2c3d4e5f6789012345",
"reportId": "65a1b2c3d4e5f6789012345",
"filename": "delivery-report-myproject-2026-02-12T12-00-00-000Z-a1b2c3d4.csv",
"fileId": "4_z1234567890_f1020304050607080",
"downloadUrl": "https://cdn.example.com/files/delivery-report-....csv",
"recordCount": 150,
"dateRange": {
"startDate": "2026-01-01T00:00:00.000Z",
"endDate": "2026-01-31T23:59:59.999Z"
},
"filters": {
"startDate": "2026-01-01T00:00:00.000Z",
"endDate": "2026-01-31T23:59:59.999Z",
"phoneNumbers": [
"+9647701234567"
],
"statuses": [
"sent",
"failed"
]
},
"expiresAt": "2026-03-14T12:00:00.000Z",
"status": "available",
"createdAt": "2026-02-12T12:00:00.000Z",
"updatedAt": "2026-02-12T12:00:00.000Z",
"message": "Delivery report generated successfully"
}Delivery Reports Endpoints
Generate Delivery Report
Create CSV delivery reports for SMS/messages in a date range
POST
/
reports
/
generate
curl --request POST \
--url https://api.otpiq.com/api/reports/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"startDate": "2026-01-01T00:00:00.000Z",
"endDate": "2026-01-31T23:59:59.999Z"
}
'{
"_id": "65a1b2c3d4e5f6789012345",
"reportId": "65a1b2c3d4e5f6789012345",
"filename": "delivery-report-myproject-2026-02-12T12-00-00-000Z-a1b2c3d4.csv",
"fileId": "4_z1234567890_f1020304050607080",
"downloadUrl": "https://cdn.example.com/files/delivery-report-....csv",
"recordCount": 150,
"dateRange": {
"startDate": "2026-01-01T00:00:00.000Z",
"endDate": "2026-01-31T23:59:59.999Z"
},
"filters": {
"startDate": "2026-01-01T00:00:00.000Z",
"endDate": "2026-01-31T23:59:59.999Z",
"phoneNumbers": [
"+9647701234567"
],
"statuses": [
"sent",
"failed"
]
},
"expiresAt": "2026-03-14T12:00:00.000Z",
"status": "available",
"createdAt": "2026-02-12T12:00:00.000Z",
"updatedAt": "2026-02-12T12:00:00.000Z",
"message": "Delivery report generated successfully"
}Use the
downloadUrl from the response to download the CSV file directly. There is no separate download endpoint—reports are available for 30 days after generation.CSV content
The downloaded CSV includes these columns:| Column | Description |
|---|---|
| Message ID | Internal message identifier (smsId) |
| Phone Number | Recipient phone number |
| Sender ID | Sender ID name (or “System”) |
| Cost (IQD) | Cost in IQD |
| Message Type | OTP, Custom, WhatsApp Template, or Other |
| Delivery Status | pending, sent, delivered, read, or failed |
| Error Reason | Last error in the message flow (empty if none) |
| Refunded | Yes/No |
| Created At | ISO 8601 |
| Sent At | ISO 8601 (if sent) |
Authorizations
Body
application/json
Report generation parameters. startDate and endDate are required.
Response
Delivery report generated successfully. Use downloadUrl to fetch the CSV file.