Skip to main content
GET
/
users
Get All Users
curl --request GET \
  --url https://api.example.com/users
{
  "users": [
    {
      "id_user": 123,
      "first_name": "<string>",
      "last_name": "<string>",
      "email": "<string>",
      "password": "<string>",
      "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": {},
      "role": {},
      "createdAt": {},
      "updatedAt": {}
    }
  ]
}
Authentication Required: Bearer token
Role Required: ADMIN
Retrieves a list of all registered users in the platform. This endpoint is restricted to administrators only.

Authentication

This endpoint requires a valid JWT Bearer token with ADMIN role.
Authorization: Bearer <your_jwt_token>

Request

No parameters required.
cURL Example
curl -X GET https://api.marsai.com/users \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response

users
array
Array of user objects

Success Response

200 OK
[
  {
    "id_user": 1,
    "first_name": "Alice",
    "last_name": "Martin",
    "email": "alice.martin@example.com",
    "password": "$2b$10$XYZ...",
    "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",
    "youtube": "alicemartin",
    "instagram": "@alicemartin",
    "linkedin": "alice-martin",
    "facebook": "alice.martin",
    "tiktok": "@alicemartin",
    "known_by_mars_ai": "Par un ami",
    "role": "PRODUCER",
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-01-15T10:30:00.000Z"
  },
  {
    "id_user": 2,
    "first_name": "Jean",
    "last_name": "Dupont",
    "email": "jean.dupont@example.com",
    "password": "$2b$10$ABC...",
    "role": "ADMIN",
    "createdAt": "2025-01-10T08:00:00.000Z",
    "updatedAt": "2025-01-10T08:00:00.000Z"
  }
]

Error Responses

401 Unauthorized
{
  "error": "Token invalide ou manquant"
}
403 Forbidden
{
  "error": "Accès interdit. Rôle ADMIN requis."
}