Update An otp code
Update an otp code
HTTP Request
PATCH/api/notifications/otp/:id
Authorization
Authorization
- Required: Yes
- Permission: Staff with OTPPermission or Admin
- Permission Code: 2853
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Unique ID of the otp code to update |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| code | Integer | No | The otp code |
| mobile_number | String | No | The mobile number related to the otp code (valid iranian mobile number) |
| String | No | The email address related to the otp code (valid email format) | |
| valid_to | String(Datetime) | No | The expiration datetime of the otp code (default: calculated from the settings) |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2response = requests.post('http://www.example.com/api/notifications/notifiers/sms/49', json={
3 "mobile_number": null,
4 "email": "some@email.com"
5})
6print(response.json())1curl -X POST "http://www.example.com/api/notifications/notifiers/sms/49" -H "Content-Type: application/json" -d '{
2 "mobile_number": "09101234565",
3 "email": null
4}Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the otp code. |
| code | Integer | The otp code |
| mobile_number | String | The related mobile number (nullable, valid iranian mobile number) |
| String | The related email address (nullable, valid email format) | |
| recipient | String | The receiver of the otp code (either email or mobile number, calculated field) |
| valid_to | String (ISO 8601) | Timestamp when the otp code will be expired. |
| ttl | Integer | The duration in seconds which the otp code will be valid (calculated field) |
| is_allow | Boolean | Whether the otp code is still valid and usable or not (calculated field) |
| created_at | String (ISO 8601) | Timestamp when the otp code was created. |
| updated_at | String (ISO 8601) | Timestamp when the otp code was last updated. |
Response Example
{
"id": 57,
"code": 255315,
"mobile_number": null,
"email": "info@moeinmail.ir",
"recipient": "info@moeinmail.ir",
"valid_to": "2025-12-30T14:39:10.268800Z",
"ttl": 85565,
"is_allow": true,
"created_at": "2025-12-29T14:38:32.273219Z",
"updated_at": "2025-12-29T14:53:04.467226Z"
}
NOTES
- Either one field from
mobile_numberoremailshould be provided (only one) - if
valid_tois not provided, it will be calculated from the otp expiration time of the project valid_tocan not be explicitely set tonullrecipient,ttl,is_alloware calculated fields