API Documentation for User Management

Authentication

The API requires authentication to access its endpoints. You must include your API key in the request header:

Authorization: Bearer {API key}

Users

Create New User

POST /api/users

Creates a new user in the system. If no password is provided, a random one will be generated.

Parameters

ParameterDescription
emailRequired. Email address of the user. Must be unique and have a valid domain extension.
first_nameFirst name of the user. Defaults to ‘Student’ if not provided.
last_nameLast name of the user. Defaults to ‘Member’ if not provided.
external_idExternal ID of the user. Must be a number.
sourceString identifier of source. Defaults to ‘api’ if not set.
passwordPassword for the user. If not provided, a random 12-character password will be generated.
phone_numberPhone number of the user. Maximum 30 characters.
live_scannerBoolean value (true/false).

Response

{
    "message": "User created successfully",
    "user_id": 123
}

Status Code: 201 Created

Update User

PUT /api/users/{user_id}

Updates an existing user’s information. All parameters are optional – only provided fields will be updated.

Parameters

ParameterDescription
emailEmail address of the user. Must be unique and have a valid domain extension.
first_nameFirst name of the user.
last_nameLast name of the user.
external_idExternal ID of the user. Must be a number.
sourceString identifier of source.
passwordNew password for the user.
phone_numberPhone number of the user. Maximum 30 characters.
live_scannerBoolean value (true/false).

Response

{
    "message": "User updated successfully"
}

Status Code: 200 OK

Get User Details

GET /api/users/{user_id}

Retrieves details for a specific user.

Response

Returns the user object with all available fields.

Error Responses

The API may return the following error responses:

Validation Errors

Status Code: 422 Unprocessable Entity

{
    "message": "The given data was invalid.",
    "errors": {
        "email": [
            "The email field must be a valid email address.",
            "The email must have a valid domain with an extension."
        ]
    }
}

Authentication Error

Status Code: 403 Unauthorized

{}

Not Found Error

Status Code: 404 Not Found


User Lookup

Find User by Email

POST /api/users/find

Finds a user’s ID by their email address. Only returns non-admin users.

Parameters

ParameterDescription
emailRequired. Email address of the user to look up.

Response

json

{
    "user_id": 123
}

Status Code: 200 OK


Get User Subscriptions

POST /api/users/get-subscriptions

Retrieves all subscriptions associated with a user by their email address.

Parameters

ParameterDescription
emailRequired. Email address of the user.

Response

json

{
    "subscriptions": [
        {
            "id": 1,
            "name": "Gold Members",
            "slug": "gold-members",
            "sku": "GOLD-001",
            "mobile_push_enabled": true
        }
    ],
    "site_url": "https://example.com",
    "site_name": "My Site"
}

Status Code: 200 OK

Notes

  • The API uses JSON for request and response bodies
  • All timestamps are returned in ISO 8601 format
  • The DELETE and INDEX (list all users) endpoints are currently disabled and will return a 404 error
  • Users with backend access cannot be modified through the API
  • All users created through this API are automatically assigned the ‘Member’ role

Ah, you just want the formatted content to paste directly into the block editor as regular blocks — not as HTML. Here you go: