Skip to content

User (Admin/Staff) API ​

Base URL: https://your-domain.com
Authentication: Bearer Token (Admin/Staff)

All endpoints in this section require admin/staff authentication. Include the Bearer token in your request headers.


API Modules ​

Core Management ​

ModuleDescriptionEndpoints
📁 SubscribersSubscriber CRUD, activation, suspension, import/export9
📁 UsersUser management, resellers, staff7
📁 PackagesPackage CRUD, assignment, pricing7

Accounting ​

ModuleDescriptionEndpoints
📁 InvoicesInvoice CRUD, generate, pay, reverse8
📁 PaymentsPayment CRUD, payment methods6
📁 LedgersLedger history and transactions3
📁 BalanceSubscriber/user balance management4
📁 ExpensesExpense tracking and categories6

Network ​

ModuleDescriptionEndpoints
📁 NASNetwork Access Server management6
📁 IP PoolsIP pool management and generation6
📁 OLT/ONUFiber network device management8
📁 PoliciesRADIUS policy management5
📁 BandwidthBandwidth allocation management6
📁 MAC BindingMAC address binding4
📁 RADIUSRADIUS sessions and management7

Organization ​

ModuleDescriptionEndpoints
📁 ISPsISP management5
📁 BranchesBranch management5
📁 AreasArea hierarchy management6
📁 InventoryInventory tracking and assignment7

Support & Communication ​

ModuleDescriptionEndpoints
📁 TicketsSupport ticket management7
📁 NotesNote management5
📁 NoticesNotice management5
📁 SMSSMS messaging3
📁 SMS TemplatesSMS template management5
📁 Email TemplatesEmail template management5

System ​

ModuleDescriptionEndpoints
📁 DashboardSubscriber, accounting and user counters3
📁 SettingsSystem settings management6
📁 RolesRole management6
📁 PermissionsPermission management2
📁 Activity LogsActivity log viewing4
📁 ReportsReporting endpoints6
📁 Extra FeesExtra fee management6

Common Request Headers ​

HeaderValueRequired
AuthorizationBearer your-auth-tokenYes
Acceptapplication/jsonYes
Content-Typeapplication/jsonYes (POST/PUT)

Common Query Parameters ​

ParameterTypeRequiredDescription
isp_idintegerYesISP identifier
branch_idintegerYesBranch identifier
user_idintegerYesUser identifier

isp_id and branch_id must be the caller's own (the values returned by Login); a Super admin (profile_type 100) may name any existing ISP/branch pair, and must then send both. user_id, when sent, must be the caller or a user the caller may act for. Anything else answers 403 Oops! Insufficient Permission. Records are always created and changed as the token's user, whatever user_id says.


What each user sees (scoping) ​

The API shows each user the same records the web panel shows them. Inside the caller's ISP and branch, what is visible depends on the token user's profile_type:

Profile typeWhoWhat the API shows
1, 100Admin, Super adminThe whole ISP and branch
2Admin staffSubscribers (the list and details, MAC binding list, RADIUS sessions, and every subscriber action): only those of the resellers the staff's role manages, plus the admin's own subscribers. Everything else (invoices, payments, ledgers, reports, users, tickets, dashboard): the whole ISP and branch, except that admin staff never see an admin's profile or balance
3, 4, 5Reseller, Sub-reseller, RetailerOnly their own tree: the records of the user itself and of the sub-resellers / retailers below it
6, 7, 8Staff of a reseller, sub-reseller, retailerThe same as their parent (the user who created them): the parent's tree

For the reseller family (3 to 8) the tree applies to every module:

ModuleWhat a reseller-family user sees
Subscribers, MAC bindingSubscribers whose salesperson is in the tree. Every subscriber action (activation, migration, update, balance) works only on these
InvoicesInvoices of the tree's subscribers, or sold by a user of the tree
Payments, receiptsPayments made by the tree's subscribers or the tree's users
Ledgers, balancesLedger rows and balances of the tree's subscribers and users
UsersA reseller: the sub-resellers, retailers and staff it or its sub-resellers created. A sub-reseller: its retailers and staff. A retailer: its staff. Reseller staff: none
PackagesOnly the packages assigned to the reseller (the parent, for staff). Creating, changing and assigning packages is admin side only
ReportsAll six reports count only the tree's subscribers, invoices and payments
NotesNotes on the tree's subscribers and users. A note can be created only on one of them
Activity logsOnly the user's own actions
ExpensesOnly the expenses the user created
TicketsTickets of the user's own subscribers and tickets assigned to the user or its staff (staff: also those assigned to the parent and to sibling staff). See Tickets
RADIUSOnline sessions, session history, RADIUS attributes, usage and disconnect for the tree's subscribers only
DashboardCounters of the tree. Reseller staff see their parent's numbers

A record outside what you may see answers as if it did not exist: 404 with the endpoint's usual "not found" message (for example Oops! Subscriber Not Found., Invoice Not Found, Ticket not found.). Lists simply leave such records out. When you send an ID you may not use (a foreign subscriber_id on a write, a ticket assign_to_id outside your reach, a note to_id outside your tree), the answer is 403, for example:

json
{
    "status": "error",
    "message": "The selected subscriber_id does not belong to your ISP and branch."
}

Access and errors ​

api_access is checked on every request. Every profile except Admin (1) and Super admin (100) needs the api_access permission (Super admin is exempt from v2.30.8). Profiles other than Admin and Super admin also need the web permission of the module they call, where the web panel has one (for example subscriber_module, ticket_module; disconnecting a RADIUS session needs subscriber_disconnect). When the permission is removed, the next request with the same token answers:

json
{
    "status": "error",
    "message": "Oops! Insufficient Permission"
}

The token is kept, so granting the permission again makes it work at once. A disabled user's token answers 401 instead (see Auth - User).

Server errors carry no internals. A server error answers 500 with a short generic message only (in every staff module from v2.30.8; before that, only in the scoped modules, RADIUS, Tickets and Dashboard), for example:

json
{
    "status": "error",
    "message": "Failed to fetch tickets."
}

No SQL, exception text, file or line is returned; the details are written to the server log. A message the server gives on purpose (for example Insufficient Balance!) is still returned as it is.

Wrong token, route or method answers JSON, never an HTML page or a redirect to the login page:

StatusWhenBody
401Missing, invalid, expired or revoked token{"message": "Unauthenticated."}
404No route has this path{"status": "error", "message": "Route not found: GET /api/v1/tikets"}
404A record looked up by ID does not exist{"status": "error", "message": "Record not found."} (or the endpoint's own message)
405The path exists but not for this method{"status": "error", "message": "The DELETE method is not supported for this route. Use: GET, POST."} (here for DELETE /api/v1/tickets), with an Allow header

Send Accept: application/json on every request.


Method Reference ​

  • GET - Retrieve data
  • POST - Create new resource or perform action
  • PUT - Update existing resource
  • DELETE - Delete resource

Fields marked in red are required.

www.onezeroart.com