API reference
Policies
Device policies across platforms, how many devices each one manages, and which devices are assigned to it.
A policy is the configuration WeGuard applies to the devices assigned to it. Each device has at most one policy, shown in policy on the device object.
The policy object
idstring- Unique policy id.
objectstring- Always
policy. platformstring- Platform the policy targets. Mac policies are
macos, Apple TV policiestvos.One ofandroidiosmacostvoswindows namestringnullable- Policy name as shown in the console.
nullonly for malformed legacy records. descriptionstringnullable- Description entered in the console.
typestringnullable- Platform-specific policy variant as shown in the console, for example
ANDROID_KIOSK. For information only. New values may appear. deviceCountinteger- Number of devices currently assigned to the policy. This is the same count the console shows.
createdAttimestamp- When the policy was created.
updatedAttimestampnullable- When the policy was last changed.
{
"id": "64ff0a1b2c3d4e5f60718293",
"object": "policy",
"platform": "android",
"name": "Kiosk: Scanners",
"description": "Locked-down scanner devices",
"type": "ANDROID_KIOSK",
"deviceCount": 128,
"createdAt": "2026-01-09T11:00:00Z",
"updatedAt": "2026-09-30T16:42:10Z"
}List policies
/ v1/ policiesReturns the policies in your account, ordered by id (creation order), as a paginated list.
Query parameters
platformstringoptionaldefault all platforms- Only return items for these platforms. Pass a comma-separated list, for example
android,ios. Values are case-insensitive.ioscovers iPhone, iPad and iPod touch.One or more ofandroidiosmacostvoswindows limitintegeroptionaldefault 25- Maximum number of items to return, from
1to100. cursorstringoptional- The
nextCursorfrom the previous page. Send it unchanged, together with the same filters. See Pagination. includeTotalbooleanoptionaldefault false- Set to
trueto also returntotalCount. It runs an extra count, so request it only when you need it.
Example request
curl "https://api-gw.weguard.ai/core/v1/policies?platform=android&limit=1" \
-H "Authorization: Bearer $WEGUARD_API_KEY"const response = await fetch("https://api-gw.weguard.ai/core/v1/policies?platform=android&limit=1", {
headers: { Authorization: `Bearer ${process.env.WEGUARD_API_KEY}` },
});
const body = await response.json();
if (!response.ok) {
throw new Error(`${body.code}: ${body.detail} (requestId ${body.requestId})`);
}
console.log(body);import os
import requests
response = requests.get(
"https://api-gw.weguard.ai/core/v1/policies",
params={"platform": "android", "limit": 1},
headers={"Authorization": f"Bearer {os.environ['WEGUARD_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
print(response.json())Response
A list object whose data holds policy objects.
{
"object": "list",
"data": [
{
"id": "64ff0a1b2c3d4e5f60718293",
"object": "policy",
"platform": "android",
"name": "Kiosk: Scanners",
"description": "Locked-down scanner devices",
"type": "ANDROID_KIOSK",
"deviceCount": 128,
"createdAt": "2026-01-09T11:00:00Z",
"updatedAt": "2026-09-30T16:42:10Z"
}
],
"hasMore": true,
"nextCursor": "YzE6NjUyM2YxYzJhN2I5ZDQwMDEyMzQ1Njc4"
}Errors
limit,includeTotalor a filter has an invalid value, or a parameter was sent twice.The request includes a query parameter this endpoint does not accept.
The cursor is malformed or was issued for different filters.
The key lacks
policies:read.
Retrieve a policy
/ v1/ policies/ {policyId}Returns a single policy by id.
Path parameters
policyIdstringrequired- Id of the policy. Case-insensitive.
Example request
curl https://api-gw.weguard.ai/core/v1/policies/64ff0a1b2c3d4e5f60718293 \
-H "Authorization: Bearer $WEGUARD_API_KEY"const response = await fetch("https://api-gw.weguard.ai/core/v1/policies/64ff0a1b2c3d4e5f60718293", {
headers: { Authorization: `Bearer ${process.env.WEGUARD_API_KEY}` },
});
const body = await response.json();
if (!response.ok) {
throw new Error(`${body.code}: ${body.detail} (requestId ${body.requestId})`);
}
console.log(body);import os
import requests
response = requests.get(
"https://api-gw.weguard.ai/core/v1/policies/64ff0a1b2c3d4e5f60718293",
headers={"Authorization": f"Bearer {os.environ['WEGUARD_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
print(response.json())Response
Returns a policy object.
{
"id": "64ff0a1b2c3d4e5f60718293",
"object": "policy",
"platform": "android",
"name": "Kiosk: Scanners",
"description": "Locked-down scanner devices",
"type": "ANDROID_KIOSK",
"deviceCount": 128,
"createdAt": "2026-01-09T11:00:00Z",
"updatedAt": "2026-09-30T16:42:10Z"
}Errors
No policy with this id exists in your account.
The request includes a query parameter. This endpoint takes none.
The key lacks
policies:read.
List a policy’s devices
/ v1/ policies/ {policyId}/ devicesReturns the devices assigned to a policy, ordered by id, as a paginated list. Requires both policies:read and devices:read.
Path parameters
policyIdstringrequired- Id of the policy. Case-insensitive.
Query parameters
limitintegeroptionaldefault 25- Maximum number of items to return, from
1to100. cursorstringoptional- The
nextCursorfrom the previous page. Send it unchanged, together with the same filters. See Pagination. includeTotalbooleanoptionaldefault false- Set to
trueto also returntotalCount. It runs an extra count, so request it only when you need it.
Example request
curl "https://api-gw.weguard.ai/core/v1/policies/64ff0a1b2c3d4e5f60718293/devices?limit=1" \
-H "Authorization: Bearer $WEGUARD_API_KEY"const response = await fetch("https://api-gw.weguard.ai/core/v1/policies/64ff0a1b2c3d4e5f60718293/devices?limit=1", {
headers: { Authorization: `Bearer ${process.env.WEGUARD_API_KEY}` },
});
const body = await response.json();
if (!response.ok) {
throw new Error(`${body.code}: ${body.detail} (requestId ${body.requestId})`);
}
console.log(body);import os
import requests
response = requests.get(
"https://api-gw.weguard.ai/core/v1/policies/64ff0a1b2c3d4e5f60718293/devices",
params={"limit": 1},
headers={"Authorization": f"Bearer {os.environ['WEGUARD_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
print(response.json())Response
A list object whose data holds device objects.
{
"object": "list",
"data": [
{
"id": "6523f1c2a7b9d40012345678",
"object": "device",
"platform": "android",
"name": "Warehouse Scanner 12",
"model": "SM-T505",
"manufacturer": "samsung",
"osVersion": "13",
"serialNumber": "R9JN30ABCDE",
"imei": "356938035643809",
"phoneNumber": null,
"agentVersion": "6.4.2",
"policy": {
"id": "64ff0a1b2c3d4e5f60718293",
"name": "Kiosk: Scanners"
},
"enrollment": {
"status": "enrolled",
"enrolledAt": "2026-03-14T08:12:44Z"
},
"state": {
"lost": false,
"compromised": false,
"locked": false
},
"compliance": {
"policyCompliant": true,
"appsCompliant": false
},
"tags": {
"tag1": "Dock 4",
"tag3": "Night shift"
},
"lastSeenAt": "2026-10-07T09:29:51Z",
"connectivity": {
"status": "online",
"thresholdMinutes": 1440
},
"createdAt": "2026-03-14T08:10:02Z",
"details": {
"deviceIdType": "IMEI",
"suspended": false,
"wiped": false,
"enterpriseEnrolled": true,
"appliedPolicyVersion": 42,
"mobileDataUsageBytes": 1288490188,
"wifiDataUsageBytes": 9663676416,
"batteryLevel": 87
}
}
],
"hasMore": true,
"nextCursor": "YzE6NjUyM2YxYzJhN2I5ZDQwMDEyMzQ1Njc4"
}Errors
No policy with this id exists in your account.
limit,includeTotalor a filter has an invalid value, or a parameter was sent twice.The request includes a query parameter this endpoint does not accept.
The cursor is malformed or was issued for different filters.
The key lacks
policies:readordevices:read.
Common errors
Besides the errors listed for each endpoint, any request can fail authentication, exceed the rate limit, ask for a format other than JSON, or fail with a server error. See Errors for the response format and retry guidance.
The request has no
Authorizationheader.The
Authorizationheader does not use theBearerscheme, or has no key after it. TheWWW-Authenticateheader carrieserror="invalid_request".The key is malformed, does not exist, or its secret does not match. The
WWW-Authenticateheader carrieserror="invalid_token".The key is past its
expiresAt.An account admin revoked the key. Revocation takes effect immediately and cannot be undone.
The WeGuard account that owns the key has been deleted or disabled.
The
Acceptheader excludes JSON.The key has used up its request budget. See Rate limits.
An unexpected error occurred on our side.
A service WeGuard depends on is temporarily unavailable, or reading the data took longer than the time WeGuard allows for it. This can also happen while your key is being checked, so it can be returned before authentication completes. The response carries
Retry-After.