curl --request POST \
--url https://api.example.com/api/v1/auth/ensure-user{
"success": true,
"message": "User ensured in Engine and DBStorage"
}
Ensure a user is created in Engine and Database Storage services
curl --request POST \
--url https://api.example.com/api/v1/auth/ensure-user{
"success": true,
"message": "User ensured in Engine and DBStorage"
}
Forces the creation of a user in the Engine and Database Storage services. This endpoint is useful for ensuring a user exists across all system components, even if they were already in the database.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/lakshay-goyal/Exness/llms.txt
Use this file to discover all available pages before exploring further.
Authorization: Bearer <your_jwt_token>
curl -X POST "http://localhost:8000/api/v1/auth/ensure-user" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"success": true,
"message": "User ensured in Engine and DBStorage"
}
{
"success": true,
"message": "User creation initiated"
}
{
"error": "No token provided."
}
{
"error": "Invalid or expired token."
}
{
"error": "Invalid token payload."
}
{
"error": "Failed to ensure user, but request was sent to Engine"
}
createUser message to Redis Streams/verify-user, this endpoint always sends the user creation request to the Engine, regardless of whether the user exists in the database. This ensures consistency across all system components.
const recoverUserState = async (token) => {
try {
const result = await fetch('http://localhost:8000/api/v1/auth/ensure-user', {
method: 'POST',
headers: { 'Authorization': `Bearer ${token}` }
});
const data = await result.json();
if (data.success) {
console.log('User state synchronized across all services');
return true;
}
return false;
} catch (error) {
console.error('Failed to ensure user:', error);
return false;
}
};
const onboardNewUser = async (token) => {
// Step 1: Ensure user is created in all services
const ensureResult = await fetch('http://localhost:8000/api/v1/auth/ensure-user', {
method: 'POST',
headers: { 'Authorization': `Bearer ${token}` }
});
if (!ensureResult.ok) {
throw new Error('Failed to initialize user');
}
// Step 2: Proceed with onboarding
return { ready: true };
};