curl -X POST "https://api.tktchurch.com/v1/auth/resend-verification" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]"
}'
const resendVerification = async (email) => {
const response = await fetch(
'https://api.tktchurch.com/v1/auth/resend-verification',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email })
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.error.reason);
}
return response.status === 200;
};
// Usage
try {
await resendVerification('[email protected]');
console.log('Verification email sent successfully');
} catch (error) {
console.error('Failed to resend verification:', error.message);
}
struct ResendVerificationRequest: Encodable {
let email: String
}
func resendVerification(email: String) async throws {
let request = ResendVerificationRequest(email: email)
var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/auth/resend-verification")!)
urlRequest.httpMethod = "POST"
urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
urlRequest.httpBody = try? JSONEncoder().encode(request)
let (data, response) = try await URLSession.shared.data(for: urlRequest)
guard let httpResponse = response as? HTTPURLResponse else {
throw URLError(.badServerResponse)
}
if httpResponse.statusCode != 200 {
let error = try JSONDecoder().decode(ErrorResponse.self, from: data)
throw error
}
}
// Usage
do {
try await resendVerification(email: "[email protected]")
print("Verification email sent successfully")
} catch {
print("Failed to resend verification: \(error.localizedDescription)")
}
data class ResendVerificationRequest(
val email: String
)
class EmailVerificationService(private val client: OkHttpClient) {
suspend fun resendVerification(email: String) {
val request = ResendVerificationRequest(email)
val requestBody = request.toJson()
.toRequestBody("application/json".toMediaType())
val httpRequest = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/resend-verification")
.post(requestBody)
.header("Content-Type", "application/json")
.build()
client.newCall(httpRequest).execute().use { response ->
if (!response.isSuccessful) {
val error = response.body?.string()?.fromJson<ErrorResponse>()
throw Exception(error?.reason ?: "Failed to resend verification")
}
}
}
}
// Usage
try {
emailVerificationService.resendVerification("[email protected]")
println("Verification email sent successfully")
} catch (e: Exception) {
println("Failed to resend verification: ${e.message}")
}
import axios from 'axios';
interface ResendVerificationRequest {
email: string;
}
const resendVerification = async (email: string): Promise<boolean> => {
try {
const response = await axios.post(
'https://api.tktchurch.com/v1/auth/resend-verification',
{ email },
{
headers: {
'Content-Type': 'application/json',
},
}
);
return response.status === 200;
} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(error.response?.data?.error?.reason || 'Failed to resend verification');
}
throw error;
}
};
// Usage
try {
await resendVerification('[email protected]');
console.log('Verification email sent successfully');
} catch (error) {
console.error('Failed to resend verification:', error.message);
}
{
"status": 200,
"message": "Verification email sent successfully"
}
{
"error": {
"status": 400,
"reason": "Invalid email format"
}
}
{
"error": {
"status": 400,
"reason": "Email is already verified"
}
}
{
"error": {
"status": 404,
"reason": "User not found"
}
}
Authentication
Resend Verification Email
Resend the email verification link to a user
POST
/
auth
/
resend-verification
curl -X POST "https://api.tktchurch.com/v1/auth/resend-verification" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]"
}'
const resendVerification = async (email) => {
const response = await fetch(
'https://api.tktchurch.com/v1/auth/resend-verification',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email })
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.error.reason);
}
return response.status === 200;
};
// Usage
try {
await resendVerification('[email protected]');
console.log('Verification email sent successfully');
} catch (error) {
console.error('Failed to resend verification:', error.message);
}
struct ResendVerificationRequest: Encodable {
let email: String
}
func resendVerification(email: String) async throws {
let request = ResendVerificationRequest(email: email)
var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/auth/resend-verification")!)
urlRequest.httpMethod = "POST"
urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
urlRequest.httpBody = try? JSONEncoder().encode(request)
let (data, response) = try await URLSession.shared.data(for: urlRequest)
guard let httpResponse = response as? HTTPURLResponse else {
throw URLError(.badServerResponse)
}
if httpResponse.statusCode != 200 {
let error = try JSONDecoder().decode(ErrorResponse.self, from: data)
throw error
}
}
// Usage
do {
try await resendVerification(email: "[email protected]")
print("Verification email sent successfully")
} catch {
print("Failed to resend verification: \(error.localizedDescription)")
}
data class ResendVerificationRequest(
val email: String
)
class EmailVerificationService(private val client: OkHttpClient) {
suspend fun resendVerification(email: String) {
val request = ResendVerificationRequest(email)
val requestBody = request.toJson()
.toRequestBody("application/json".toMediaType())
val httpRequest = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/resend-verification")
.post(requestBody)
.header("Content-Type", "application/json")
.build()
client.newCall(httpRequest).execute().use { response ->
if (!response.isSuccessful) {
val error = response.body?.string()?.fromJson<ErrorResponse>()
throw Exception(error?.reason ?: "Failed to resend verification")
}
}
}
}
// Usage
try {
emailVerificationService.resendVerification("[email protected]")
println("Verification email sent successfully")
} catch (e: Exception) {
println("Failed to resend verification: ${e.message}")
}
import axios from 'axios';
interface ResendVerificationRequest {
email: string;
}
const resendVerification = async (email: string): Promise<boolean> => {
try {
const response = await axios.post(
'https://api.tktchurch.com/v1/auth/resend-verification',
{ email },
{
headers: {
'Content-Type': 'application/json',
},
}
);
return response.status === 200;
} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(error.response?.data?.error?.reason || 'Failed to resend verification');
}
throw error;
}
};
// Usage
try {
await resendVerification('[email protected]');
console.log('Verification email sent successfully');
} catch (error) {
console.error('Failed to resend verification:', error.message);
}
{
"status": 200,
"message": "Verification email sent successfully"
}
{
"error": {
"status": 400,
"reason": "Invalid email format"
}
}
{
"error": {
"status": 400,
"reason": "Email is already verified"
}
}
{
"error": {
"status": 404,
"reason": "User not found"
}
}
This is a public endpoint that does not require authentication.
Request Body
string
required
The email address of the user who needs a new verification link. Must be a valid email format.
Response
A successful request returns HTTP 200 OK status. A new verification email will be sent to the provided email address if:- The user exists in the system
- Their email is not already verified
Error Responses
object
Common error cases:
- 400 Bad Request: Invalid email format
- 400 Bad Request: Email is already verified
- 404 Not Found: User not found
curl -X POST "https://api.tktchurch.com/v1/auth/resend-verification" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]"
}'
const resendVerification = async (email) => {
const response = await fetch(
'https://api.tktchurch.com/v1/auth/resend-verification',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email })
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.error.reason);
}
return response.status === 200;
};
// Usage
try {
await resendVerification('[email protected]');
console.log('Verification email sent successfully');
} catch (error) {
console.error('Failed to resend verification:', error.message);
}
struct ResendVerificationRequest: Encodable {
let email: String
}
func resendVerification(email: String) async throws {
let request = ResendVerificationRequest(email: email)
var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/auth/resend-verification")!)
urlRequest.httpMethod = "POST"
urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
urlRequest.httpBody = try? JSONEncoder().encode(request)
let (data, response) = try await URLSession.shared.data(for: urlRequest)
guard let httpResponse = response as? HTTPURLResponse else {
throw URLError(.badServerResponse)
}
if httpResponse.statusCode != 200 {
let error = try JSONDecoder().decode(ErrorResponse.self, from: data)
throw error
}
}
// Usage
do {
try await resendVerification(email: "[email protected]")
print("Verification email sent successfully")
} catch {
print("Failed to resend verification: \(error.localizedDescription)")
}
data class ResendVerificationRequest(
val email: String
)
class EmailVerificationService(private val client: OkHttpClient) {
suspend fun resendVerification(email: String) {
val request = ResendVerificationRequest(email)
val requestBody = request.toJson()
.toRequestBody("application/json".toMediaType())
val httpRequest = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/resend-verification")
.post(requestBody)
.header("Content-Type", "application/json")
.build()
client.newCall(httpRequest).execute().use { response ->
if (!response.isSuccessful) {
val error = response.body?.string()?.fromJson<ErrorResponse>()
throw Exception(error?.reason ?: "Failed to resend verification")
}
}
}
}
// Usage
try {
emailVerificationService.resendVerification("[email protected]")
println("Verification email sent successfully")
} catch (e: Exception) {
println("Failed to resend verification: ${e.message}")
}
import axios from 'axios';
interface ResendVerificationRequest {
email: string;
}
const resendVerification = async (email: string): Promise<boolean> => {
try {
const response = await axios.post(
'https://api.tktchurch.com/v1/auth/resend-verification',
{ email },
{
headers: {
'Content-Type': 'application/json',
},
}
);
return response.status === 200;
} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(error.response?.data?.error?.reason || 'Failed to resend verification');
}
throw error;
}
};
// Usage
try {
await resendVerification('[email protected]');
console.log('Verification email sent successfully');
} catch (error) {
console.error('Failed to resend verification:', error.message);
}
{
"status": 200,
"message": "Verification email sent successfully"
}
{
"error": {
"status": 400,
"reason": "Invalid email format"
}
}
{
"error": {
"status": 400,
"reason": "Email is already verified"
}
}
{
"error": {
"status": 404,
"reason": "User not found"
}
}
