Emails a link to reset the password of the account with this address. The link is valid for one hour; use its token with Reset Password.
Note
Public. The response is the same whether or not an account uses the address, so it can't be used to find out who has an account.
Request Body
NameDescription
emailThe account's email address.
Errors
| Status | Code | When |
|---|---|---|
| 400 | validation_error | email is missing or not an email address |
Was this page helpful? Yes No
Previous
Next
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl -X POST https://api.syntext.dev/v1/auth/forgot-password \
-H "Content-Type: application/json" \
-d '{ "email": "alex@example.com" }'
const response = await fetch('https://api.syntext.dev/v1/auth/forgot-password', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
"email": "alex@example.com"
}),
});
const data = await response.json();
console.log(response.status, data);
import requests
url = "https://api.syntext.dev/v1/auth/forgot-password"
payload = {
"email": "alex@example.com",
}
response = requests.post(url, json=payload)
print(response.status_code)
print(response.json())
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"email": "alex@example.com"
}`)
req, err := http.NewRequest("POST", "https://api.syntext.dev/v1/auth/forgot-password", bytes.NewReader(payload))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status)
fmt.Println(string(body))
}
require "json"
require "net/http"
require "uri"
uri = URI("https://api.syntext.dev/v1/auth/forgot-password")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request.body = JSON.generate({
"email" => "alex@example.com",
})
response = http.request(request)
puts response.code
puts response.body
<?php
$payload = [
'email' => 'alex@example.com',
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.syntext.dev/v1/auth/forgot-password',
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
echo $status, PHP_EOL, $response, PHP_EOL;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"email": "alex@example.com"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.syntext.dev/v1/auth/forgot-password"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.syntext.dev/v1/auth/forgot-password");
request.Content = new StringContent(
"""
{
"email": "alex@example.com"
}
""",
Encoding.UTF8,
"application/json");
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
Responseapplication/json
200OK
{
"data": { "sent": true }
}