User Token
Endpoints Summary
GET
/user_token/
Swagger ↗
POST
/user_token/
Swagger ↗
GET
/user_token/{id}/
Swagger ↗
PUT
/user_token/{id}/
Swagger ↗
PATCH
/user_token/{id}/
Swagger ↗
DELETE
/user_token/{id}/
Swagger ↗
The User Token API
providesmanagescomprehensiveusersuserwithinmanagementthefunctionalityGATEwithsystem,integratedincluding their authentication credentials, AAA (Authentication, Authorization, and Accounting)profileprofiles,support.and time-based access controls. These endpoints allow you to create, retrieve, update, and deleteusersuserwhileaccountsmanagingwiththeirdetailedauthenticationprofilecredentials, time-based balances,information andaccesstoken-basedprofilestime management foryouraccessorganization'scontrol 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 provides comprehensive user management functionality for the GATE system. This API category is designed for managing usersuser in systemsaccounts that require time-based access control, quotatypically management,used andin organizationalscenarios segmentation.where Thisusers APIneed isallocated particularlytime usefulcredits for:for services or resources.
Key Features:
-
NetworkUserAccess Control: Managing user credentials and time quotas for network services
Key features include:
Common Use Cases:
The API supportsuses bothstandard individualREST userprinciples operationswith JSON responses and bulksupports listingpagination withfor advancedlist filteringoperations. capabilities,User time is tracked in seconds, making it suitable for bothprecise administrativetime-based interfacesbilling and automatedaccess usercontrol provisioning systems.scenarios.
Endpoints
GET /user_token/
Description: Retrieves a paginated list of all users within the system, including their AAA profile information and optional balance data.information. This endpoint issupports essentialfiltering forby building user management interfaces, generating reports,username and monitoringorganization, userand accountscan acrossoptionally yourinclude organization.remaining time balance information.
Use Cases:
Building administrative dashboards showingDisplay all users in an administrative dashboardFilteringFilter users byorganizationspecific organizations for multi-tenantmanagementsystemsMonitoring user balances for usage-based billing
Full URL Example:
https://gate.zequenze.com/api/v1/user_token/?username=john_doe&organization=5acme_corp&balance=true&limit=2520&offset=0
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| username | string | query | No | Filter users by exact username match |
| organization | string | query | No | Filter users |
| limit | integer | query | No | Number of results per page (default: 20) |
| offset | integer | query | No | Starting index for pagination (default: 0) |
| balance | boolean | query | No | Include remaining time balance in seconds |
cURL Example:
curl -X GET "https://gate.zequenze.com/api/v1/user_token/?organization=5&balance=true&limit=10" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Example Response:
{
"count": 157,150,
"next": "https://gate.zequenze.com/api/v1/user_token/?limit=10&offset=10&organization=5&balance=true"10",
"previous": null,
"results": [
{
"id": 123,1,
"username": "john.doe"john_doe",
"external_id": "EXT_USER_789"EXT-USER-001",
"klass": "premium_user",
"password": "****"premium",
"is_active": true,
"organization": 5,1,
"description": "Premium customeruser - Network Access"account",
"date_joined": "2024-01-15T09:15T10:30:00Z",
"last_login": "2024-03-10T14:22:01-20T14:25:00Z",
"expiration": "2024-12-31T23:59:59Z",
"profile": ["vpn_access"internet_access", "high_bandwidth"wifi_premium"],
"user_time": 864003600
},
{
"id": 2,
"username": "jane_smith",
"external_id": "EXT-USER-002",
"klass": "standard",
"is_active": true,
"organization": 1,
"description": "Standard user account",
"date_joined": "2024-01-16T09:15:00Z",
"last_login": "2024-01-19T16:45:00Z",
"expiration": null,
"profile": ["internet_access"],
"user_time": 1800
}
]
}
Response Codes:
| Status | Description |
|---|---|
| 200 | Success - Returns paginated user list |
| 401 | Unauthorized - Invalid or missing |
| 403 | Forbidden - Insufficient permissions |
POST /user_token/
Description: Creates a new user account with AAA profile configuration.information. This endpoint handlesallows you to set up complete user provisioningprofiles withincluding optionalauthentication externalcredentials, system integration, time quotaorganizational assignment, and organizationalinitial membershiptime setup.allocations.
Use Cases:
ProvisioningRegister new usersfrominexternalthesystems
Full URL Example:
https://gate.zequenze.com/api/v1/user_token/
Request Body Example:Parameters:
{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": "jane.smith"new_user",
"password": "SecurePass123!"secure_password123",
"email": "jane.smith@company.newuser@example.com",
"first_name": "New",
"last_name": "User",
"external_id": "EXT-USER-003",
"klass": "premium",
"is_active": true,
"organization": 5,1,
"description": "Newly created premium user",
"expiration": "2024-12-31T23:59:59Z",
"profile": ["basic_network"internet_access", "wifi_premium", "email_access"],
"is_active": true
}'
Example Response:
{
"id": 124,3,
"username": "jane.smith"new_user",
"external_id": "HR_EMP_4567"EXT-USER-003",
"klass": "standard_user",
"password": "****"premium",
"email": "jane.smith@company.newuser@example.com",
"first_name": "Jane"New",
"last_name": "Smith"User",
"is_active": true,
"organization": 5,1,
"description": "StandardNewly employeecreated -premium IT Department"user",
"date_joined": "2024-03-11T10:15:01-21T11:30:00Z",
"first_login": null,
"last_login": null,
"expiration": "2024-12-31T23:59:59Z",
"avatar_url": "https://company.com/avatars/jane.smith.jpg",null,
"profile": ["basic_network"internet_access", "wifi_premium", "email_access"]
}
Response Codes:
| Status | Description |
|---|---|
| 201 | Created - User successfully created |
| 400 | Bad Request - Invalid data or duplicate username |
| 401 | Unauthorized - Invalid or missing |
| 403 | Forbidden - Insufficient permissions |
GET /user_token/{id}/
Description: Retrieves detailed information for a specific user by their ID, including AAA profile datainformation and optionaloptionally balancetheir information.remaining Thistime endpoint is perfect for user detail views, account management interfaces, and integration with external systems.balance.
Use Cases:
DisplayingDisplay user profileinformationinadminadministrativeinterfacesinterfaceCheckingCheck userbalancedetailsandbeforequotagrantinginformationaccessRetrievingRetrieve userdatainformation forexternalauthenticationsystem synchronizationsystemsBuilding user account management features
Full URL Example:
https://gate.zequenze.com/api/v1/user_token/123/?balance=true
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| id | integer | path | Yes | Unique identifier of the user |
| balance | boolean | query | No | Include remaining time balance in seconds |
cURL Example:
curl -X GET "https://gate.zequenze.com/api/v1/user_token/123/1/?balance=true" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Example Response:
{
"id": 123,1,
"username": "john.doe"john_doe",
"external_id": "EXT_USER_789"EXT-USER-001",
"klass": "premium_user",
"password": "****"premium",
"is_active": true,
"organization": 5,1,
"description": "Premium customeruser - Network Access"account",
"date_joined": "2024-01-15T09:15T10:30:00Z",
"last_login": "2024-03-10T14:22:01-20T14:25:00Z",
"expiration": "2024-12-31T23:59:59Z",
"profile": ["vpn_access"internet_access", "high_bandwidth"wifi_premium", "priority_support"email_access"],
"user_time": 2592003600
}
Response Codes:
| Status | Description |
|---|---|
| 200 | Success - Returns user details |
| 401 | Unauthorized - Invalid or missing |
PUT /user_token/{id}/
Description: Completely updates aan user'sexisting information,user account, replacing all modifiable fields with new values.fields. This endpointis a full update operation that requires sending all userfields data,you evenwant unchangedto fields,preserve makingto itbe suitableincluded forin fullthe profile updates and bulk user data synchronization.request.
Use Cases:
Synchronizing completeComplete userrecords from external systems
Full URL Example:
https://gate.zequenze.com/api/v1/user_token/123/
Request Body Example:
{
"username": "john.doe.updated",
"external_id": "EXT_USER_789_NEW",
"klass": "enterprise_user",
"password": "NewSecurePass456!",
"is_active": true,
"organization": 7,
"description": "Enterprise customer - Updated profile",
"expiration": "2025-06-30T23:59:59Z",
"profile": ["vpn_access", "high_bandwidth", "priority_support", "admin_tools"],
"user_time": 172800
}
cURL Example:
curl -X PUT "https://gate.zequenze.com/api/v1/user_token/123/1/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"username": "john.doe.updated"john_doe_updated",
"external_id": "EXT-USER-001-UPDATED",
"klass": "enterprise_user"enterprise",
"is_active": true,
"organization": 7,2,
"description": "Updated to enterprise user",
"expiration": "2025-12-31T23:59:59Z",
"profile": ["vpn_access"internet_access", "high_bandwidth"wifi_premium", "priority_support"email_access", "vpn_access"],
"user_time": 7200
}'
Example Response:
{
"id": 123,1,
"username": "john.doe.updated"john_doe_updated",
"external_id": "EXT_USER_789_NEW"EXT-USER-001-UPDATED",
"klass": "enterprise_user",
"password": "****"enterprise",
"is_active": true,
"organization": 7,2,
"description": "Enterprise customer - Updated profile"to enterprise user",
"date_joined": "2024-01-15T09:15T10:30:00Z",
"last_login": "2024-03-10T14:22:01-20T14:25:00Z",
"expiration": "2025-06-30T23:12-31T23:59:59Z",
"profile": ["vpn_access"internet_access", "high_bandwidth"wifi_premium", "priority_support"email_access", "admin_tools"vpn_access"],
"user_time": 1728007200
}
Response Codes:
| Status | Description |
|---|---|
| 200 | Success - User |
| 400 | Bad Request - Invalid data |
| 401 | Unauthorized - Invalid or missing |
PATCH /user_token/{id}/
Description: Partially updates specifica user account, allowing you to modify only specific fields without affecting unchangedother user data. This endpoint is ideal for making targetedincremental updateschanges like changingto user status, adding time balance, or modifying specific profile settings while preserving existing user information.accounts.
Use Cases:
UpdatingUpdate useractive/inactivetimestatusbalance without changing other detailsAddingModify user status (active/inactive)
Full URL Example:
https://gate.zequenze.com/api/v1/user_token/123/
Request Body Example:
{
"is_active": false,
"description": "Account suspended - Payment overdue",
"user_time": 0,
"profile": ["basic_access"]
}
cURL Example:
curl -X PATCH "https://gate.zequenze.com/api/v1/user_token/123/1/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"is_active": false,
"user_time": 05400,
"description": "Time balance updated",
"profile": ["internet_access", "wifi_premium"]
}'
Example Response:
{
"id": 123,1,
"username": "john.doe"john_doe",
"external_id": "EXT_USER_789"EXT-USER-001",
"klass": "premium_user",
"password": "****"premium",
"is_active": false,true,
"organization": 5,1,
"description": "AccountTime suspendedbalance - Payment overdue"updated",
"date_joined": "2024-01-15T09:15T10:30:00Z",
"last_login": "2024-03-10T14:22:01-20T14:25:00Z",
"expiration": "2024-12-31T23:59:59Z",
"profile": ["basic_access"internet_access", "wifi_premium"],
"user_time": 05400
}
Response Codes:
| Status | Description |
|---|---|
| 200 | Success - User |
| 400 | Bad Request - Invalid |
| 401 | Unauthorized - Invalid or missing |
DELETE /user_token/{id}/
Description: Permanently removes a user account from the system. This action iscannot irreversiblebe undone and will delete all associated user data, tokens,data and associated records. Use with caution and consider deactivating users instead of deletion for audit trail purposes.tokens.
Use Cases:
Removing test accounts from production systems
Full URL Example:
https://gate.zequenze.com/api/v1/user_token/123/
Parameters:
cURL Example:
curl -X DELETE "https://gate.zequenze.com/api/v1/user_token/123/1/" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Response Codes:
| Status | Description |
|---|---|
| 204 | No Content - User successfully deleted |
| 401 | Unauthorized - Invalid or missing |
Common Use Cases
Use Case 1: ISPInternet CustomerCafé User Management
ManageCreate time-based user accounts for internet service providercafé customers with time-basedspecific quotastime and service tiers.allocations. Use GET /user_token/POST to listcreate users with user_time values, then use PATCH to update remaining time as customers byuse organization,the POST /user_token/ to provision new customers, and PATCH /user_token/{id}/ to adjust quotas and service classes.service.
Use Case 2: CorporateGuest Network Access Control
ControlSet employeeup networktemporary accessguest accounts with expiration dates and limited AAA profiles. CreateUse usersthe withexpiration field to automatically invalidate accounts and the profile array to restrict access to specific network profiles, monitor login activity, and automatically disable accounts when employees leave the organization.services.
Use Case 3: Multi-tenantTenant SaaS UserOrganization Management
ManageFilter and manage users across multiple clientdifferent organizations using the organization parameter. Use GET with differentorganization servicefiltering levels.to Filterdisplay users byper organization, assign appropriate AAA profiles based on subscription tiers,tenant, and trackensure usageproper throughisolation timebetween balances.organizations.
Use Case 4: Subscription Service Time Tracking
Monitor user time balances across your subscriber base using the balance=true parameter with GET requests. Use PATCH operations to add time when users purchase additional credits.
Use Case 5: External System Integration
Synchronize user data between your primary system and GATE API using external_id fields. Create and update users based on HR system changes, maintaining referential integrity across platforms.
Use Case 5: Prepaid Service Management
Implement prepaid internet or network services by managing user time balances. Create users with initialexternal timedatabases quotas,or monitorCRM remainingsystems balances,using andthe automaticallyexternal_id deactivatefield usersto whenmaintain timereferences expires.between systems while managing authentication through GATE.
Best Practices
-
UseTimePagination EffectivelyManagement: Alwaysimplementspecifypaginationtime values in seconds foruserconsistency.listsConsiderusingimplementinglimitautomaticandtimeoffsetdeductionparametersmechanismstothatavoid performance issuesintegrate withlargethesedatasetsAPI endpoints. -
ImplementPagination:ProperWhenFilteringretrieving large user lists, use appropriatelimitandoffsetvalues to prevent timeouts and improve performance. Start with limit=50 and adjust based on your needs.
Balance Monitoring: Use organizationthe andbalance=true usernameparameter filtersjudiciously toas reduceit APIadds responsecomputational sizesoverhead. andOnly improveinclude applicationit performancewhen you specifically need current balance information.
HandleSecurity Time Balances Carefully: When working with user_time values, always specify the balance=true parameter to get accurate remaining quotas
UseError PATCHHandling: Implement retry logic for Targetednetwork Updates: Prefer PATCH over PUT for single field updates to reduce bandwidthfailures and avoidhandle accidentally404 clearingerrors fieldsgracefully when users might have been deleted by other processes.
ImplementBulk Soft DeletionOperations: ConsiderFor settingcreating is_active=falseor insteadupdating ofmultiple usingusers, DELETEimplement forbatching betterwith auditappropriate trailsdelays andto dataavoid recoveryoverwhelming optionsthe API server.
MonitorProfile Expiration DatesManagement: RegularlyMaintain checka userreference expirationlist datesof andavailable implementAAA automatedprofiles processesin your application to handle expired accounts