List the users of your white label
action=get-users
No side effects
MCP: always on
Lists the end users of your white label, one page at a time, with the oldest user first.
MCP tool:
white_label_list_users.
Use with AI
Each user comes with its identifier, its display name, its status and its designer flag. Use the identifier in the other actions.
The users come in the same order on every call, so paging never skips or repeats a user. In the answer, total counts the users that match status. To read every user, ask for page_number 1, 2 and so on, until page_number times per_page reaches total.
This action takes no identifier. It signs in nobody and creates nobody.
See also: Users and their banners.
Parameters
Every request also has the
common parameters
client_id, t, signature and
action.
| Name | Description | Allowed values |
|---|---|---|
page_number
Optional
whole number |
The page to read, from 1. The API counts a value below 1 as 1.
Example: 1 | At least 1Default: 1 |
per_page
Optional
whole number |
The number of users on a page, from 1 to 500. The API counts a value outside this range as the nearest limit.
Example: 100 | 1 to 500Default: 100 |
status
Optional
one value from a list |
active lists only the active users. disabled lists only the disabled users. all (the default) lists both. The API treats any other value as all.
Example: active | active, disabled or allDefault: all |
Response
| Field | Type | Description |
|---|---|---|
code |
integer | 200 when the call worked. Every answer comes with HTTP 200, errors too, so read this field. |
data.users[].identifier |
string | The key of the user in your own system. Send it as identifier in the other actions. |
data.users[].name |
string | The display name of the user. |
data.users[].status |
string | active or disabled. |
data.users[].designer |
boolean | true when the user is a designer account of your white label. |
data.total |
integer | The number of users that match status, on all pages together. |
data.page_number |
integer | The page in this answer, after the API applied the limits. |
data.per_page |
integer | The number of users per page, after the API applied the limits. The last page can have fewer users. |
Example
{
"code": 200,
"data": {
"users": [
{
"identifier": "user-a",
"name": "User A",
"status": "active",
"designer": false
},
{
"identifier": "user-b",
"name": "User B",
"status": "disabled",
"designer": true
}
],
"total": 2,
"page_number": 1,
"per_page": 100
}
}
Errors
The error code is in the code field. The
errors guide explains the
answer shapes and the codes that come as text.
| Code | Meaning | What to do |
|---|---|---|
| 510 The request has expired | The time in t is more than one hour away from the clock of the API server. The API accepts a request from one hour before t until one hour after t. A missing t gives the same code. | When you sign the request, set t to the current Unix time in seconds. Make sure that the clock of your server is correct. Sign the request again if it is older than one hour. Send every parameter in the query string, because the API does not read a POST body. |
| 512 Client id not found | The API does not know this client id. | Make sure that client_id is the client id of your API credentials, with no extra spaces. |
| 513 Invalid signature | The signature does not match the parameters and your secret key. | Sign with the secret key of your white label, not with the client id. Use every query parameter except signature. Sort the names in byte order. Join each name and its value with no separator. Compute the HMAC-SHA1 of the result as 40 lowercase hex characters. Sign the values before URL encoding. |
| 515 Disabled domain | Your white label is not active. | Contact Bannersnack support. |
Code examples
These examples send the required parameters with example values.
Replace YOUR_CLIENT_ID with your client id. The
Node, PHP and Python examples sign the request themselves. They
read your secret key from the environment variable
BANNERSNACK_SECRET_KEY.
The cURL example shows the form of a signed request. It has an
example signature and an old t, so the API refuses
it. Use Try it to get a cURL command that is signed with your
own key.
cURL
curl -sS 'https://enterprise.bannersnack.com/wapi/2.0/?action=get-users&client_id=YOUR_CLIENT_ID&t=1793361600&signature=6e6f10ba5cf71d53dcaa216ec759871a8361b8ed'
Node
import { createHmac } from 'node:crypto';
const params = {
"action": "get-users",
"client_id": "YOUR_CLIENT_ID"
};
params.t = String(Math.floor(Date.now() / 1000));
const data = Object.keys(params).sort().map(key => key + params[key]).join('');
params.signature = createHmac('sha1', process.env.BANNERSNACK_SECRET_KEY).update(data).digest('hex');
const url = "https://enterprise.bannersnack.com/wapi/2.0/" + '?' + new URLSearchParams(params);
const response = await fetch(url);
console.log(await response.json());
PHP
<?php
$params = [
'action' => 'get-users',
'client_id' => 'YOUR_CLIENT_ID',
];
$params['t'] = (string) time();
ksort($params);
$data = '';
foreach ($params as $key => $value) {
$data .= $key . $value;
}
$params['signature'] = hash_hmac('sha1', $data, getenv('BANNERSNACK_SECRET_KEY'));
$url = 'https://enterprise.bannersnack.com/wapi/2.0/' . '?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986);
echo file_get_contents($url), PHP_EOL;
Python
import hashlib, hmac, os, time, urllib.parse, urllib.request
params = {
"action": "get-users",
"client_id": "YOUR_CLIENT_ID"
}
params["t"] = str(int(time.time()))
data = "".join(key + params[key] for key in sorted(params))
secret = os.environ["BANNERSNACK_SECRET_KEY"].encode()
params["signature"] = hmac.new(secret, data.encode(), hashlib.sha1).hexdigest()
url = "https://enterprise.bannersnack.com/wapi/2.0/" + "?" + urllib.parse.urlencode(params, quote_via=urllib.parse.quote)
with urllib.request.urlopen(url) as response:
print(response.read().decode())