Listing Data Types
Query and retrieve data types with pagination and sorting.
Endpoint
Retrieves all data types (both built-in and custom) with optional filtering, sorting, and pagination.
Authentication
Requires any valid API Key. All keys have read access.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
sortBy |
string | "name asc" |
Sort specification (e.g., "name asc", "type desc") |
skip |
integer | 0 |
Number of records to skip (for pagination) |
take |
integer | All | Number of records to return |
Response
Returns a paginated list of data types:
Response Format
{
"items": [
{
"id": "uuid",
"type": "US_SSN",
"name": "US SSN",
"description": "US Social Security Number (9 digits)",
"disabled": false,
"isGroupDataType": false,
"isBuiltIn": true,
"regexes": [
{
"regex": "\\b\\d{3}-\\d{2}-\\d{4}\\b",
"json": "",
"html": "",
"valueGroupIndex": 0
}
],
"createdAt": 1704067200,
"updatedAt": 1704067200
}
],
"count": 25
}
Response Fields
| Field | Type | Description |
|---|---|---|
id |
UUID | Unique data type identifier |
type |
string | Type identifier |
name |
string | Display name |
description |
string | Description |
disabled |
boolean | Whether type is disabled |
isGroupDataType |
boolean | Whether this is a group type |
isBuiltIn |
boolean | Whether this is a built-in type (cannot be modified) |
regexes |
array | Regex patterns (only for regex types) |
dataTypes |
array | Member type UUIDs (only for group types) |
createdAt |
integer | Unix timestamp when created |
updatedAt |
integer | Unix timestamp of last update |
Examples
List All Data Types
Retrieve all data types sorted by name.
import requests
BASE_URL = "https://your-shield-host:8080"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}
response = requests.get(
f"{BASE_URL}/api/datatypes",
headers=HEADERS,
params={"sortBy": "name asc"}
)
for dt in response.json()["items"]:
status = "disabled" if dt["disabled"] else "enabled"
built_in = "built-in" if dt["isBuiltIn"] else "custom"
print(f"{dt['name']}: {dt['type']} ({status}, {built_in})")
const axios = require('axios');
const BASE_URL = 'https://your-shield-host:8080';
const HEADERS = { 'Authorization': 'Bearer YOUR_API_KEY' };
const response = await axios.get(`${BASE_URL}/api/datatypes`, {
headers: HEADERS,
params: { sortBy: 'name asc' }
});
response.data.items.forEach(dt => {
const status = dt.disabled ? 'disabled' : 'enabled';
const builtIn = dt.isBuiltIn ? 'built-in' : 'custom';
console.log(`${dt.name}: ${dt.type} (${status}, ${builtIn})`);
});
Paginated Results
Retrieve data types with pagination (50 per page).
import requests
BASE_URL = "https://your-shield-host:8080"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}
page = 0
page_size = 50
response = requests.get(
f"{BASE_URL}/api/datatypes",
headers=HEADERS,
params={"skip": page * page_size, "take": page_size}
)
datatypes = response.json()
print(f"Page {page + 1}: {len(datatypes['items'])} of {datatypes['count']} total")
const axios = require('axios');
const BASE_URL = 'https://your-shield-host:8080';
const HEADERS = { 'Authorization': 'Bearer YOUR_API_KEY' };
const page = 0;
const pageSize = 50;
const response = await axios.get(`${BASE_URL}/api/datatypes`, {
headers: HEADERS,
params: { skip: page * pageSize, take: pageSize }
});
console.log(`Page ${page + 1}: ${response.data.items.length} of ${response.data.count} total`);
Filter Custom Data Types Only
Retrieve and filter only custom (non-built-in) data types.
import requests
BASE_URL = "https://your-shield-host:8080"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}
response = requests.get(f"{BASE_URL}/api/datatypes", headers=HEADERS)
# Filter custom types client-side
custom_types = [dt for dt in response.json()["items"] if not dt["isBuiltIn"]]
print(f"Custom data types: {len(custom_types)}")
for dt in custom_types:
print(f" - {dt['name']} ({dt['type']})")
const axios = require('axios');
const BASE_URL = 'https://your-shield-host:8080';
const HEADERS = { 'Authorization': 'Bearer YOUR_API_KEY' };
const response = await axios.get(`${BASE_URL}/api/datatypes`, { headers: HEADERS });
// Filter custom types client-side
const customTypes = response.data.items.filter(dt => !dt.isBuiltIn);
console.log(`Custom data types: ${customTypes.length}`);
customTypes.forEach(dt => {
console.log(` - ${dt.name} (${dt.type})`);
});
Related Topics
- Create Data Type - Create a new data type
- Get Data Type - Retrieve a specific data type by ID
- Update Data Type - Modify an existing data type
- Disable Data Type - Enable or disable a data type