Sets a new password with the token from a Forgot Password email, then signs out every session of the account — browsers and stx CLI logins alike. Sign in again with Log In.
Note
Public — the token is the credential. Each token works once and expires an hour after it was sent. To change the password while signed in, use Change Password.
Request Body
NameDescription
tokenThe token from the reset link, at least 16 characters.
passwordThe new password, 8–128 characters.
Errors
| Status | Code | When |
|---|---|---|
| 400 | validation_error | token is missing or too short, or password is under 8 or over 128 characters |
| 400 | bad_request | The token is unknown, already used or expired (Invalid or expired reset link) — ask for a new email |
Was this page helpful? Yes No
Previous
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl -X POST https://api.syntext.dev/v1/auth/reset-password \
-H "Content-Type: application/json" \
-d '{ "token": "'"$RESET_TOKEN"'", "password": "a-new-long-password" }'
const response = await fetch('https://api.syntext.dev/v1/auth/reset-password', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
"token": "$RESET_TOKEN",
"password": "a-new-long-password"
}),
});
const data = await response.json();
console.log(response.status, data);
import requests
url = "https://api.syntext.dev/v1/auth/reset-password"
payload = {
"token": "$RESET_TOKEN",
"password": "a-new-long-password",
}
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(`{
"token": "$RESET_TOKEN",
"password": "a-new-long-password"
}`)
req, err := http.NewRequest("POST", "https://api.syntext.dev/v1/auth/reset-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/reset-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({
"token" => "$RESET_TOKEN",
"password" => "a-new-long-password",
})
response = http.request(request)
puts response.code
puts response.body
<?php
$payload = [
'token' => '$RESET_TOKEN',
'password' => 'a-new-long-password',
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.syntext.dev/v1/auth/reset-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 = """
{
"token": "$RESET_TOKEN",
"password": "a-new-long-password"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.syntext.dev/v1/auth/reset-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/reset-password");
request.Content = new StringContent(
"""
{
"token": "$RESET_TOKEN",
"password": "a-new-long-password"
}
""",
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": { "reset": true }
}