Users API Reference

Authentication

Get an access token to authenticate API requests.

HTTP Request

POST /api/v1/auth/login

cURL Example

curl -X POST https://api.eventstaffapp.com/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "your_email@example.com",
    "password": "your_password"
  }'

Example Response

{
    "success": true,
    "data": {
        "token": "6|abc123def456...",
        "user": {
            "id": 96351,
            "uuid": "e576fcde-c503-4d90-8d04-278e847cb7b8",
            "username": "testadmin",
            "email": "testadmin@example.com",
            "firstname": "Test",
            "lastname": "Admin",
            "is_admin": true
        }
    },
    "message": ""
}

List Users

Retrieve a paginated list of users. Requires admin permissions.

HTTP Request

GET /api/v1/objects/users

Query Parameters (via JSON body)

Parameter Type Description
business_id integer Filter by business ID
user_type integer Filter by user type
per_page integer Number of items per page (default: 15)

cURL Example

curl -X GET "https://api.eventstaffapp.com/api/v1/objects/users" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "business_id": 1,
    "user_type": 1,
    "per_page": 10
  }'

Example Response

{
    "success": true,
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 96351,
                "uuid": "e576fcde-c503-4d90-8d04-278e847cb7b8",
                "username": "testadmin",
                "email": "testadmin@example.com",
                "firstname": "Test",
                "lastname": "Admin",
                "business_id": 1,
                "user_type": 1,
                "is_admin": true,
                "is_manager": true
            }
        ],
        "per_page": 10,
        "total": 1
    },
    "message": ""
}

Get Single User

Retrieve details of a specific user. Requires admin permissions.

HTTP Request

GET /api/v1/objects/users/{uuid}

URL Parameters

Parameter Type Description
uuid string The UUID of the user

cURL Example

curl -X GET https://api.eventstaffapp.com/api/v1/objects/users/e576fcde-c503-4d90-8d04-278e847cb7b8 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"

Example Response

{
    "success": true,
    "data": {
        "id": 96351,
        "uuid": "e576fcde-c503-4d90-8d04-278e847cb7b8",
        "username": "testadmin",
        "email": "testadmin@example.com",
        "firstname": "Test",
        "lastname": "Admin",
        "business_id": 1,
        "user_type": 1,
        "staff_type_id": 1,
        "is_admin": true,
        "is_manager": true
    },
    "message": ""
}

Create User

Create a new user. Requires admin permissions.

HTTP Request

POST /api/v1/objects/users

Required Fields

Parameter Type Description
username string Unique username (max 50 chars)
email string Unique email address (max 200 chars)
password string Password (min 8 chars)
firstname string First name (max 200 chars)
lastname string Last name (max 200 chars)
business_id integer Business ID
user_type integer User type
staff_type_id integer Staff type ID

Optional Fields

Parameter Type Description
is_admin string "yes" or "no" (default: "no")
is_manager string "yes" or "no" (default: "no")
cellphone string Phone number
city, state, zip string Address information

cURL Example

curl -X POST https://api.eventstaffapp.com/api/v1/objects/users \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "newuser123",
    "email": "newuser@example.com",
    "password": "password123",
    "firstname": "New",
    "lastname": "User",
    "business_id": 1,
    "user_type": 1,
    "staff_type_id": 1,
    "is_admin": "no",
    "is_manager": "no",
    "cellphone": "555-1234",
    "city": "Los Angeles",
    "state": "CA",
    "zip": "90210"
  }'

Example Response

{
    "success": true,
    "data": {
        "uuid": "9e424c35-90eb-4f8d-9343-e678510f890e",
        "username": "newuser123",
        "email": "newuser@example.com",
        "firstname": "New",
        "lastname": "User",
        "business_id": 1,
        "user_type": 1,
        "staff_type_id": 1,
        "is_admin": false,
        "is_manager": false,
        "id": 96352
    },
    "message": "User created successfully"
}

Update User

Update an existing user. Admins can update any user. Regular users can only update their own profile.

HTTP Request

PUT /api/v1/objects/users/{uuid}

URL Parameters

Parameter Type Description
uuid string The UUID of the user to update

cURL Example

curl -X PUT https://api.eventstaffapp.com/api/v1/objects/users/9e424c35-90eb-4f8d-9343-e678510f890e \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "firstname": "Updated Name",
    "lastname": "Updated Last",
    "cellphone": "555-9999",
    "city": "San Francisco"
  }'

Example Response

{
    "success": true,
    "data": {
        "id": 96352,
        "uuid": "9e424c35-90eb-4f8d-9343-e678510f890e",
        "username": "newuser123",
        "email": "newuser@example.com",
        "firstname": "Updated Name",
        "lastname": "Updated Last",
        "cellphone": "555-9999",
        "city": "San Francisco",
        "business_id": 1,
        "user_type": 1,
        "is_admin": false,
        "is_manager": false
    },
    "message": "User updated successfully"
}

📝 Notes

  • • All user operations except authentication require a valid Bearer token
  • • Admin permissions are required for listing, viewing, and creating users
  • • Users can update their own profiles, admins can update any user
  • • UUIDs are used in URLs for user identification
  • • Passwords are automatically hashed using Bcrypt