Auth
Reset a Password
Consume a reset token and set a new password, revoking all sessions.
POST
/
auth
/
reset-password
Reset a password with a token
curl --request POST \
--url https://billing.example.com/auth/reset-password \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"token": "<string>",
"password": "<string>"
}
'import requests
url = "https://billing.example.com/auth/reset-password"
payload = {
"token": "<string>",
"password": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({token: '<string>', password: '<string>'})
};
fetch('https://billing.example.com/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://billing.example.com/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 => [
"Authorization: <api-key>",
"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://billing.example.com/auth/reset-password"
payload := strings.NewReader("{\n \"token\": \"<string>\",\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://billing.example.com/auth/reset-password")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"<string>\",\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/auth/reset-password")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
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": {
"code": "validation_failed",
"message": "<string>"
}
}Consumes a valid (unused, unexpired) reset token, sets the new password, and
revokes all of that user’s sessions — forcing re-login everywhere.
Invalid, expired, or already-used tokens return a generic
400 so the
endpoint is not a token oracle.
This is also the endpoint behind the invite-acceptance page: teammates added
via POST /v1/users/invite set their first
password here with the token from the invitation email.
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | Yes | The single-use token from the reset (or invite) email. |
password | string | Yes | The new password. Minimum 8 characters. |
Example Request
curl -X POST https://api.recurso.dev/auth/reset-password \
-H "Content-Type: application/json" \
-d '{
"token": "prt_8fJ2kQ5xWvB1nY7cD4gH6mL9pR3tS0aZ",
"password": "n3w-s3cur3-P@ss"
}'
Example Response
{
"message": "password has been reset"
}
⌘I
Reset a password with a token
curl --request POST \
--url https://billing.example.com/auth/reset-password \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"token": "<string>",
"password": "<string>"
}
'import requests
url = "https://billing.example.com/auth/reset-password"
payload = {
"token": "<string>",
"password": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({token: '<string>', password: '<string>'})
};
fetch('https://billing.example.com/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://billing.example.com/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 => [
"Authorization: <api-key>",
"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://billing.example.com/auth/reset-password"
payload := strings.NewReader("{\n \"token\": \"<string>\",\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://billing.example.com/auth/reset-password")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"<string>\",\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/auth/reset-password")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
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": {
"code": "validation_failed",
"message": "<string>"
}
}