Skip to content

Users

The Users API allows you to manage user accounts, including creating, reading, updating, and deleting users. Most user operations require authentication and appropriate permissions.

List Users

Retrieve a paginated list of users.

Endpoint

GET /v1/users/

Authentication

This endpoint requires authentication with a valid Bearer token.

Query Parameters

Parameter Type Required Default Description
skip integer No 0 Number of users to skip
limit integer No 100 Maximum number of users to return

Example Request

curl -X GET "https://fav3.vibemobi.com/v1/users/?skip=0&limit=10" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response

{
    "data": [
        {
            "username": "john_doe",
            "email": "john@example.com",
            "is_active": true,
            "is_superuser": false,
            "is_staff": false,
            "full_name": "John Doe",
            "id": "123e4567-e89b-12d3-a456-426614174000"
        }
    ],
    "count": 1
}

Create User

Create a new user account (requires admin privileges).

Endpoint

POST /v1/users/

Authentication

This endpoint requires authentication with admin privileges.

Request Body

Parameter Type Required Description
username string Yes Username (3-50 characters)
email string Yes Valid email address
password string Yes Password (8-40 characters)
is_active boolean No Whether user is active (default: true)
is_superuser boolean No Whether user is superuser (default: false)
is_staff boolean No Whether user is staff (default: false)
full_name string No Full name of the user

Example Request

curl -X POST https://fav3.vibemobi.com/v1/users/ \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "username": "jane_doe",
    "email": "jane@example.com",
    "password": "secure_password",
    "full_name": "Jane Doe",
    "is_active": true
  }'

Response

{
    "username": "jane_doe",
    "email": "jane@example.com",
    "is_active": true,
    "is_superuser": false,
    "is_staff": false,
    "full_name": "Jane Doe",
    "id": "456e7890-e89b-12d3-a456-426614174001"
}

Get Current User

Get the profile of the currently authenticated user.

Endpoint

GET /v1/users/me

Authentication

This endpoint requires authentication.

Example Request

curl -X GET https://fav3.vibemobi.com/v1/users/me \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response

{
    "username": "john_doe",
    "email": "john@example.com",
    "is_active": true,
    "is_superuser": false,
    "is_staff": false,
    "full_name": "John Doe",
    "id": "123e4567-e89b-12d3-a456-426614174000"
}

Update Current User

Update the profile of the currently authenticated user.

Endpoint

PATCH /v1/users/me

Authentication

This endpoint requires authentication.

Request Body

Parameter Type Required Description
username string No New username (3-50 characters)
email string No New email address
full_name string No New full name

Example Request

curl -X PATCH https://fav3.vibemobi.com/v1/users/me \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "full_name": "John Smith",
    "email": "john.smith@example.com"
  }'

Response

{
    "username": "john_doe",
    "email": "john.smith@example.com",
    "is_active": true,
    "is_superuser": false,
    "is_staff": false,
    "full_name": "John Smith",
    "id": "123e4567-e89b-12d3-a456-426614174000"
}

Delete Current User

Delete the currently authenticated user's account.

Endpoint

DELETE /v1/users/me

Authentication

This endpoint requires authentication.

Example Request

curl -X DELETE https://fav3.vibemobi.com/v1/users/me \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response

{
    "message": "User deleted successfully"
}

Update Password

Update the password for the currently authenticated user.

Endpoint

PATCH /v1/users/me/password

Authentication

This endpoint requires authentication.

Request Body

Parameter Type Required Description
current_password string Yes Current password (8-40 characters)
new_password string Yes New password (8-40 characters)

Example Request

curl -X PATCH https://fav3.vibemobi.com/v1/users/me/password \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "current_password": "old_password",
    "new_password": "new_secure_password"
  }'

Response

{
    "message": "Password updated successfully"
}

Register User (Public)

Register a new user account without authentication (public endpoint).

Endpoint

POST /v1/users/signup

Authentication

This endpoint does not require authentication.

Request Body

Parameter Type Required Description
username string Yes Username (3-50 characters)
email string Yes Valid email address
password string Yes Password (8-40 characters)
full_name string No Full name of the user

Example Request

curl -X POST https://fav3.vibemobi.com/v1/users/signup \
  -H "Content-Type: application/json" \
  -d '{
    "username": "new_user",
    "email": "newuser@example.com",
    "password": "secure_password",
    "full_name": "New User"
  }'

Response

{
    "username": "new_user",
    "email": "newuser@example.com",
    "is_active": true,
    "is_superuser": false,
    "is_staff": false,
    "full_name": "New User",
    "id": "789e0123-e89b-12d3-a456-426614174002"
}

Get User by ID

Get a specific user by their ID (requires admin privileges).

Endpoint

GET /v1/users/{user_id}

Authentication

This endpoint requires authentication with admin privileges.

Path Parameters

Parameter Type Required Description
user_id string Yes UUID of the user

Example Request

curl -X GET https://fav3.vibemobi.com/v1/users/123e4567-e89b-12d3-a456-426614174000 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response

{
    "username": "john_doe",
    "email": "john@example.com",
    "is_active": true,
    "is_superuser": false,
    "is_staff": false,
    "full_name": "John Doe",
    "id": "123e4567-e89b-12d3-a456-426614174000"
}

Update User by ID

Update a specific user by their ID (requires admin privileges).

Endpoint

PATCH /v1/users/{user_id}

Authentication

This endpoint requires authentication with admin privileges.

Path Parameters

Parameter Type Required Description
user_id string Yes UUID of the user

Request Body

Parameter Type Required Description
username string No New username (3-50 characters)
email string No New email address
is_active boolean No Whether user is active
is_superuser boolean No Whether user is superuser
is_staff boolean No Whether user is staff
full_name string No New full name
password string No New password (8-40 characters)

Example Request

curl -X PATCH https://fav3.vibemobi.com/v1/users/123e4567-e89b-12d3-a456-426614174000 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "is_active": false,
    "full_name": "John Doe (Inactive)"
  }'

Response

{
    "username": "john_doe",
    "email": "john@example.com",
    "is_active": false,
    "is_superuser": false,
    "is_staff": false,
    "full_name": "John Doe (Inactive)",
    "id": "123e4567-e89b-12d3-a456-426614174000"
}

Delete User by ID

Delete a specific user by their ID (requires admin privileges).

Endpoint

DELETE /v1/users/{user_id}

Authentication

This endpoint requires authentication with admin privileges.

Path Parameters

Parameter Type Required Description
user_id string Yes UUID of the user

Example Request

curl -X DELETE https://fav3.vibemobi.com/v1/users/123e4567-e89b-12d3-a456-426614174000 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response

{
    "message": "User deleted successfully"
}

Error Responses

Validation Error

{
    "detail": [
        {
            "loc": ["body", "email"],
            "msg": "field required",
            "type": "value_error.missing"
        }
    ]
}

User Not Found

{
    "detail": "User not found"
}

Insufficient Permissions

{
    "detail": "Not enough permissions"
}

User Permissions

  • Regular users can only access and modify their own profile (/v1/users/me endpoints)
  • Admin users can access and modify any user account
  • The /v1/users/signup endpoint is public and doesn't require authentication
  • User creation via /v1/users/ requires admin privileges