Skip to main content

User Token

Endpoints Summary

Method Path Swagger 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 providesmanages comprehensiveusers userwithin managementthe functionalityGATE withsystem, 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 delete usersuser whileaccounts managingwith theirdetailed authenticationprofile credentials, time-based balances,information and accesstoken-based profilestime management for youraccess organization'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:

  • NetworkUser Access Control: Managing user credentials and time quotas for network services
Service ProviderAccount Management: TrackingCreate, read, update, and delete user balances and service class assignments Multi-tenant Organizations: Organizing users across different organizationsaccounts with customdetailed profilesprofile External System Integration: Synchronizing user data with external databases using external_id references

Key features include:

    Time-based Quotas: Track user time balances in seconds for usage-based servicesinformation AAA Profile Integration: AssignAssociate authentication,users authorization,with Authentication, Authorization, and accountingAccounting profiles to users ExpirationTime-Based ManagementAccess Control: Set automaticManage user expirationtime datesallocations (in seconds) for token-based systems OrganizationalOrganization SegmentationFiltering: Group and filter users by organization Balance Tracking: Monitor remaining time balances for multi-tenant scenariosusers External System SyncIntegration: Link users to external systems via external_id forreferences seamless integration

    Common Use Cases:

      Internet café or hotspot user management Time-based service access control Guest network authentication systems Subscription-based time allocation services Multi-tenant user management with organizational boundaries

      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 dashboard
      • FilteringFilter users by organizationspecific organizations for multi-tenant managementsystems
      • Monitoring user balances for usage-based billing
      SearchingSearch for specific users by username GeneratingMonitor user reportsbalances withacross paginationthe supportsystem

      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 belonging to specificby organization IDidentifier
      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 in response

      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 BearerAPI token
      403 Forbidden - Insufficient permissions to access users

      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 users fromin externalthe systems
      Creating users with specific service class assignments Setting up users with predefined time quotassystem Bulk user creation throughfor automated scriptsorganizations OnboardingSet up guest accounts with specific time limits Create users with specificpredefined AAA profiles

      Full URL Example:

      https://gate.zequenze.com/api/v1/user_token/
      

      Request Body Example:Parameters:

      {
      "username" Parameter Type Required Description username string Yes Unique username (150 chars max, letters/digits/@/./+/-/:/ "jane.smith" password string No User password for authentication email string No User email address first_name string No User's first name last_name string No User's last name external_id string No Reference ID for external systems klass string No Service class reference (e.g., "password": "SecurePass123!"premium", "email":standard") "jane.smith@company.com", "first_name":"Jane",is_active "last_name":boolean "Smith",No "external_id":Whether "HR_EMP_4567",user "klass":account "standard_user",is "organization":active 5,(default: "description":true) "Standard employee-organization ITinteger Department",No "expiration":Organization "2024-12-31T23:59:59Z",ID "is_active":to true,associate "profile":user ["basic_network",with "email_access"], "avatar_url":"https://company.com/avatars/jane.smith.jpg"description }string No Descriptive text about the user expiration string No ISO 8601 date-time when user expires avatar_url string No URL to user's avatar image profile array No Array of AAA profile short-names

      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 already exists
      401 Unauthorized - Invalid or missing BearerAPI token
      403 Forbidden - Insufficient permissions to create users

      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 profile information in adminadministrative interfacesinterface
      • CheckingCheck user balancedetails andbefore quotagranting informationaccess
      • RetrievingRetrieve user datainformation for externalauthentication system synchronizationsystems
      • Building user account management features
      MonitoringMonitor individual user statustime and activitybalances

      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 ID to retrieve
      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 BearerAPI token
      403 Forbidden - Insufficient permissions 404 Not Found - User with specified ID does not exist 403 Forbidden - Insufficient permissions to access user

      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 user records from external systems
      Performing full profile updates in admin interfaces UpdatingBulk usersuser after organizationalinformation changes Resetting user configurations Migrating user data between systems Bulk updating user profiles with complete data sets

      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 completelyupdated updatedsuccessfully
      400 Bad Request - Invalid data or validation errorsprovided
      401 Unauthorized - Invalid or missing BearerAPI token
      403 Forbidden - Insufficient permissions 404 Not Found - User with specified ID does not exist 403 Forbidden - Insufficient permissions to update user

      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 user active/inactivetime statusbalance without changing other details
      • AddingModify user status (active/inactive)
      Add or removingremove specific AAA profiles Extending userUpdate expiration dates Adjustingor timeorganizational quotas and balances Making incremental changes to user accountsassignments

      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 partiallyupdated updatedsuccessfully
      400 Bad Request - Invalid fielddata valuesprovided
      401 Unauthorized - Invalid or missing BearerAPI token
      403 Forbidden - Insufficient permissions 404 Not Found - User with specified ID does not exist 403 Forbidden - Insufficient permissions to modify user

      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
      Cleaning up duplicate or invalid user accounts Complying with data deletion requirements (GDPR) Deprovisioning users who permanently leave organization Bulk cleanup ofRemove expired or unused accounts Clean up test or temporary users Comply with data retention policies Decommission user accounts

      Full URL Example:

      https://gate.zequenze.com/api/v1/user_token/123/
      

      Parameters:

      Parameter Type In Required Description id integer path Yes Unique user ID to delete

      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 BearerAPI token
      403 Forbidden - Insufficient permissions 404 Not Found - User with specified ID does not exist 403 Forbidden - Insufficient permissions to delete user 409 Conflict - User cannot be deleted due to existing dependencies

      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

      • UseTime Pagination EffectivelyManagement: Always implementspecify paginationtime values in seconds for userconsistency. listsConsider usingimplementing limitautomatic andtime offsetdeduction parametersmechanisms tothat avoid performance issuesintegrate with largethese datasetsAPI endpoints.

      • ImplementPagination: ProperWhen Filteringretrieving large user lists, use appropriate limit and offset values 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

      Secure Password HandlingConsiderations: Never store passwords in plain text. The API handles password hashing automatically, but ensure your client applications don't log or expose password fields;data. they're automatically masked in responses for security

      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

      Validate External IDs: When using external_id for system integration, ensure uniquenessyou're andassigning implementvalid properprofiles errorto handlingusers. for synchronization failures