# ⚙️ iVALT Admin Portal APIs Overview The **Admin Portal APIs** let you manage your organization programmatically: users, roles, authentication rules, and security policies. Control every aspect of your iValt deployment through code. ## 🚀 Quick Start: Manage Your Organization Step 1: Get Organization Details Retrieve your organization information and configuration using user ID and org code. Endpoint: GET /user/{user_id}/organizations/{org_code} Step 2: Manage Users Create, update, or delete users within your organization. Endpoints: POST /organization/{orgId}/create/user, PUT /organization/{orgId}/update/user/{userId} Step 3: Configure Geo-Fences & Time Slots Define location-based and time-based authentication policies for users. Endpoints: PUT /user/{userId}/geofences/update, PUT /user/{userId}/timeslots/update Step 4: List Organizations View all organizations and their details for management and monitoring. Endpoint: GET /organizations ## 💻 Code Examples: Common Admin Tasks ### Get Organization Information ```javascript // JavaScript/Node.js Example const axios = require('axios'); const getOrganization = async (apiKey, userId, orgCode) => { const response = await axios.get( `https://api.ivalt.com/admin/public/api/user/${userId}/organizations/${orgCode}`, { headers: { 'x-api-key': apiKey, 'Content-Type': 'application/json' } } ); return response.data; }; // Usage const org = await getOrganization('YOUR_API_KEY', 123, 'ORG001'); console.log('Organization:', org.data); console.log('Status:', org.status); ``` ```python # Python Example import requests def get_organization(api_key, user_id, org_code): headers = { 'x-api-key': api_key, 'Content-Type': 'application/json' } response = requests.get( f'https://api.ivalt.com/admin/public/api/user/{user_id}/organizations/{org_code}', headers=headers ) return response.json() # Usage org = get_organization('YOUR_API_KEY', 123, 'ORG001') print(f"Organization: {org['data']}") print(f"Status: {org['status']}") ``` ```curl # cURL Example curl -X GET https://api.ivalt.com/admin/public/api/user/123/organizations/ORG001 \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" ``` ### Create a New User ```javascript // JavaScript/Node.js Example const createUser = async (apiKey, orgId, userData) => { const response = await axios.post( `https://api.ivalt.com/admin/public/api/organization/${orgId}/create/user`, { email: userData.email, country_code: userData.countryCode, mobile: userData.mobile, first_name: userData.firstName, last_name: userData.lastName }, { headers: { 'x-api-key': apiKey, 'Content-Type': 'application/json' } } ); return response.data; }; // Usage const newUser = await createUser('YOUR_API_KEY', 123, { email: 'john.doe@example.com', countryCode: '+1', mobile: '2345678901', firstName: 'John', lastName: 'Doe' }); console.log('User created:', newUser.status); console.log('Message:', newUser.message); ``` ```python # Python Example def create_user(api_key, org_id, user_data): headers = { 'x-api-key': api_key, 'Content-Type': 'application/json' } response = requests.post( f'https://api.ivalt.com/admin/public/api/organization/{org_id}/create/user', headers=headers, json={ 'email': user_data['email'], 'country_code': user_data['country_code'], 'mobile': user_data['mobile'], 'first_name': user_data['first_name'], 'last_name': user_data['last_name'] } ) return response.json() # Usage new_user = create_user('YOUR_API_KEY', 123, { 'email': 'john.doe@example.com', 'country_code': '+1', 'mobile': '2345678901', 'first_name': 'John', 'last_name': 'Doe' }) print(f"User created: {new_user['status']}") print(f"Message: {new_user['message']}") ``` ```curl # cURL Example curl -X POST https://api.ivalt.com/admin/public/api/organization/123/create/user \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "email": "john.doe@example.com", "country_code": "+1", "mobile": "2345678901", "first_name": "John", "last_name": "Doe" }' ``` ### Configure User Geo-Fences ```javascript // JavaScript/Node.js Example const updateUserGeofences = async (apiKey, userId, geofences) => { const response = await axios.put( `https://api.ivalt.com/admin/public/api/user/${userId}/geofences/update`, { geofences: geofences }, { headers: { 'x-api-key': apiKey, 'Content-Type': 'application/json' } } ); return response.data; }; // Usage const result = await updateUserGeofences('YOUR_API_KEY', 123, [ { name: 'Office Location', latitude: 37.7749, longitude: -122.4194, radius: 500, enabled: true } ]); console.log('Geo-fences updated:', result.status); console.log('Message:', result.message); ``` ```python # Python Example def update_user_geofences(api_key, user_id, geofences): headers = { 'x-api-key': api_key, 'Content-Type': 'application/json' } response = requests.put( f'https://api.ivalt.com/admin/public/api/user/{user_id}/geofences/update', headers=headers, json={ 'geofences': geofences } ) return response.json() # Usage result = update_user_geofences('YOUR_API_KEY', 123, [ { 'name': 'Office Location', 'latitude': 37.7749, 'longitude': -122.4194, 'radius': 500, 'enabled': True } ]) print(f"Geo-fences updated: {result['status']}") print(f"Message: {result['message']}") ``` ```curl # cURL Example curl -X PUT https://api.ivalt.com/admin/public/api/user/123/geofences/update \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "geofences": [ { "name": "Office Location", "latitude": 37.7749, "longitude": -122.4194, "radius": 500, "enabled": true } ] }' ``` ### List All Organizations ```javascript // JavaScript/Node.js Example const listOrganizations = async (apiKey) => { const response = await axios.get( 'https://api.ivalt.com/admin/public/api/organizations', { headers: { 'x-api-key': apiKey, 'Content-Type': 'application/json' } } ); return response.data; }; // Usage const orgs = await listOrganizations('YOUR_API_KEY'); console.log('Status:', orgs.status); console.log('Organizations:', orgs.data); orgs.data.forEach(org => { console.log(`- ${org.name} (${org.slug})`); }); ``` ```python # Python Example def list_organizations(api_key): headers = { 'x-api-key': api_key, 'Content-Type': 'application/json' } response = requests.get( 'https://api.ivalt.com/admin/public/api/organizations', headers=headers ) return response.json() # Usage orgs = list_organizations('YOUR_API_KEY') print(f"Status: {orgs['status']}") print(f"Organizations: {orgs['data']}") for org in orgs['data']: print(f"- {org['name']} ({org['slug']})") ``` ```curl # cURL Example curl -X GET https://api.ivalt.com/admin/public/api/organizations \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" ``` ## 🔧 Key Capabilities | Feature | Description | | --- | --- | | **Organization Management** | Retrieve org details, auth codes, and configuration settings. | | **User & Role Management** | Create, update, delete users and assign roles with granular permissions. | | **Security Rules** | Configure geo-fencing, time windows and device trust policies. | | **Audit & Monitoring** | Access authentication logs, track security events, and monitor user activity. | | **Bulk Operations** | Import/export users, apply rules in bulk, and manage at scale. | ## 🛡️ Available Rule Types Configure these security policies to control authentication: | Rule Type | Description | Use Case | | --- | --- | --- | | **Geo-Fence** | Restrict authentication to specific geographic locations | Office-only access, regional restrictions | | **Time Window** | Allow authentication only during specific hours/days | Business hours enforcement, scheduled access | | **Device Trust** | Require registered and trusted devices for authentication | BYOD policies, device management | | **Multi-Factor** | Enforce additional verification factors beyond biometrics | High-security environments, compliance | ## 📚 Next Steps - Explore the full API reference in the sidebar - Learn about authentication in the [Authentication APIs](/products/authentication) - Test endpoints using the **Try It** console on each API page - Review best practices for security rule configuration