Reset a forgotten password
curl --request POST \
--url https://api.liara.ir/v1/password/reset \
--header 'Content-Type: application/json' \
--data '
{
"email": "you@example.com",
"token": "123456",
"password": "<new-password>"
}
'import requests
url = "https://api.liara.ir/v1/password/reset"
payload = {
"email": "you@example.com",
"token": "123456",
"password": "<new-password>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({email: 'you@example.com', token: '123456', password: '<new-password>'})
};
fetch('https://api.liara.ir/v1/password/reset', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.liara.ir/v1/password/reset",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'you@example.com',
'token' => '123456',
'password' => '<new-password>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.liara.ir/v1/password/reset"
payload := strings.NewReader("{\n \"email\": \"you@example.com\",\n \"token\": \"123456\",\n \"password\": \"<new-password>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.liara.ir/v1/password/reset")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"you@example.com\",\n \"token\": \"123456\",\n \"password\": \"<new-password>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.liara.ir/v1/password/reset")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"you@example.com\",\n \"token\": \"123456\",\n \"password\": \"<new-password>\"\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 400,
"error": "Bad Request",
"message": "\"phone\" with value \"123\" fails to match the required pattern: /^09\\d{9}$/"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "Forbidden",
"data": null
}{
"statusCode": 429,
"error": "Too Many Requests",
"message": "Too Many Requests",
"data": null
}Password
Reset a forgotten password
Sets a new password using the code from POST /v1/password/forgot. Every API token issued before the reset stops working; log in again to get a new one.
Too many wrong codes are rejected with 429.
POST
/
v1
/
password
/
reset
Reset a forgotten password
curl --request POST \
--url https://api.liara.ir/v1/password/reset \
--header 'Content-Type: application/json' \
--data '
{
"email": "you@example.com",
"token": "123456",
"password": "<new-password>"
}
'import requests
url = "https://api.liara.ir/v1/password/reset"
payload = {
"email": "you@example.com",
"token": "123456",
"password": "<new-password>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({email: 'you@example.com', token: '123456', password: '<new-password>'})
};
fetch('https://api.liara.ir/v1/password/reset', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.liara.ir/v1/password/reset",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'you@example.com',
'token' => '123456',
'password' => '<new-password>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.liara.ir/v1/password/reset"
payload := strings.NewReader("{\n \"email\": \"you@example.com\",\n \"token\": \"123456\",\n \"password\": \"<new-password>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.liara.ir/v1/password/reset")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"you@example.com\",\n \"token\": \"123456\",\n \"password\": \"<new-password>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.liara.ir/v1/password/reset")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"you@example.com\",\n \"token\": \"123456\",\n \"password\": \"<new-password>\"\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 400,
"error": "Bad Request",
"message": "\"phone\" with value \"123\" fails to match the required pattern: /^09\\d{9}$/"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "Forbidden",
"data": null
}{
"statusCode": 429,
"error": "Too Many Requests",
"message": "Too Many Requests",
"data": null
}Body
application/json
Response
The password was changed. The response body is empty.
⌘I
