curl --request POST \
--url https://api.example.com/auth/register \
--header 'Content-Type: application/json' \
--data '
{
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"password": "<string>",
"role": "<string>",
"phone": "<string>",
"mobile": "<string>",
"birth_date": "<string>",
"street": "<string>",
"postal_code": "<string>",
"city": "<string>",
"country": "<string>",
"biography": "<string>",
"job": "<string>",
"portfolio": "<string>",
"youtube": "<string>",
"instagram": "<string>",
"linkedin": "<string>",
"facebook": "<string>",
"tiktok": "<string>",
"known_by_mars_ai": "<string>"
}
'{
"message": "<string>",
"newUser": {
"id_user": 123,
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"role": "<string>",
"password": "<string>",
"phone": "<string>",
"mobile": "<string>",
"birth_date": "<string>",
"street": "<string>",
"postal_code": "<string>",
"city": "<string>",
"country": "<string>",
"biography": "<string>",
"job": "<string>",
"portfolio": "<string>",
"youtube": "<string>",
"instagram": "<string>",
"linkedin": "<string>",
"facebook": "<string>",
"tiktok": "<string>",
"known_by_mars_ai": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
}Create a new user account on the MarsAI platform
curl --request POST \
--url https://api.example.com/auth/register \
--header 'Content-Type: application/json' \
--data '
{
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"password": "<string>",
"role": "<string>",
"phone": "<string>",
"mobile": "<string>",
"birth_date": "<string>",
"street": "<string>",
"postal_code": "<string>",
"city": "<string>",
"country": "<string>",
"biography": "<string>",
"job": "<string>",
"portfolio": "<string>",
"youtube": "<string>",
"instagram": "<string>",
"linkedin": "<string>",
"facebook": "<string>",
"tiktok": "<string>",
"known_by_mars_ai": "<string>"
}
'{
"message": "<string>",
"newUser": {
"id_user": 123,
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"role": "<string>",
"password": "<string>",
"phone": "<string>",
"mobile": "<string>",
"birth_date": "<string>",
"street": "<string>",
"postal_code": "<string>",
"city": "<string>",
"country": "<string>",
"biography": "<string>",
"job": "<string>",
"portfolio": "<string>",
"youtube": "<string>",
"instagram": "<string>",
"linkedin": "<string>",
"facebook": "<string>",
"tiktok": "<string>",
"known_by_mars_ai": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
}firstName (camelCase)lastName (camelCase)PRODUCER: Film producer/submitterADMIN: Platform administratorJURY: Festival jury memberbirthDate (camelCase). If empty or ‘Invalid date’, will be set to null.postalCode (camelCase)knownByMarsAi (camelCase)curl -X POST https://api.marsai.com/auth/register \
-H "Content-Type: application/json" \
-d '{
"first_name": "Jane",
"last_name": "Doe",
"email": "jane.doe@example.com",
"password": "securePassword123",
"role": "PRODUCER",
"phone": "+33612345678",
"city": "Paris",
"country": "France",
"job": "Film Director",
"known_by_mars_ai": "Social media"
}'
const response = await fetch('https://api.marsai.com/auth/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
firstName: 'Jane', // camelCase also supported
lastName: 'Doe',
email: 'jane.doe@example.com',
password: 'securePassword123',
role: 'PRODUCER',
phone: '+33612345678',
city: 'Paris',
country: 'France',
job: 'Film Director'
})
});
const data = await response.json();
console.log(data);
Show newUser properties
{
"message": "Utilisateur créé avec succès",
"newUser": {
"id_user": 42,
"first_name": "Jane",
"last_name": "Doe",
"email": "jane.doe@example.com",
"password": "$2b$10$abcdefghijklmnopqrstuvwxyz1234567890",
"role": "PRODUCER",
"phone": "+33612345678",
"mobile": null,
"birth_date": null,
"street": null,
"postal_code": null,
"city": "Paris",
"country": "France",
"biography": null,
"job": "Film Director",
"portfolio": null,
"youtube": null,
"instagram": null,
"linkedin": null,
"facebook": null,
"tiktok": null,
"known_by_mars_ai": "Social media",
"createdAt": "2026-03-07T10:30:00.000Z",
"updatedAt": "2026-03-07T10:30:00.000Z"
}
}
{
"error": "Tous les champs sont requis"
}
first_name, last_name, email, password, or role is missing{
"error": "Données manquantes"
}
{
"message": "Cet utilisateur existe déjà",
"user": {
"id_user": 15,
"email": "jane.doe@example.com",
"first_name": "Jane",
"last_name": "Doe",
"role": "PRODUCER"
}
}
{
"error": "Erreur base de données",
"details": "Detailed error message"
}
User.findOne({ where: { email } }))hashPassword(password))firstName, lastName, birthDate, postalCode, knownByMarsAifirst_name, last_name, birth_date, postal_code, known_by_mars_aiback/src/controllers/UserController.js:82-178
function createUser(req, res) {
// Field mapping for camelCase/snake_case compatibility
let {
first_name, firstName,
last_name, lastName,
email, password, role,
// ... other fields
} = req.body;
first_name = first_name || firstName;
last_name = last_name || lastName;
// ... mapping for other fields
if (!role) {
role = "PRODUCER"; // Default role
}
// Validate required fields
if (!first_name || !last_name || !email || !password || !role) {
return res.status(400).json({ error: "Tous les champs sont requis" });
}
// Check for existing user
User.findOne({ where: { email } }).then(async (user) => {
if (user) {
res.json({ message: "Cet utilisateur existe déjà", user });
} else {
// Hash password and create user
const hash = await hashPassword(password);
User.create({
first_name, last_name, email,
password: hash, role,
// ... all other fields
})
.then((newUser) => {
res.status(201).json({
message: "Utilisateur créé avec succès",
newUser
});
});
}
});
}
back/src/routes/Auth.route.js:41