Reset Password
curl --request POST \
--url https://api.example.com/api/auth/reset-password \
--header 'Content-Type: application/json' \
--data '
{
"token": "<string>",
"password": "<string>"
}
'import requests
url = "https://api.example.com/api/auth/reset-password"
payload = {
"token": "<string>",
"password": "<string>"
}
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({token: '<string>', password: '<string>'})
};
fetch('https://api.example.com/api/auth/reset-password', 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.example.com/api/auth/reset-password",
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([
'token' => '<string>',
'password' => '<string>'
]),
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.example.com/api/auth/reset-password"
payload := strings.NewReader("{\n \"token\": \"<string>\",\n \"password\": \"<string>\"\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.example.com/api/auth/reset-password")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"<string>\",\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/auth/reset-password")
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 \"token\": \"<string>\",\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"error": "<string>"
}Authentication
Reset Password
Reset a user password using a reset token
POST
/
api
/
auth
/
reset-password
Reset Password
curl --request POST \
--url https://api.example.com/api/auth/reset-password \
--header 'Content-Type: application/json' \
--data '
{
"token": "<string>",
"password": "<string>"
}
'import requests
url = "https://api.example.com/api/auth/reset-password"
payload = {
"token": "<string>",
"password": "<string>"
}
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({token: '<string>', password: '<string>'})
};
fetch('https://api.example.com/api/auth/reset-password', 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.example.com/api/auth/reset-password",
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([
'token' => '<string>',
'password' => '<string>'
]),
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.example.com/api/auth/reset-password"
payload := strings.NewReader("{\n \"token\": \"<string>\",\n \"password\": \"<string>\"\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.example.com/api/auth/reset-password")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"<string>\",\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/auth/reset-password")
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 \"token\": \"<string>\",\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"error": "<string>"
}Resets a user’s password using the token sent to their email via the forgot password endpoint. This completes the password recovery process.
400 Bad Request
400 Bad Request
Authentication
No authentication required.Request Body
string
required
Password reset token sent to the user’s email address. This token is typically included in the password reset link.
string
required
New password for the account. Should meet security requirements (minimum 8 characters recommended).
Response
string
Success message confirming the password has been reset.
Example Request
curl -X POST https://api.contafy.com/api/auth/reset-password \
-H "Content-Type: application/json" \
-d '{
"token": "prt_x1y2z3a4b5c6d7e8f9g0h1i2j3k4l5m6",
"password": "NewSecurePass123!"
}'
Example Response
{
"message": "Contraseña restablecida exitosamente"
}
Error Responses
string
Error type identifier.
string
Human-readable error message.
Common Errors
400 Bad Request{
"error": "INVALID_TOKEN",
"message": "El token de restablecimiento es inválido o ha expirado"
}
{
"error": "VALIDATION_ERROR",
"message": "Token y contraseña son requeridos"
}
{
"error": "VALIDATION_ERROR",
"message": "La contraseña debe tener al menos 8 caracteres"
}
Notes
- Password reset tokens typically expire after 1 hour
- Once a token is used successfully, it becomes invalid
- After resetting the password, users should log in with their new credentials
- For security, all active sessions are terminated when the password is reset
- The new password cannot be the same as the old password