Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Kr-Yogsa/ECE-BOT/llms.txt

Use this file to discover all available pages before exploring further.

These endpoints let admins manage the operator role within ECE-BOT. Operators are users granted access to machine monitoring dashboards. Admins can invite new users by email, promote existing accounts, toggle access, and permanently delete deactivated operators.
All four endpoints require an admin-role Bearer token. Operator invitation and promotion emails are sent automatically using APP_BASE_URL to construct the signup link.

GET /admin/operators

Lists all accounts currently holding the operator role, along with the authenticated admin’s own account details.

Headers

Authorization
string
required
Bearer token for an admin account. Example: Bearer <token>.

Response

current_admin
object
required
Profile of the authenticated admin making the request.
operators
array
required
Array of operator account objects. Empty array when no operators exist.
curl --request GET \
  --url https://your-host/admin/operators \
  --header "Authorization: Bearer <token>"
200
{
  "current_admin": {
    "id": 1,
    "name": "Admin User",
    "email": "admin@example.com",
    "role": "admin",
    "is_active": true,
    "email_verified": true
  },
  "operators": [
    {
      "id": 2,
      "name": "Operator One",
      "email": "operator@example.com",
      "role": "operator",
      "is_active": true,
      "email_verified": true
    }
  ]
}

POST /admin/operators

Invites or promotes a user to the operator role by email address. The server inspects the email and applies the appropriate action automatically. The behavior varies depending on whether the email is already registered:
ScenarioActionEmail sentStatus
New email addressCreates a pending operator accountInvitation with signup link201
Existing non-operator userPromotes account to operator rolePromotion notification200
Existing operator (verified)Confirms existing operator accessPromotion notification200
Existing operator (unverified)Resends invitationInvitation with signup link200
Existing admin accountRejected — admins cannot be downgradedNone409

Headers

Authorization
string
required
Bearer token for an admin account.

Body

email
string
required
Email address of the user to invite or promote. Must be a valid email format.

Response

message
string
required
Description of the action taken (e.g., "Operator invited successfully. Invitation email has been sent.").
operator
object
required
The created or updated operator account.
Attempting to invite an email address already registered to an admin account returns 409. Admin accounts cannot be converted to operator accounts.
curl --request POST \
  --url https://your-host/admin/operators \
  --header "Authorization: Bearer <token>" \
  --header "Content-Type: application/json" \
  --data '{"email": "operator@example.com"}'
201 — new operator invited
{
  "message": "Operator invited successfully. Invitation email has been sent.",
  "operator": {
    "id": 5,
    "name": "Operator",
    "email": "operator@example.com",
    "role": "operator",
    "is_active": true,
    "email_verified": false
  }
}
200 — existing user promoted
{
  "message": "Existing user promoted to operator successfully.",
  "operator": {
    "id": 3,
    "name": "Jane Smith",
    "email": "jane@example.com",
    "role": "operator",
    "is_active": true,
    "email_verified": true
  }
}
409
{
  "error": "Admin accounts cannot be converted into operators."
}

PATCH /admin/operators//status

Activates or deactivates an operator account. Setting is_active to false downgrades the account role to user and sends the operator a removal notification email. The account record is retained and can be re-invited later.

Path parameters

user_id
number
required
Numeric ID of the operator account to update.

Headers

Authorization
string
required
Bearer token for an admin account.

Body

is_active
boolean
required
Pass false to remove operator access (role is changed to user, removal email sent). Pass true to re-activate an operator.

Response

message
string
required
Description of the change (e.g., "Operator access removed successfully. The account is now a normal user.").
operator
object
required
The updated account reflecting the new role and status.
When is_active is set to false, the account’s role is immediately changed to user. To restore operator access, use POST /admin/operators with the same email address.
curl --request PATCH \
  --url https://your-host/admin/operators/5/status \
  --header "Authorization: Bearer <token>" \
  --header "Content-Type: application/json" \
  --data '{"is_active": false}'
200 — deactivated
{
  "message": "Operator access removed successfully. The account is now a normal user.",
  "operator": {
    "id": 5,
    "name": "Operator",
    "email": "operator@example.com",
    "role": "user",
    "is_active": true,
    "email_verified": false
  }
}
200 — activated
{
  "message": "Operator status updated successfully.",
  "operator": {
    "id": 5,
    "name": "Operator",
    "email": "operator@example.com",
    "role": "operator",
    "is_active": true,
    "email_verified": false
  }
}
404
{
  "error": "Operator not found."
}

DELETE /admin/operators/

Permanently deletes an operator account. The operator must be deactivated first using PATCH /admin/operators/{user_id}/status with is_active: false. Attempting to delete an active operator returns a 400 error.

Path parameters

user_id
number
required
Numeric ID of the operator account to delete.

Headers

Authorization
string
required
Bearer token for an admin account.

Response

message
string
required
Confirmation: "Operator deleted successfully."
This action is irreversible. The account and all associated records are permanently removed. Deactivate the operator first — the server rejects deletion of active operators with a 400 error.
curl --request DELETE \
  --url https://your-host/admin/operators/5 \
  --header "Authorization: Bearer <token>"
200
{
  "message": "Operator deleted successfully."
}
400
{
  "error": "Deactivate the operator before deleting the account."
}
404
{
  "error": "Operator not found."
}

Build docs developers (and LLMs) love