Skip to main content
POST
/
users
Create User
curl --request POST \
  --url https://api.example.com/users \
  --header 'Content-Type: application/json' \
  --data '
{
  "first_name": "<string>",
  "last_name": "<string>",
  "email": "<string>",
  "password": "<string>",
  "role": {},
  "phone": "<string>",
  "mobile": "<string>",
  "birth_date": "<string>",
  "street": "<string>",
  "postal_code": "<string>",
  "city": "<string>",
  "country": "<string>",
  "biography": "<string>",
  "job": {},
  "portfolio": "<string>",
  "youtube": "<string>",
  "instagram": "<string>",
  "linkedin": "<string>",
  "facebook": "<string>",
  "tiktok": "<string>",
  "known_by_mars_ai": {}
}
'
{
  "message": "<string>",
  "newUser": {
    "id_user": 123,
    "first_name": "<string>",
    "last_name": "<string>",
    "email": "<string>",
    "password": "<string>",
    "role": {},
    "createdAt": {},
    "updatedAt": {}
  }
}
Authentication Required: No (Public endpoint)
Creates a new user account in the platform. This endpoint is public to allow user registration and admin user creation from the admin panel.

Request Body

first_name
string
required
User’s first name (or firstName in camelCase)
last_name
string
required
User’s last name (or lastName in camelCase)
email
string
required
User’s email address (must be unique)
password
string
required
User’s password (will be hashed with bcrypt)
role
enum
User role: ADMIN, JURY, PRODUCER (default: PRODUCER)
phone
string
Landline phone number
mobile
string
Mobile phone number
birth_date
date
Date of birth (or birthDate in camelCase). Format: YYYY-MM-DD
street
string
Street address
postal_code
string
Postal code (or postalCode in camelCase)
city
string
City
country
string
Country
biography
string
Professional biography (max 255 characters)
job
enum
Professional role: ACTOR, DIRECTOR, PRODUCER, WRITER, OTHER
portfolio
string
Portfolio URL
youtube
string
YouTube profile
instagram
string
Instagram handle
linkedin
string
LinkedIn profile
facebook
string
Facebook profile
tiktok
string
TikTok handle
known_by_mars_ai
enum
How user discovered MarsAI: Par un ami, Vu une publicité du festival, Via le site internet ou application de l'IA (or knownByMarsAi in camelCase)
The API accepts both snake_case (e.g., first_name) and camelCase (e.g., firstName) field names for compatibility.

Request

cURL Example
curl -X POST https://api.marsai.com/users \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "Alice",
    "lastName": "Martin",
    "email": "alice.martin@example.com",
    "password": "SecurePass123!",
    "role": "PRODUCER",
    "phone": "+33123456789",
    "mobile": "+33612345678",
    "birthDate": "1990-05-15",
    "street": "123 Rue de la Paix",
    "postalCode": "75001",
    "city": "Paris",
    "country": "France",
    "biography": "Award-winning independent filmmaker",
    "job": "DIRECTOR",
    "portfolio": "https://alicemartin.com",
    "instagram": "@alicemartin",
    "linkedin": "alice-martin",
    "knownByMarsAi": "Par un ami"
  }'

Response

message
string
Success or error message
newUser
object
The newly created user object

Success Response

201 Created
{
  "message": "Utilisateur créé avec succès",
  "newUser": {
    "id_user": 1,
    "first_name": "Alice",
    "last_name": "Martin",
    "email": "alice.martin@example.com",
    "password": "$2b$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy",
    "phone": "+33123456789",
    "mobile": "+33612345678",
    "birth_date": "1990-05-15T00:00:00.000Z",
    "street": "123 Rue de la Paix",
    "postal_code": "75001",
    "city": "Paris",
    "country": "France",
    "biography": "Award-winning independent filmmaker",
    "job": "DIRECTOR",
    "portfolio": "https://alicemartin.com",
    "instagram": "@alicemartin",
    "linkedin": "alice-martin",
    "known_by_mars_ai": "Par un ami",
    "role": "PRODUCER",
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-01-15T10:30:00.000Z"
  }
}

User Already Exists

200 OK
{
  "message": "Cet utilisateur existe déjà",
  "user": {
    "id_user": 1,
    "first_name": "Alice",
    "last_name": "Martin",
    "email": "alice.martin@example.com",
    "role": "PRODUCER"
  }
}

Error Responses

400 Bad Request - Missing Data
{
  "error": "Données manquantes"
}
400 Bad Request - Missing Required Fields
{
  "error": "Tous les champs sont requis"
}
500 Internal Server Error
{
  "error": "Erreur base de données",
  "details": "Validation error message"
}

Validation Rules

  • Required fields: first_name, last_name, email, password
  • Email: Must be unique in the system
  • Password: Will be hashed using bcrypt with 10 salt rounds
  • birth_date: Invalid dates are automatically set to null
  • role: Defaults to PRODUCER if not specified
  • Field name compatibility: Both snake_case and camelCase are accepted