Skip to main content

Catalog API

The Catalog API provides access to AudienceGPT's global topic catalog -- a shared repository of pre-classified audience segments. Organizations can browse, search, and filter the catalog, then selectively add topics to their own library. Topics added from the catalog are linked (not copied), so they benefit from global updates like engine version upgrades and taxonomy improvements.

Browse the Global Catalog

Retrieve a paginated, filtered list of global topics with an inLibrary flag indicating whether each topic is already in your organization's library.

GET /api/topics/catalog

Auth: API key with topics:read scope, or Clerk session

Query Parameters

ParameterTypeDefaultDescription
pagenumber1Page number
pageSizenumber25Items per page (max 100)
sortBystringcreated_atSort column: topic_name, parent_category, segment_type, taxonomy_type, audience_type, created_at
sortOrderstringdescasc or desc
searchstring--Free-text search across topic names, taxonomy paths, and keywords. Multi-word queries use AND matching (all words must appear).
parentCategorystring--Filter by parent category (41 types, e.g., "Auto", "Insurance")
taxonomyTypestring--Filter by taxonomy type group (13 groups)
segmentTypestring--B2B, B2C, B2B2C, B2E, B2G
audienceTypestring--Filter by audience type (14 types)
subcategorystring--Filter by subcategory (L0 tree node)
subcategoryL1string--Filter by subcategory L1 level
subcategoryL2string--Filter by subcategory L2 level
subcategoryL3string--Filter by subcategory L3 level
subcategoryL4string--Filter by subcategory L4 level
hasExternalIdboolean--Filter to topics with external IDs (imported/synced topics)
inLibraryboolean--true for topics already in your library, false for topics not yet added

Response (200)

{
"data": [
{
"id": "tp_01hy...",
"topicName": "Tesla Model 3 Buyers",
"parentCategory": "Auto",
"taxonomyType": "Automotive & Vehicles",
"subcategory": "Electric Vehicles",
"segmentType": "B2C",
"audienceType": "In-Market Buyers",
"iabCode": "IAB2",
"engineVersion": "2.5",
"createdAt": "2026-02-01T10:00:00.000Z",
"inLibrary": false
},
{
"id": "tp_02ab...",
"topicName": "BMW X5 Shoppers",
"parentCategory": "Auto",
"taxonomyType": "Automotive & Vehicles",
"subcategory": "Luxury Vehicles",
"segmentType": "B2C",
"audienceType": "In-Market Buyers",
"iabCode": "IAB2",
"engineVersion": "2.5",
"createdAt": "2026-01-15T08:00:00.000Z",
"inLibrary": true
}
],
"total": 2,
"page": 1,
"pageSize": 25,
"totalPages": 1
}

curl Example

# Search for automotive topics not yet in your library
curl "https://app.audiencegpt.com/api/topics/catalog?search=electric+vehicle&parentCategory=Auto&inLibrary=false" \
-H "Authorization: Bearer txadv_your_api_key"

TypeScript Example

async function searchCatalog(query: string, filters: Record<string, string> = {}) {
const params = new URLSearchParams({
search: query,
pageSize: "50",
...filters,
});

const response = await fetch(
`https://app.audiencegpt.com/api/topics/catalog?${params}`,
{ headers: { "Authorization": `Bearer ${API_KEY}` } }
);

return response.json();
}

// Search for B2B technology topics not in library
const results = await searchCatalog("cloud computing", {
segmentType: "B2B",
inLibrary: "false",
});

Catalog Facets

Get distinct filter values available in the global catalog for building filter UIs.

GET /api/topics/catalog/facets

Auth: API key with topics:read scope, or Clerk session

Response (200)

{
"parentCategories": ["Auto", "Business Technology", "Insurance", "Real Estate"],
"taxonomyTypes": ["Automotive & Vehicles", "Technology & Telecom", "Financial Services"],
"subcategories": ["Electric Vehicles", "Cloud Computing", "Cybersecurity"],
"subcategoryL1s": ["Battery Technology", "SaaS Platforms"],
"subcategoryL2s": [],
"subcategoryL3s": [],
"subcategoryL4s": [],
"audienceTypes": ["In-Market Buyers", "Business Decision Makers", "Technology Infrastructure Buyers"],
"segmentTypes": ["B2B", "B2C", "B2B2C"]
}
info

Subcategory facets in the catalog are sourced from the taxonomy tree (Level 0 nodes) rather than raw topic values, ensuring a clean and consistent filter list.


Add Topics to Library

Add global catalog topics to your organization's library. Supports two modes: ID-based (specific topics) and filter-based (bulk add all matching topics).

POST /api/topics/catalog

Auth: API key with topics:write scope, or Clerk session

Option 1: Add by Topic IDs

{
"topicIds": ["tp_01hy...", "tp_02ab...", "tp_03cd..."]
}
FieldTypeRequiredDescription
topicIdsstring[]YesGlobal topic IDs to add (max 500 per request)

Response (200)

{
"added": 3
}

Option 2: Add by Filters (Bulk)

Add all topics matching the specified filters at once.

{
"filters": {
"search": "electric vehicle",
"parentCategory": "Auto",
"segmentType": "B2C"
}
}
FieldTypeRequiredDescription
filters.searchstringNoFree-text search filter
filters.parentCategorystringNoParent category filter (41 types)
filters.taxonomyTypestringNoTaxonomy type filter (13 groups)
filters.subcategorystringNoSubcategory filter (L0 tree node)
filters.segmentTypestringNoSegment type filter
filters.audienceTypestringNoAudience type filter

Response (200)

{
"added": 47
}
tip

Filter-based bulk add uses an efficient single-query INSERT...SELECT that skips topics already in your library. This is much faster than adding topics one by one for large catalog selections.

curl Example

# Add specific topics by ID
curl -X POST https://app.audiencegpt.com/api/topics/catalog \
-H "Authorization: Bearer txadv_your_api_key" \
-H "Content-Type: application/json" \
-d '{"topicIds": ["tp_01hy...", "tp_02ab..."]}'

# Bulk add all automotive B2C topics
curl -X POST https://app.audiencegpt.com/api/topics/catalog \
-H "Authorization: Bearer txadv_your_api_key" \
-H "Content-Type: application/json" \
-d '{"filters": {"parentCategory": "Auto", "segmentType": "B2C"}}'

TypeScript Example

// Add specific topics from catalog
async function addFromCatalog(topicIds: string[]) {
const response = await fetch("https://app.audiencegpt.com/api/topics/catalog", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ topicIds }),
});

const { added } = await response.json();
console.log(`Added ${added} topics to library`);
return added;
}

// Bulk add all matching topics
async function bulkAddFromCatalog(filters: Record<string, string>) {
const response = await fetch("https://app.audiencegpt.com/api/topics/catalog", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ filters }),
});

const { added } = await response.json();
console.log(`Bulk added ${added} topics to library`);
return added;
}

Error Responses

StatusBodyDescription
400{"error": "topicIds array or filters object required"}Missing both topicIds and filters
401{"error": "Unauthorized"}Invalid credentials
500{"error": "Failed to list catalog topics"}Server error
500{"error": "Failed to add topics to library"}Insert error

Next Steps