Users

This page covers all API endpoints for users

Retrieve all users

GET https://wemx.app/api/v1/users

Returns a list of all users on your application

{
    "status": true,
    "current_page": 1,
    "data": [
        {
            "id": 913,
            "username": "blanca.oberbrunner",
            "email": "demetris.schultz@example.net",
            "first_name": "Rosalinda",
            "last_name": "Howe",
            "status": "active",
            "balance": 0,
            "avatar": null,
            "is_subscribed": 0,
            "visibility": "online",
            "language": "en",
            "data": null,
            "email_verified_at": "2024-01-08T19:06:37.000000Z",
            "last_seen_at": "2024-01-08T20:06:38.000000Z",
            "last_login_at": "2024-01-08T20:06:38.000000Z",
            "created_at": "2024-01-08T19:06:38.000000Z",
            "updated_at": "2024-01-08T19:06:38.000000Z"
        },
    ],
    "first_page_url": "http://wemx.app/api/v1/users?page=1",
    "from": 1,
    "last_page": 99,
    "last_page_url": "http://wemx.app/api/v1/users?page=99",
    "links": [
        {
            "url": null,
            "label": "Previous",
            "active": false
        },
        {
            "url": "http://wemx.app/api/v1/users?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": null,
            "label": "...",
            "active": false
        },
        {
            "url": "http://wemx.app/api/v1/users?page=98",
            "label": "98",
            "active": false
        },
        {
            "url": "http://wemx.app/api/v1/users?page=99",
            "label": "99",
            "active": false
        },
        {
            "url": "http://wemx.app/api/v1/users?page=2",
            "label": "Next",
            "active": false
        }
    ],
    "next_page_url": "http://wemx.app/api/v1/users?page=2",
    "path": "http://wemx.app/api/v1/users",
    "per_page": 15,
    "prev_page_url": null,
    "to": 15,
    "total": 1473
}
```

Available Relationships (optional)

https://wemx.app/api/v1/users?include=address,orders,payments

Available relationships:

balance_transactions, notifications, punishments, permissions, affiliate, suborder, orders, payments, devices, address, groups, emails, oauth, ips

Filters (optional)

https://wemx.app/api/v1/users?filter[is_online]=1&filter[is_subscribed]=1

Available Filters:

first_name, last_name, username, email, is_subscribed, is_online, created_at

Sorting (optional)

https://wemx.app/api/v1/users?sort[balance]=asc

Available Sorting Parameters:

first_name, last_name, username, email, balance, created_at

Sorting operators

asc, desc, random

Dates (optional)

https://wemx.app/api/v1/users?date=30days
OperatorDescription

today

Get users created today

yesterday

Get users created yesterday

3days, 7days, 14days, 30days, 90days

Get users created last x days

YYYY-MM-DD,YYY-MM-DD

Get users created between a range of dates

Create a user

POST https://wemx.app/api/v1/users

Create a user on your application

Path Parameters

NameTypeDescription

first_name*

String

First name of the user

last_name*

String

Last name of the user

username*

String

Username of the user

email*

String

Email of the user

password

String

Password of the user, leave empty to generate random password and email it

language

Code

Language code i.e "en"

address[company_name]

String

Company name

address[street]

String

Street name of address

address[street2]

String

Second street name

address[city]

String

Name of city of the address

address[region]

String

Name of the state / province / region

address[country]

Code

Country code i.e "US", "DE", "NL"

address[zip_code]

String

Zip code of the address

welcome_email

Boolean

Send an welcome email upon creation or not

mark_email_verified

Boolean

Mark email as verified upon creation

{
    "success": true,
    "data": {
        "username": "johndoe",
        "email": "johndoe@example.com",
        "language": "en",
        "first_name": "John",
        "last_name": "Doe",
        "status": "active",
        "last_login_at": "2024-01-09T18:06:58.000000Z",
        "updated_at": "2024-01-09T18:06:58.000000Z",
        "created_at": "2024-01-09T18:06:58.000000Z",
        "id": 2389,
        "address": {
            "id": 2256,
            "user_id": 2389,
            "company_name": null,
            "address": null,
            "address_2": null,
            "country": null,
            "city": null,
            "region": null,
            "zip_code": null,
            "created_at": "2024-01-09T18:06:58.000000Z",
            "updated_at": "2024-01-09T18:06:58.000000Z"
        }
    }
}

Get current authenticated user

GET https://wemx.app/api/v1/users/auth

Returns the current user that is logged in

{
   "status":true,
   "data":{
      "id": 523,
      "username": "johnsmith_",
      "email": "johnsmith@example.com",
      "first_name": "John",
      "last_name": "Smith",
      "language": "en",
      "avatar": "https://wemx.app/storage/avatars/8BKePJmpruAE4OV0.png",
      "status": "active",
      "is_subscribed": false,
      "is_email_verified": true,
      "last_seen_at": "2024-01-31T13:46:41.000000Z",
      "last_login_at": "2024-01-20T22:38:22.000000Z",
      "created_at": "2023-12-12T14:06:33.000000Z"
   }
}

Retrieve a user from id

GET https://wemx.app/api/v1/users/{user}

Returns a user from id

Query Parameters

NameTypeDescription

balance_transactions

Returns user with their balance transactions

notifications

String

User with their notifications

payments

String

Users with their payments

orders

String

Users with their orders

suborders

String

Users with their suborders

affiliate

String

User with their affiliate info

permissions

String

User with their permissions

punishments

String

User with their punishments

address

String

Users with their address

devices

String

Users with their devices

groups

String

Users with their groups

emails

String

Users with their emails

oauth

String

Users with their oauth services

ips

String

Users with their IP Addresses

{
    "status": true,
    "data": {
        "id": 913,
        "username": "blanca.oberbrunner",
        "email": "demetris.schultz@example.net",
        "first_name": "Rosalinda",
        "last_name": "Howe",
        "status": "active",
        "balance": 0,
        "avatar": null,
        "is_subscribed": 0,
        "visibility": "online",
        "language": "en",
        "data": null,
        "email_verified_at": "2024-01-08T19:06:37.000000Z",
        "last_seen_at": "2024-01-08T20:06:38.000000Z",
        "last_login_at": "2024-01-08T20:06:38.000000Z",
        "created_at": "2024-01-08T19:06:38.000000Z",
        "updated_at": "2024-01-08T19:06:38.000000Z"
    }
}

Update user details

PUT https://wemx.app/api/v1/users/{user}

Update a users information, only values that are passed in the body are updated, the remaining values remain as default if they are not specified.

Request Body

NameTypeDescription

first_name

String

First name of the user

last_name

String

Last name of the user

username

String

Username of the user

password

String

Password of the user

language

Code

String of the user "en"

{
    "success": true,
    "data": {
        "id": 2389,
        "username": "johndoe",
        "email": "johndoe@example.com",
        "first_name": "John",
        "last_name": "Doe",
        "status": "active",
        "balance": 0,
        "avatar": null,
        "is_subscribed": 0,
        "visibility": "online",
        "language": "en",
        "data": null,
        "email_verified_at": null,
        "last_seen_at": "2024-01-09T19:06:58.000000Z",
        "last_login_at": "2024-01-09T18:06:58.000000Z",
        "created_at": "2024-01-09T18:06:58.000000Z",
        "updated_at": "2024-01-09T18:06:58.000000Z"
    }
}

Delete a user

DELETE https://wemx.app/api/v1/users/{user}

Delete a user permanently from your application. The user cannot have any active, or suspended orders and must not have any punishments on record.

Request Body

NameTypeDescription

force

Boolean

Delete user forcefully, ignores whether the user has active orders or has punishments on record.

{
    "success": true,
    "message": "User deleted successfully"
}

Retrieve orders for a user

GET https://wemx.app/api/v1/users/{user}/orders

Returns all orders the user owns

Retrieve payments for a user

GET https://wemx.app/api/v1/users/{user}/payments

Returns all payments the user has made

Update user balance

PUT https://wemx.app/api/v1/users/{user}/update-balance

Update a users balance

Path Parameters

NameTypeDescription

type*

Enum

add, remove or set

amount*

Number

The amount you wish to update

description

String

Description of the transaction

{
    "success": true,
    "message": "Balance updated successfully"
}

Send a user an email

POST https://wemx.app/api/v1/users/{user}/send-email

Email the user through your application

Path Parameters

NameTypeDescription

subject*

String

Subject of the email

content*

String

Content of the email, HTML is supported

{
    "success": true,
    "message": "Email sent successfully"
}

Notify a user

POST https://wemx.app/api/v1/users/{user}/send-notification

Send a notification to the user

Path Parameters

NameTypeDescription

type*

Enum

success, warning, danger

icon*

Icon

SVG or font icon from BoxIcons

message*

String

Message on the notification

url

URL

URL the notification should redirect to when clicked

{
    "success": true,
    "message": "Notification sent successfully"
}

Last updated