Get Users

GET /api/v1/users

Common errors include:

  • "Bad Request" if body parameters are not passed
  • "DNS_CONFIGURATION_ERROR" if custom domain DNS is misconfigured.

Get all users, and get relevant users for appropriate params passed to request body

Request

Method : GET
Content-Type : Application/json

URL Parameters Schema

search string
Default: null
Search term to filter users by email, firstName, or lastName
type string
Default: null
Type of filter to apply (‘user’, ‘subscription’, or ‘payment’)
sort string
Default: latest
Sort order for results (‘oldest’ or ‘latest’)
filter string
Default: null
Filter criteria:
- For type='user': 'enabled' or 'disabled'
- For general: 'free' or 'paid'
- For type='subscription'/'payment': plan name
startDate string (ISO date)
Default: null
Start date for filtering users by creation date (format: YYYY-MM-DD)
endDate string (ISO date)
Default: null
End date for filtering users by creation date (format: YYYY-MM-DD)
LANGUAGE
REQUEST
 curl -X GET 
 'https://divsly-backend.vercel.app/api/v1/admin/users?search=john&type=user&filter=enabled&sort=latest&startDate=2024-01-01&endDate=2024-03-20' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'

API REQUEST
 // JavaScript Fetch
const queryParams = new URLSearchParams({
  search: 'john',
  type: 'user',
  filter: 'enabled',
  sort: 'latest',
  startDate: '2024-01-01',
  endDate: '2024-03-20'
});

fetch(`https://divsly-backend.vercel.app/api/v1/admin/users?${queryParams}`, {
  method: 'GET',
  headers: {
	'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
  }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

API REQUEST
 const axios = require('axios');

 const params = {
  search: 'john',
  type: 'user',
  filter: 'enabled',
  sort: 'latest',
  startDate: '2024-01-01',
  endDate: '2024-03-20'
};

 axios.get('https://divsly-backend.vercel.app/api/v1/admin/users', {
  params,
  headers: {
	'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
  }
})
 .then(response => console.log(response.data))
 .catch(error => console.error('Error:', error));

API REQUEST
 // PHP cURL
$params = http_build_query([
	'search' => 'john',
	'type' => 'user',
	'filter' => 'enabled',
	'sort' => 'latest',
	'startDate' => '2024-01-01',
	'endDate' => '2024-03-20'
]);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://divsly-backend.vercel.app/api/v1/admin/users?" . $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
	'Authorization: Bearer YOUR_ACCESS_TOKEN'
]);

$response = curl_exec($ch);
$data = json_decode($response, true);

if (curl_errno($ch)) {
	echo 'Error:' . curl_error($ch);
}
curl_close($ch);
API REQUEST
 # Python Requests
import requests

params = {
	'search': 'john',
	'type': 'user',
	'filter': 'enabled',
	'sort': 'latest',
	'startDate': '2024-01-01',
	'endDate': '2024-03-20'
}

headers = {
	'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}

response = requests.get(
	'https://divsly-backend.vercel.app/api/v1/admin/users',
	params=params,
	headers=headers
)

if response.status_code == 200:
	data = response.json()
	print(data)
else:
	print(f"Error: {response.status_code}")
RESPONSE
  {
  "error": false,
  "data": [
	{
  	"id": 120,
  	"userType": "user",
  	"isAdmin": false,
  	"avatar": "data:image/png;base64,iVBORw",
  	"password": "",
  	"username": null,
  	"email": "test@test.com",
  	"firstName": "test",
  	"lastName": "",
  	"company": null,
  	"companySize": null,
  	"industry": null,
  	"jobTitle": null,
  	"onboardingStatus": "NOT_STARTED",
  	"vatId": null,
  	"mobile": null,
  	"token": null,
  	"country": "IN",
  	"profileImage": null,
  	"parentUser": 89,
  	"lastLogin": null,
  	"ip": "183.83.160.128",
  	"edit": 0,
  	"stripeCustomerId": null,
  	"subscriptionId": null,
  	"subscriptionItemId": null,
  	"plan": "yearly-super",
  	"planStart": null,
  	"planStatus": null,
  	"paymentStatus": null,
  	"subStartDate": "2025-03-17T15:51:37.000Z",
  	"subEndDate": "2054-03-16T18:30:00.000Z",
  	"demoTour1": false,
  	"demoTour2": false,
  	"demoTour3": false,
  	"method": "Manual",
  	"isActive": true,
  	"passwordUpdated": false,
  	"isVerified": true,
  	"isDelete": false,
  	"createdAt": "2025-04-02T03:33:05.492Z",
  	"updatedAt": "2025-04-02T03:33:05.492Z",
  	"isadminblocked": false,
  	"useracceptedterms": false,
  	"userEvents": {},
  	"qrCodes": []
	},
	{
  	"id": 89,
  	"userType": "account-admin",
  	"isAdmin": false,
  	"avatar": "data:image/png;base64,iVBOR=",
  	"password": "$2a$10$0xZ9mmbvnREiveF/xRjmW.WTsQbgI0MLzxXiKD83g2rP6xKeZmESO",
  	"username": null,
  	"email": "siva6789@yopmail.com",
  	"firstName": "siva6789",
  	"lastName": "",
  	"company": null,
  	"companySize": null,
  	"industry": null,
  	"jobTitle": null,
  	"onboardingStatus": "COMPLETED",
  	"vatId": null,
  	"mobile": "919515589894",
  	"token": null,
  	"country": "IN",
  	"profileImage": null,
  	"parentUser": null,
  	"lastLogin": "2025-03-27T03:03:56.548Z",
  	"ip": "183.83.160.128",
  	"edit": 0,
  	"stripeCustomerId": null,
  	"subscriptionId": "sub_Q7ugtFFEIzksB5",
  	"subscriptionItemId": null,
  	"plan": "yearly-super",
  	"planStart": "2025-03-17T15:51:17.000Z",
  	"planStatus": null,
  	"paymentStatus": "captured",
  	"subStartDate": "2025-03-17T15:51:37.000Z",
  	"subEndDate": "2054-03-16T18:30:00.000Z",
  	"demoTour1": false,
  	"demoTour2": false,
  	"demoTour3": false,
  	"method": "Manual",
  	"isActive": true,
  	"passwordUpdated": false,
  	"isVerified": true,
  	"isDelete": false,
  	"createdAt": "2025-03-10T07:29:14.321Z",
  	"updatedAt": "2025-03-27T03:04:12.626Z",
  	"isadminblocked": false,
  	"useracceptedterms": true,
  	"userEvents": {
    	"first_qr_code_created": true,
    	"first_short_link_created": true
  	},
  	"qrCodes": []
	}
  ]
}


   
 {
  "error": true,
  "message": "Unauthorized access",
  "data": null
}



  {
  "error": true,
  "message": "Unauthorized access",
  "data": null
}
  
  {
  "error": true,
  "message": "Access forbidden. Admin privileges required",
  "data": null
}

  
  {
  "error": true,
  "message": “User doesn’t exists”
}