Schema (Filterable Columns)
The schema endpoint lets you discover which columns are available for filtering on any datatable-based endpoint. This is especially useful for building dynamic filters or working with the custom_filter parameter on endpoints like PPC.
GET /schema/get-filterable-columns
Returns the list of filterable columns for a given datatable, including column names, display titles, data types, and descriptions.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
datatable | string | Yes | Datatable identifier (see table below) |
account_title | string | No | Filter by account title |
seller_id | string | No | Amazon seller ID (requires marketplace_id) |
marketplace_id | string | No | Amazon marketplace ID (requires seller_id) |
Common Datatable Identifiers
| Datatable | Used By |
|---|---|
products | Inventory, product listings |
inventory | Inventory list |
orders | Sales orders |
ppc_sp_campaigns | SP campaign data |
ppc_sp_ad_groups | SP ad group data |
ppc_sp_keywords | SP keyword data |
ppc_sb_campaigns | SB campaign data |
ppc_sb_ad_groups | SB ad group data |
ppc_sd_campaigns | SD campaign data |
ppc_sd_ad_groups | SD ad group data |
Response
json
{
"datatable": "ppc_sp_campaigns",
"columns": [
{
"name": "impressions",
"title": "Impressions",
"type": "number",
"description": "Impressions - Total number of ad impressions"
},
{
"name": "campaign_name",
"title": "Campaign Name",
"type": "text",
"description": "Campaign Name - The name of the campaign"
},
{
"name": "state",
"title": "State",
"type": "select",
"description": "State - Campaign state (enabled, paused, archived)"
}
]
}Column Types
| Type | Description | Filter Conditions |
|---|---|---|
text | Text fields | contains, is, is_not, starts_with, ends_with, regexp |
number | Numeric fields | >, <, >=, <=, =, between |
select | Enum/choice fields | in, not_in |
date | Date fields | between, greater_than, less_than |
bool | Boolean fields | true, false |
All types also support: is_null, not_null, is_empty.
Using custom_filter
Once you know the available columns, you can build custom_filter objects for endpoints that support them:
json
{
"impressions": {
"type": "number",
"condition": ">",
"value": 1000
},
"campaign_name": {
"type": "text",
"condition": "contains",
"value": "Brand"
}
}Examples
python
import requests
headers = {"Authorization": "Bearer YOUR_ACCESS_TOKEN"}
# Discover filterable columns for SP campaigns
response = requests.get(
"https://app.sellerlegend.com/api/schema/get-filterable-columns",
headers=headers,
params={
"datatable": "ppc_sp_campaigns",
"account_title": "My Store US"
}
)
schema = response.json()
for col in schema["columns"]:
print(f"{col['name']} ({col['type']}): {col['description']}")php
$token = "YOUR_ACCESS_TOKEN";
$params = http_build_query([
"datatable" => "ppc_sp_campaigns",
"account_title" => "My Store US"
]);
$ch = curl_init("https://app.sellerlegend.com/api/schema/get-filterable-columns?{$params}");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer {$token}"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$schema = json_decode(curl_exec($ch), true);
curl_close($ch);
foreach ($schema["columns"] as $col) {
echo "{$col['name']} ({$col['type']}): {$col['description']}\n";
}javascript
const response = await fetch(
"https://app.sellerlegend.com/api/schema/get-filterable-columns?" + new URLSearchParams({
datatable: "ppc_sp_campaigns",
account_title: "My Store US"
}),
{
headers: { Authorization: "Bearer YOUR_ACCESS_TOKEN" }
}
);
const schema = await response.json();
schema.columns.forEach(col => {
console.log(`${col.name} (${col.type}): ${col.description}`);
});bash
curl -G "https://app.sellerlegend.com/api/schema/get-filterable-columns" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d "datatable=ppc_sp_campaigns" \
-d "account_title=My+Store+US"Combining Schema with PPC Queries
A common workflow is to first discover available columns, then use them to filter PPC data:
python
import requests
import json
headers = {"Authorization": "Bearer YOUR_ACCESS_TOKEN"}
base_url = "https://app.sellerlegend.com/api"
# Step 1: Discover columns
schema = requests.get(
f"{base_url}/schema/get-filterable-columns",
headers=headers,
params={"datatable": "ppc_sp_campaigns", "account_title": "My Store US"}
).json()
print("Available columns:", [c["name"] for c in schema["columns"]])
# Step 2: Use discovered columns to filter PPC data
custom_filter = {
"impressions": {"type": "number", "condition": ">", "value": 1000},
"acos": {"type": "number", "condition": "<", "value": 30}
}
ppc_data = requests.get(
f"{base_url}/ppc/get-list",
headers=headers,
params={
"account_title": "My Store US",
"ppc_type": "sp",
"entity_type": "campaigns",
"per_page": 100,
"currency": "USD",
"custom_filter": json.dumps(custom_filter)
}
).json()
for campaign in ppc_data["data"]:
print(f"{campaign['campaign_name']}: {campaign['impressions']} impressions, {campaign['acos']}% ACoS")