API Reference Verify Email
Verify Email
Confirm an email address with the token from a verification link.
Confirms the account's email address with the token from the link in a verification email — sent at Register, by Send Verification Email and by Change Email.
Note
Public — the token is the credential, so you don't need to be signed in. Each token works once and expires 24 hours after it was sent.
Request Body
NameDescription
tokenThe token from the verification link, at least 16 characters.
Errors
| Status | Code | When |
|---|---|---|
| 400 | validation_error | token is missing or shorter than 16 characters |
| 400 | bad_request | The token is unknown, already used or expired (Invalid or expired verification link) — send a new one |
Was this page helpful? Yes No
Previous
Next
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl -X POST https://api.syntext.dev/v1/auth/verify-email \
-H "Content-Type: application/json" \
-d '{ "token": "'"$VERIFY_TOKEN"'" }'
const response = await fetch('https://api.syntext.dev/v1/auth/verify-email', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
"token": "$VERIFY_TOKEN"
}),
});
const data = await response.json();
console.log(response.status, data);
import requests
url = "https://api.syntext.dev/v1/auth/verify-email"
payload = {
"token": "$VERIFY_TOKEN",
}
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": "$VERIFY_TOKEN"
}`)
req, err := http.NewRequest("POST", "https://api.syntext.dev/v1/auth/verify-email", 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/verify-email")
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" => "$VERIFY_TOKEN",
})
response = http.request(request)
puts response.code
puts response.body
<?php
$payload = [
'token' => '$VERIFY_TOKEN',
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.syntext.dev/v1/auth/verify-email',
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": "$VERIFY_TOKEN"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.syntext.dev/v1/auth/verify-email"))
.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/verify-email");
request.Content = new StringContent(
"""
{
"token": "$VERIFY_TOKEN"
}
""",
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": { "verified": true }
}