curl -X POST "https://api.tktchurch.com/v1/auth/signup" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securePassword123",
"firstName": "John",
"lastName": "Doe"
}'
const response = await fetch('https://api.tktchurch.com/v1/auth/signup', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: '[email protected]',
password: 'securePassword123',
firstName: 'John',
lastName: 'Doe'
})
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.error.reason);
}
struct SignupRequest: Encodable {
let email: String
let password: String
let firstName: String?
let lastName: String?
}
let request = SignupRequest(
email: "[email protected]",
password: "securePassword123",
firstName: "John",
lastName: "Doe"
)
var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/auth/signup")!)
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 == 201 {
print("Account created successfully")
} else {
let error = try JSONDecoder().decode(ErrorResponse.self, from: data)
throw error
}
data class SignupRequest(
val email: String,
val password: String,
val firstName: String?,
val lastName: String?
)
val client = OkHttpClient()
val request = SignupRequest(
email = "[email protected]",
password = "securePassword123",
firstName = "John",
lastName = "Doe"
)
val requestBody = request.toJson().toRequestBody("application/json".toMediaType())
val httpRequest = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/signup")
.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 ?: "Unknown error")
}
// Handle success
}
import axios from 'axios';
interface SignupRequest {
email: string;
password: string;
firstName?: string;
lastName?: string;
}
const signup = async (data: SignupRequest) => {
try {
const response = await axios.post(
'https://api.tktchurch.com/v1/auth/signup',
data,
{
headers: {
'Content-Type': 'application/json',
},
}
);
if (response.status === 201) {
// Handle success
return response.data;
}
} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(error.response?.data?.error?.reason || 'Signup failed');
}
throw error;
}
};
// Usage
await signup({
email: '[email protected]',
password: 'securePassword123',
firstName: 'John',
lastName: 'Doe'
});
{
"status": 201,
"message": "Account created successfully. Please check your email for verification."
}
{
"error": {
"status": 400,
"reason": "Email already exists"
}
}
{
"error": {
"status": 400,
"reason": "Validation error: password must be at least 6 characters"
}
}
{
"error": {
"status": 500,
"reason": "Default role not found"
}
}
Authentication
Create New Account
Create a new user account with email verification
POST
/
auth
/
signup
curl -X POST "https://api.tktchurch.com/v1/auth/signup" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securePassword123",
"firstName": "John",
"lastName": "Doe"
}'
const response = await fetch('https://api.tktchurch.com/v1/auth/signup', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: '[email protected]',
password: 'securePassword123',
firstName: 'John',
lastName: 'Doe'
})
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.error.reason);
}
struct SignupRequest: Encodable {
let email: String
let password: String
let firstName: String?
let lastName: String?
}
let request = SignupRequest(
email: "[email protected]",
password: "securePassword123",
firstName: "John",
lastName: "Doe"
)
var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/auth/signup")!)
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 == 201 {
print("Account created successfully")
} else {
let error = try JSONDecoder().decode(ErrorResponse.self, from: data)
throw error
}
data class SignupRequest(
val email: String,
val password: String,
val firstName: String?,
val lastName: String?
)
val client = OkHttpClient()
val request = SignupRequest(
email = "[email protected]",
password = "securePassword123",
firstName = "John",
lastName = "Doe"
)
val requestBody = request.toJson().toRequestBody("application/json".toMediaType())
val httpRequest = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/signup")
.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 ?: "Unknown error")
}
// Handle success
}
import axios from 'axios';
interface SignupRequest {
email: string;
password: string;
firstName?: string;
lastName?: string;
}
const signup = async (data: SignupRequest) => {
try {
const response = await axios.post(
'https://api.tktchurch.com/v1/auth/signup',
data,
{
headers: {
'Content-Type': 'application/json',
},
}
);
if (response.status === 201) {
// Handle success
return response.data;
}
} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(error.response?.data?.error?.reason || 'Signup failed');
}
throw error;
}
};
// Usage
await signup({
email: '[email protected]',
password: 'securePassword123',
firstName: 'John',
lastName: 'Doe'
});
{
"status": 201,
"message": "Account created successfully. Please check your email for verification."
}
{
"error": {
"status": 400,
"reason": "Email already exists"
}
}
{
"error": {
"status": 400,
"reason": "Validation error: password must be at least 6 characters"
}
}
{
"error": {
"status": 500,
"reason": "Default role not found"
}
}
This is a public endpoint that does not require authentication.
Request Body
string
required
Email address for the new account. Must be unique in the system.
string
required
Password for the account. Must be at least 6 characters long.
string
User’s first name. Maximum 50 characters.
string
User’s last name. Maximum 50 characters.
Response
A successful request returns HTTP 201 Created status. The user will receive:- A verification email with a token to verify their email address
- A welcome email
The account is created with:
- Status:
active - Provider:
local - Role:
Member(default role) emailVerified: falsephoneNumberVerified: false
Error Responses
object
Common error cases:
- 400 Bad Request: Invalid email format or password too short
- 400 Bad Request: Email already exists
- 500 Internal Server Error: Default role not found
curl -X POST "https://api.tktchurch.com/v1/auth/signup" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securePassword123",
"firstName": "John",
"lastName": "Doe"
}'
const response = await fetch('https://api.tktchurch.com/v1/auth/signup', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: '[email protected]',
password: 'securePassword123',
firstName: 'John',
lastName: 'Doe'
})
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.error.reason);
}
struct SignupRequest: Encodable {
let email: String
let password: String
let firstName: String?
let lastName: String?
}
let request = SignupRequest(
email: "[email protected]",
password: "securePassword123",
firstName: "John",
lastName: "Doe"
)
var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/auth/signup")!)
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 == 201 {
print("Account created successfully")
} else {
let error = try JSONDecoder().decode(ErrorResponse.self, from: data)
throw error
}
data class SignupRequest(
val email: String,
val password: String,
val firstName: String?,
val lastName: String?
)
val client = OkHttpClient()
val request = SignupRequest(
email = "[email protected]",
password = "securePassword123",
firstName = "John",
lastName = "Doe"
)
val requestBody = request.toJson().toRequestBody("application/json".toMediaType())
val httpRequest = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/signup")
.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 ?: "Unknown error")
}
// Handle success
}
import axios from 'axios';
interface SignupRequest {
email: string;
password: string;
firstName?: string;
lastName?: string;
}
const signup = async (data: SignupRequest) => {
try {
const response = await axios.post(
'https://api.tktchurch.com/v1/auth/signup',
data,
{
headers: {
'Content-Type': 'application/json',
},
}
);
if (response.status === 201) {
// Handle success
return response.data;
}
} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(error.response?.data?.error?.reason || 'Signup failed');
}
throw error;
}
};
// Usage
await signup({
email: '[email protected]',
password: 'securePassword123',
firstName: 'John',
lastName: 'Doe'
});
{
"status": 201,
"message": "Account created successfully. Please check your email for verification."
}
{
"error": {
"status": 400,
"reason": "Email already exists"
}
}
{
"error": {
"status": 400,
"reason": "Validation error: password must be at least 6 characters"
}
}
{
"error": {
"status": 500,
"reason": "Default role not found"
}
}
