User Token
The User Token API provides comprehensive user management
capabilitiesfunctionalityincludingwith integrated AAA (Authentication, Authorization, and Accounting) profileinformation.support. These endpoints allow you to create, retrieve, update, and deleteuserusersaccountswhilealong withmanaging theirassociatedauthenticationtoken-credentials, time-basedauthentication credentialsbalances, andusageaccesstracking.profiles for your organization's systems.
Base URL: https://gate.zequenze.com/api/v1
Authentication: All endpoints require a Bearer token:
Authorization: Bearer <your-api-token>
Overview
The User Token API is designed for managing user accountsusers in systems that require token-time-based authenticationaccess control, quota management, and usageorganizational tracking.segmentation. This API category is particularly useful for:
-
UserNetworkAccountAccess Control: Managing user credentials and time quotas for network services
TheseKey endpointsfeatures workinclude:
Key concepts include user tokens that represent time-based access credits, organization-based user segmentationorganization for multi-tenant environments,scenarios
The API supports both individual user operations and real-timebulk balancelisting trackingwith advanced filtering capabilities, making it suitable for usageboth monitoring.administrative interfaces and automated user provisioning systems.
Endpoints
GET /user_token/
Description: Retrieves a paginated list of all users with their AAA profile information.information and optional balance data. This endpoint supportsis filteringessential byfor usernamebuilding user management interfaces, generating reports, and organization, making it ideal for administrative dashboards andmonitoring user searchaccounts functionality.across your organization.
Use Cases:
DisplayBuilding administrative dashboards showing all usersin an administrative interfaceSearchFiltering users by organization for multi-tenant management
Full URL Example:
https://gate.zequenze.com/api/v1/user_token/?username=john_doe&organization=acme_corp5&balance=true&limit=2025&offset=0
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| username | string | query | No | Filter |
| organization | string | query | No | Filter |
| limit | integer | query | No | Number of results |
| offset | integer | query | No | Starting |
| balance | boolean | query | No |
cURL Example:
curl -X GET "https://gate.zequenze.com/api/v1/user_token/?organization=acme_corp5&balance=true&limit=10" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Example Response:
{
"count": 45,157,
"next": "https://gate.zequenze.com/api/v1/user_token/?limit=10&offset=10"10&organization=5&balance=true",
"previous": null,
"results": [
{
"id": 1,123,
"username": "john_doe"john.doe",
"email"external_id": "john@acmecorp.com"EXT_USER_789",
"organization"klass": "acme_corp"premium_user",
"password": "****",
"is_active": true,
"token"organization": 5,
"description": "tok_abc123def456"Premium customer - Network Access",
"balance_seconds": 86400,
"created_at"date_joined": "2024-01-15T10:15T09:30:00Z",
"last_login": "2024-01-20T14:03-10T14:22:00Z",
"expiration": "2024-12-31T23:59:59Z",
"profile": {
["max_sessions": 2,
"access_level": "premium"
}
},
{
"id": 2,
"username": "jane_smith"vpn_access", "email": "jane@acmecorp.com"high_bandwidth"],
"organization"user_time": "acme_corp",
"is_active": true,
"token": "tok_xyz789abc012",
"balance_seconds": 43200,
"created_at": "2024-01-16T09:15:00Z",
"last_login": "2024-01-21T11:45:00Z",
"profile": {
"max_sessions": 1,
"access_level": "standard"
}86400
}
]
}
Response Codes:
| Status | Description |
|---|---|
| 200 | Success - Returns paginated user list |
| 401 | Unauthorized - Invalid or missing |
| 403 | Forbidden - Insufficient permissions to |
POST /user_token/
Description: Creates a new user account with AAA profile information and generates an associated authentication token.configuration. This endpoint is essential forhandles user onboardingprovisioning with optional external system integration, time quota assignment, and accountorganizational provisioningmembership workflows.setup.
Use Cases:
RegisterProvisioning new usersinfromyourexternalsystemsystems
Full URL Example:
https://gate.zequenze.com/api/v1/user_token/
Parameters:Request Body Example:
{
"username": "jane.smith",
Parameter"password": Type"SecurePass123!",
In"email": Required"jane.smith@company.com",
Description"first_name": "Jane",
"last_name": "Smith",
"external_id": data"HR_EMP_4567",
object"klass": body"standard_user",
Yes"organization": JSON5,
object"description": containing"Standard useremployee information- andIT profileDepartment",
settings"expiration": "2024-12-31T23:59:59Z",
"is_active": true,
"profile": ["basic_network", "email_access"],
"avatar_url": "https://company.com/avatars/jane.smith.jpg"
}
cURL Example:
curl -X POST "https://gate.zequenze.com/api/v1/user_token/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"username": "new_user"jane.smith",
"password": "SecurePass123!",
"email": "newuser@company.jane.smith@company.com",
"organization": 5,
"tech_startup"profile": ["basic_network", "email_access"],
"is_active": true,
"initial_balance_seconds": 172800,
"profile": {
"max_sessions": 3,
"access_level": "premium"
}true
}'
Example Response:
{
"id": 15,124,
"username": "new_user"jane.smith",
"external_id": "HR_EMP_4567",
"klass": "standard_user",
"password": "****",
"email": "newuser@company.jane.smith@company.com",
"organization"first_name": "tech_startup"Jane",
"last_name": "Smith",
"is_active": true,
"token"organization": 5,
"description": "tok_new456user789"Standard employee - IT Department",
"balance_seconds": 172800,
"created_at"date_joined": "2024-01-21T16:30:03-11T10:15:00Z",
"first_login": null,
"last_login": null,
"expiration": "2024-12-31T23:59:59Z",
"avatar_url": "https://company.com/avatars/jane.smith.jpg",
"profile": {["basic_network", "max_sessions": 3,
"access_level": "premium"
}email_access"]
}
Response Codes:
| Status | Description |
|---|---|
| 201 | Created - User successfully created |
| 400 | Bad Request - Invalid data |
| 401 | Unauthorized - Invalid or missing |
GET /user_token/{id}/
Description: Retrieves detailed information for a specific user by their ID, including AAA profile data and optionallyoptional theirbalance current token balance.information. This endpoint is perfect for user profiledetail pagesviews, account management interfaces, and accountintegration statuswith checks.external systems.
Use Cases:
DisplayDisplaying user profile information in admin interfacesCheckCheckingcurrent tokenuser balanceforandaquotaspecific userinformationRetrieveRetrieving userdetailsdata foradministrativeexternalreviewsystem synchronizationValidateBuilding user account management features
Full URL Example:
https://gate.zequenze.com/api/v1/user_token/15/123/?balance=true
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| id | integer | path | Yes | Unique |
| balance | boolean | query | No | Include |
cURL Example:
curl -X GET "https://gate.zequenze.com/api/v1/user_token/15/123/?balance=true" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Example Response:
{
"id": 15,123,
"username": "new_user"john.doe",
"email"external_id": "newuser@company.com"EXT_USER_789",
"organization"klass": "tech_startup"premium_user",
"password": "****",
"is_active": true,
"token"organization": 5,
"description": "tok_new456user789"Premium customer - Network Access",
"balance_seconds": 158400,
"created_at"date_joined": "2024-01-21T16:15T09:30:00Z",
"last_login": "2024-01-22T08:15:03-10T14:22:00Z",
"expiration": "2024-12-31T23:59:59Z",
"profile": {
["max_sessions": 3,
"access_level": "premium"vpn_access", "total_usage_seconds"high_bandwidth", "priority_support"],
"user_time": 14400,
"last_activity": "2024-01-22T12:30:00Z"
}259200
}
Response Codes:
| Status | Description |
|---|---|
| 200 | Success - Returns user details |
| 401 | Unauthorized - Invalid or missing |
| 404 | Not Found - User |
PUT /user_token/{id}/
Description: Completely updates a user's informationinformation, andreplacing AAAall profilemodifiable data.fields with new values. This endpoint replacesrequires sending all updatable fields with the provideduser data, even unchanged fields, making it idealsuitable for comprehensivefull profile updates and bulk user profiledata updates.synchronization.
Use Cases:
UpdateSynchronizing complete userprofilerecordsinformationfromcompletelyexternal systemsChangePerformingorganizationfullassignmentprofile updates in admin interfacesModifyUpdatingaccessuserslevelsafterandorganizationalsession limitschangesResetMigrating usertokensdataandbetweenbalancessystems
Full URL Example:
https://gate.zequenze.com/api/v1/user_token/15/123/
Parameters:Request Body Example:
{
"username": "john.doe.updated",
Parameter"external_id": Type"EXT_USER_789_NEW",
In"klass": Required"enterprise_user",
Description"password": "NewSecurePass456!",
"is_active": true,
"organization": id7,
integer"description": path"Enterprise Yescustomer Unique- identifierUpdated ofprofile",
the"expiration": user"2025-06-30T23:59:59Z",
to"profile": update["vpn_access", "high_bandwidth", "priority_support", data"admin_tools"],
object"user_time": body172800
Yes}
Complete user data object with all fields to update
cURL Example:
curl -X PUT "https://gate.zequenze.com/api/v1/user_token/15/123/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"username": "updated_user"john.doe.updated",
"email"klass": "updated@company.com",
"organization": "enterprise_corp"enterprise_user",
"is_active": true,
"balance_seconds"organization": 259200,7,
"profile": {["vpn_access", "max_sessions": 5,high_bandwidth", "access_level": "enterprise"
}priority_support"]
}'
Example Response:
{
"id": 15,123,
"username": "updated_user"john.doe.updated",
"email"external_id": "updated@company.com"EXT_USER_789_NEW",
"organization"klass": "enterprise_corp"enterprise_user",
"password": "****",
"is_active": true,
"token"organization": 7,
"description": "tok_new456user789"Enterprise customer - Updated profile",
"balance_seconds": 259200,
"created_at"date_joined": "2024-01-21T16:15T09:30:00Z",
"updated_at": "2024-01-23T10:45:00Z",
"last_login": "2024-01-22T08:15:03-10T14:22:00Z",
"expiration": "2025-06-30T23:59:59Z",
"profile": {["vpn_access", "max_sessions"high_bandwidth", "priority_support", "admin_tools"],
"user_time": 5,
"access_level": "enterprise"
}172800
}
Response Codes:
| Status | Description |
|---|---|
| 200 | Success - User |
| 400 | Bad Request - Invalid data |
| 401 | Unauthorized - Invalid or missing |
| 404 | Not Found - User |
PATCH /user_token/{id}/
Description: Partially updates specific user fields of a user's profile without affecting otherunchanged data. This endpoint is perfectideal for making targeted changesupdates like updatingchanging emailuser addresses,status, adjustingadding balances,time balance, or modifying specific profile settings.settings while preserving existing user information.
Use Cases:
UpdateUpdatingonlyuser active/inactive status
Full URL Example:
https://gate.zequenze.com/api/v1/user_token/15/123/
Parameters:Request Body Example:
{
"is_active": false,
Parameter"description": Type"Account Insuspended Required- DescriptionPayment overdue",
"user_time": 0,
"profile": id["basic_access"]
integer}
path
Yes
Unique identifier of the user to update
data
object
body
Yes
Partial user data object containing only fields to update
cURL Example:
curl -X PATCH "https://gate.zequenze.com/api/v1/user_token/15/123/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"balance_seconds"is_active": 345600,false,
"profile"user_time": {
"max_sessions": 4
}0
}'
Example Response:
{
"id": 15,123,
"username": "updated_user"john.doe",
"email"external_id": "updated@company.com"EXT_USER_789",
"organization"klass": "enterprise_corp"premium_user",
"password": "****",
"is_active": true,false,
"token"organization": 5,
"description": "tok_new456user789"Account suspended - Payment overdue",
"balance_seconds": 345600,
"created_at"date_joined": "2024-01-21T16:15T09:30:00Z",
"updated_at": "2024-01-23T14:20:00Z",
"last_login": "2024-01-22T08:15:03-10T14:22:00Z",
"expiration": "2024-12-31T23:59:59Z",
"profile": {["basic_access"],
"max_sessions"user_time": 4,
"access_level": "enterprise"
}0
}
Response Codes:
| Status | Description |
|---|---|
| 200 | Success - User partially updated |
| 400 | Bad Request - Invalid |
| 401 | Unauthorized - Invalid or missing |
| 404 | Not Found - User |
DELETE /user_token/{id}/
Description: Permanently removes a user account and associated token from the system. This action is irreversible and will immediately revokedelete all accessuser data, tokens, and associated records. Use with caution and consider deactivating users instead of deletion for theaudit specifiedtrail user.purposes.
Use Cases:
RemoveRemovinginactivetest accounts from production systems
Full URL Example:
https://gate.zequenze.com/api/v1/user_token/15/123/
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| id | integer | path | Yes | Unique |
cURL Example:
curl -X DELETE "https://gate.zequenze.com/api/v1/user_token/15/123/" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Response Codes:
| Status | Description |
|---|---|
| 204 | No Content - User successfully deleted |
| 401 | Unauthorized - Invalid or missing |
| 404 | Not Found - User |
Common Use Cases
UserUse OnboardingCase and1: ISP Customer Management
CreateManage newinternet userservice accountsprovider customers with appropriatetime-based token balancesquotas and organizationservice assignments.tiers. Use theGET /user_token/ to list customers by organization, POST endpoint/user_token/ to provision accounts,new thencustomers, GETand PATCH /user_token/{id}/ to verifyadjust creationquotas and monitorservice initial usage patterns.classes.
BalanceUse MonitoringCase 2: Corporate Network Access Control
Control employee network access with expiration dates and Top-upsAAA
Regularlyprofiles. checkCreate user token balances using the GET endpointsusers with thespecific balancenetwork parameter.profiles, Usemonitor PATCHlogin toactivity, addand timeautomatically to userdisable accounts when theyemployees purchaseleave additionalthe credits or need balance adjustments.organization.
Organization-basedUse Case 3: Multi-tenant SaaS User AdministrationManagement
Manage users across multiple client organizations with different service levels. Filter users by organizationorganization, assign appropriate AAA profiles based on subscription tiers, and track usage through time balances.
Use Case 4: External System Integration
Synchronize user data between your primary system and GATE API using theexternal_id listfields. endpointCreate toand manageupdate multi-tenantusers environments.based Thison isHR particularlysystem usefulchanges, formaintaining servicereferential providersintegrity managingacross multiple client organizations.platforms.
AccountUse LifecycleCase 5: Prepaid Service Management
TrackImplement prepaid internet or network services by managing user activitytime frombalances. creationCreate tousers deletion.with Useinitial thetime read endpoint toquotas, monitor usageremaining patterns, update profiles as needed,balances, and ultimatelyautomatically delete inactive accounts to maintain system hygiene.
Bulk Operations and Reporting
Combine the list endpoint with pagination to process alldeactivate users inwhen batchestime for reporting, billing, or maintenance operations. The organization and balance filters help create targeted reports.expires.
Best Practices
-
Use Pagination Effectively: Always
useimplement pagination for user lists using limit and offset parameterswhen retrieving user liststo avoid performance issues with largedatasets. Start with reasonable page sizes (20-50 users) and adjust based on your needs.datasets -
BalanceImplementMonitoringProper Filtering:IncludeUsetheorganizationbalanceandparameterusernameinfiltersGETtorequestsreduceonlyAPIwhenresponseyousizesneedandcurrentimproveusageapplicationdata, as this may add processing overhead for real-time calculations.performance -
ErrorHandleHandlingTime Balances Carefully:Always check for 404 errors whenWhen working withspecificuser_timeuservalues,IDs,alwaysandspecifyimplementtheproperbalance=trueretryparameterlogictoforgetnetworkaccuratetimeouts.remainingHandle 409 conflicts gracefully during user creation.quotas -
SecuritySecure Password Handling: Never log or exposeuserpasswordtokensfields; they're automatically masked inclient-side code. Implement proper token rotation policies and monitorresponses forunusual usage patterns that might indicate token compromise.security -
PerformanceUse PATCH for Targeted Updates:UsePrefer PATCH over PUT for single field updates to reduce bandwidth and avoid accidentally clearing fields
DataMonitor ConsistencyExpiration Dates: Regularly check user expiration dates and implement automated processes to handle expired accounts