Skip to main content

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

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the otp code to update

Request Body

FieldTypeRequiredDescription
codeIntegerNoThe otp code
mobile_numberStringNoThe mobile number related to the otp code (valid iranian mobile number)
emailStringNoThe email address related to the otp code (valid email format)
valid_toString(Datetime)NoThe expiration datetime of the otp code (default: calculated from the settings)

Example Requests

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())

Response Fields

FieldTypeDescription
idIntegerUnique ID of the otp code.
codeIntegerThe otp code
mobile_numberStringThe related mobile number (nullable, valid iranian mobile number)
emailStringThe related email address (nullable, valid email format)
recipientStringThe receiver of the otp code (either email or mobile number, calculated field)
valid_toString (ISO 8601)Timestamp when the otp code will be expired.
ttlIntegerThe duration in seconds which the otp code will be valid (calculated field)
is_allowBooleanWhether the otp code is still valid and usable or not (calculated field)
created_atString (ISO 8601)Timestamp when the otp code was created.
updated_atString (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_number or email should be provided (only one)
  • if valid_to is not provided, it will be calculated from the otp expiration time of the project
  • valid_to can not be explicitely set to null
  • recipient, ttl, is_allow are calculated fields