@the_ro_show/agent-ads-sdk 0.10.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -315,31 +315,37 @@ Sign up as an advertiser at [api.attentionmarket.ai](https://api.attentionmarket
315
315
 
316
316
  ---
317
317
 
318
- ## 💰 Earn Bonuses with Feedback (v0.10.0+)
318
+ ## 💰 Earn Bonuses with Feedback (v0.11.0+)
319
319
 
320
- Send feedback on ad performance to earn **conversion-validated bonuses**.
320
+ Send feedback on ad performance to earn **AI-validated conversion bonuses**.
321
321
 
322
322
  ### How It Works
323
323
 
324
324
  1. **Show an ad** to your user (impression tracked automatically in v0.9.0+)
325
325
  2. **User clicks** → You earn base click revenue
326
- 3. **Send your prediction** about user sentiment:
327
- - `positive` - You think user will convert
328
- - `neutral` - No strong signal
329
- - `negative` - User didn't like it
326
+ 3. **Send user's actual response** AI analyzes sentiment automatically
330
327
  4. **Wait 7 days** → System checks if user actually converted
331
- 5. **Get bonus or penalty:**
328
+ 5. **Get bonus or penalty based on AI prediction:**
332
329
  - ✅ Correct positive prediction → **+15% bonus**
333
330
  - ❌ Wrong positive prediction → **-5% penalty**
334
331
  - 🤷 Neutral/negative → no bonus/penalty (data only)
335
332
 
333
+ ### What's New in v0.11.0
334
+
335
+ **Backend now analyzes sentiment for you using AI:**
336
+ - You just send the user's actual response text
337
+ - No need to classify sentiment yourself
338
+ - More consistent quality scores across all developers
339
+ - Harder to game (can't spam "positive" on everything)
340
+
336
341
  ### Anti-Fraud Design
337
342
 
338
- **Why penalties?** To prevent developers from spamming "positive" on every click.
343
+ **Why penalties?** To prevent developers from gaming the system.
339
344
 
340
- - Spamming = net loss (most clicks don't convert)
345
+ - AI analyzes actual user responses (not developer claims)
346
+ - Spamming fake positive responses = net loss
341
347
  - Accuracy = net gain (bonus > penalty when right)
342
- - System rewards honest, confident predictions
348
+ - System rewards honest data collection
343
349
 
344
350
  ### Usage Example
345
351
 
@@ -356,14 +362,17 @@ const ad = await client.decideFromContext({
356
362
  });
357
363
 
358
364
  if (ad) {
359
- // User clicks and seems very interested
365
+ // User responds after clicking
366
+ const userResponse = "This looks perfect! How do I sign up?";
367
+
360
368
  await client.sendFeedback({
361
369
  tracking_token: ad.tracking_token,
362
- reaction: 'positive',
363
- context: 'User asked follow-up questions about coverage'
370
+ user_response: userResponse,
371
+ agent_response: "Here's the signup link...",
372
+ additional_context: "User spent 2 minutes on offer page"
364
373
  });
365
374
 
366
- // Potential bonus: +15% if they convert in 7 days
375
+ // AI will detect positive sentiment → +15% bonus if user converts
367
376
  }
368
377
  ```
369
378
 
@@ -375,8 +384,9 @@ curl -X POST https://peruwnbrqkvmrldhpoom.supabase.co/functions/v1/feedback \
375
384
  -H "Content-Type: application/json" \
376
385
  -d '{
377
386
  "tracking_token": "eyJhbGc...",
378
- "reaction": "positive",
379
- "context": "User loved the recommendation"
387
+ "user_response": "This looks great! How do I get started?",
388
+ "agent_response": "Here is the signup process...",
389
+ "additional_context": "User asked 3 follow-up questions"
380
390
  }'
381
391
  ```
382
392
 
@@ -384,28 +394,174 @@ curl -X POST https://peruwnbrqkvmrldhpoom.supabase.co/functions/v1/feedback \
384
394
  ```json
385
395
  {
386
396
  "success": true,
387
- "prediction_recorded": "positive",
397
+ "sentiment_detected": "positive",
388
398
  "potential_bonus": "$1.05",
389
- "message": "Feedback recorded! If your prediction is correct (user converts within 7 days), you'll earn a +15% bonus. Wrong predictions incur a -5% penalty.",
399
+ "potential_penalty": "$0.35",
400
+ "message": "Feedback recorded! Detected sentiment: positive. If correct (user converts within 7 days), you'll earn a +15% bonus. Wrong predictions incur a -5% penalty.",
390
401
  "resolution_date": "2026-02-28T12:00:00Z"
391
402
  }
392
403
  ```
393
404
 
394
405
  ### When To Send Feedback
395
406
 
396
- **Good times to send positive:**
397
- - User explicitly asked "how do I sign up?"
398
- - User clicked and spent >30 seconds on page
399
- - User added item to cart
400
- - User asked follow-up questions
407
+ **Good signals to capture:**
408
+ - User's actual text responses after clicking
409
+ - Your agent's follow-up messages
410
+ - Context about how long user engaged with the offer
411
+ - Any follow-up questions or actions
401
412
 
402
- **Don't spam:**
403
- - Only send when you have real signal
404
- - Wrong predictions cost you money
413
+ **Best practices:**
414
+ - Send actual user text, not summaries
415
+ - Include your agent's response for context
416
+ - Only send when you have meaningful interaction data
405
417
  - Quality > quantity
406
418
 
407
419
  ---
408
420
 
421
+ ## 🎛️ Developer Controls (v0.12.0+)
422
+
423
+ Take control of what ads appear in your app with quality, category, and advertiser filters.
424
+
425
+ ### Quality Score Filter
426
+
427
+ Only show ads that meet your quality standards:
428
+
429
+ ```typescript
430
+ const ad = await client.decideFromContext({
431
+ userMessage: "I need car insurance",
432
+ minQualityScore: 0.8 // Only ads with 0.8+ quality
433
+ });
434
+ ```
435
+
436
+ **Use cases:**
437
+ - **Premium apps**: Set 0.9+ for best-in-class ads only
438
+ - **General apps**: Set 0.7+ for good balance
439
+ - **High-volume apps**: Set 0.5+ to maximize fill rate
440
+
441
+ ### Category Controls (IAB Taxonomy 3.0)
442
+
443
+ Filter ads using **IAB Content Taxonomy 3.0** - the industry-standard category system used by Google Ads, Microsoft Ads, and all major ad platforms.
444
+
445
+ **704 categories** across 38 top-level categories with 4-tier hierarchy.
446
+
447
+ #### Discover Available Categories
448
+
449
+ ```typescript
450
+ // Get all 38 top-level categories
451
+ const tier1 = await client.getCategories({ tier: 1 });
452
+ tier1.categories.forEach(cat => {
453
+ console.log(`${cat.id}: ${cat.name}`);
454
+ });
455
+ // Output: 1: Automotive, 31: Insurance, 150: Attractions, etc.
456
+
457
+ // Get all subcategories of "Automotive" (ID: 1)
458
+ const automotive = await client.getCategories({ parent_id: 1 });
459
+ // Returns: Auto Insurance (31), Auto Repair (34), Auto Buying (30), etc.
460
+
461
+ // Search for insurance-related categories
462
+ const insurance = await client.getCategories({ search: 'insurance' });
463
+ insurance.categories.forEach(cat => {
464
+ console.log(cat.full_path);
465
+ });
466
+ // Output: "Automotive > Auto Insurance", "Personal Finance > Insurance", etc.
467
+ ```
468
+
469
+ #### Filter by Category
470
+
471
+ Use IAB category IDs for precise control:
472
+
473
+ ```typescript
474
+ // Insurance app: Only show insurance ads (by IAB ID)
475
+ const ad = await client.decideFromContext({
476
+ userMessage: "I need car insurance",
477
+ allowedCategories: [31] // 31 = Auto Insurance
478
+ });
479
+
480
+ // Block entire "Sensitive Topics" tree (IAB ID: 601)
481
+ // This blocks all gambling, adult content, controversial topics, etc.
482
+ const ad = await client.decideFromContext({
483
+ userMessage: "Help me with something",
484
+ blockedCategories: [601] // Blocks parent + all children
485
+ });
486
+
487
+ // Wedding planner: Allow wedding + photography + food
488
+ const ad = await client.decideFromContext({
489
+ userMessage: "Help me plan my wedding",
490
+ allowedCategories: [
491
+ 603, // Weddings (Personal Celebrations)
492
+ 162, // Photography (Hobbies & Interests)
493
+ 190 // Restaurants (Food & Drink)
494
+ ]
495
+ });
496
+ ```
497
+
498
+ **Parent-Child Relationships:**
499
+ - Blocking a parent category blocks ALL child categories automatically
500
+ - Example: Blocking `1` (Automotive) blocks Auto Insurance, Auto Repair, etc.
501
+ - Great for compliance: Block `601` (Sensitive Topics) to block gambling, adult, controversial in one go
502
+
503
+ **Note:** If `allowedCategories` is set, `blockedCategories` is ignored.
504
+
505
+ ### Advertiser Blocklist
506
+
507
+ Block specific advertisers based on user feedback:
508
+
509
+ ```typescript
510
+ const ad = await client.decideFromContext({
511
+ userMessage: "I need legal help",
512
+ blockedAdvertisers: ['adv_abc123', 'adv_xyz789']
513
+ });
514
+ ```
515
+
516
+ Get advertiser IDs from previous ad responses.
517
+
518
+ ### Combined Controls
519
+
520
+ Mix and match for precise control:
521
+
522
+ ```typescript
523
+ const ad = await client.decideFromContext({
524
+ userMessage: "I need car insurance",
525
+ minQualityScore: 0.8, // High quality only
526
+ blockedCategories: ['crypto'], // No crypto ads
527
+ allowedCategories: ['insurance', 'finance'] // Relevant only
528
+ });
529
+ ```
530
+
531
+ ### HTTP Example
532
+
533
+ ```bash
534
+ curl -X POST https://peruwnbrqkvmrldhpoom.supabase.co/functions/v1/decide \
535
+ -H "X-AM-API-Key: am_live_YOUR_KEY" \
536
+ -H "Content-Type: application/json" \
537
+ -d '{
538
+ "context": "I need car insurance",
539
+ "minQualityScore": 0.8,
540
+ "blockedCategories": ["crypto", "gambling"]
541
+ }'
542
+ ```
543
+
544
+ ### Best Practices
545
+
546
+ **Quality Scores:**
547
+ - Start with no filter, monitor what you get
548
+ - Gradually increase threshold if quality is lacking
549
+ - Higher thresholds = fewer ads but better quality
550
+
551
+ **Categories (IAB Taxonomy):**
552
+ - Use `getCategories()` to discover the full 704-category taxonomy
553
+ - Use `allowedCategories` for specialized apps (wedding planner = `[603]`, legal assistant = `[318]`)
554
+ - Use `blockedCategories` for compliance (kids apps = block `[601]` Sensitive Topics)
555
+ - Parent categories block all children automatically (block `[1]` Automotive = blocks all 40+ auto subcategories)
556
+ - Full taxonomy reference: https://github.com/InteractiveAdvertisingBureau/Taxonomies
557
+
558
+ **Advertiser Blocking:**
559
+ - Collect user feedback on specific ads
560
+ - Block advertisers with multiple complaints
561
+ - Use sparingly - too many blocks reduce fill rate
562
+
563
+ ---
564
+
409
565
  ## API Reference
410
566
 
411
567
  ### `POST /v1/decide`
package/dist/index.d.mts CHANGED
@@ -63,6 +63,39 @@ interface DecideFromContextRequest {
63
63
  language?: string;
64
64
  /** User's platform. Default: 'web' */
65
65
  platform?: 'web' | 'ios' | 'android' | 'desktop' | 'voice' | 'other';
66
+ /**
67
+ * Minimum quality score threshold (0.0 - 1.0).
68
+ * Only return ads with quality scores at or above this value.
69
+ * Higher values = better quality but lower fill rate.
70
+ *
71
+ * @example
72
+ * minQualityScore: 0.8 // Only show ads with 0.8+ quality
73
+ */
74
+ minQualityScore?: number;
75
+ /**
76
+ * Only show ads from these categories.
77
+ * If set, blockedCategories is ignored.
78
+ *
79
+ * @example
80
+ * allowedCategories: ['wedding', 'photography', 'venues']
81
+ */
82
+ allowedCategories?: string[];
83
+ /**
84
+ * Never show ads from these categories.
85
+ * Ignored if allowedCategories is set.
86
+ *
87
+ * @example
88
+ * blockedCategories: ['gambling', 'crypto', 'dating']
89
+ */
90
+ blockedCategories?: string[];
91
+ /**
92
+ * Never show ads from these advertisers.
93
+ * Use advertiser IDs from previous ad responses.
94
+ *
95
+ * @example
96
+ * blockedAdvertisers: ['adv_abc123', 'adv_xyz789']
97
+ */
98
+ blockedAdvertisers?: string[];
66
99
  }
67
100
  interface DecideResponse {
68
101
  request_id: string;
@@ -176,16 +209,19 @@ interface EventIngestResponse {
176
209
  accepted: boolean;
177
210
  }
178
211
  /**
179
- * Feedback reaction types for conversion-validated bonuses.
212
+ * Sentiment types detected by backend AI analysis.
180
213
  *
181
- * - positive: Predict user will convert (earn +15% if correct, -5% if wrong)
182
- * - neutral: No prediction (no bonus/penalty, data collection only)
183
- * - negative: User disliked the ad (no penalty, data collection only)
214
+ * - positive: User is interested/engaged (earn +15% if converts, -5% if not)
215
+ * - neutral: User is indifferent (no bonus/penalty, data only)
216
+ * - negative: User disliked the ad (no penalty, data only)
184
217
  */
185
- type FeedbackReaction = 'positive' | 'neutral' | 'negative';
218
+ type FeedbackSentiment = 'positive' | 'neutral' | 'negative';
186
219
  /**
187
220
  * Send feedback on an ad after showing it to a user.
188
221
  *
222
+ * **New in v0.11.0:** Backend analyzes sentiment automatically using AI.
223
+ * Just send the user's actual response text - no need to classify it yourself.
224
+ *
189
225
  * **Anti-Fraud:** Bonuses are deferred and validated against actual conversions.
190
226
  * - Correct positive prediction → +15% bonus after 7 days
191
227
  * - Wrong positive prediction → -5% penalty after 7 days
@@ -195,18 +231,21 @@ type FeedbackReaction = 'positive' | 'neutral' | 'negative';
195
231
  * ```typescript
196
232
  * await client.sendFeedback({
197
233
  * tracking_token: ad.tracking_token,
198
- * reaction: 'positive',
199
- * context: 'User loved the product recommendation!'
234
+ * user_response: "This looks perfect! How do I sign up?",
235
+ * agent_response: "Here's the signup link...",
236
+ * additional_context: "User spent 2 minutes reading the offer"
200
237
  * });
201
238
  * ```
202
239
  */
203
240
  interface FeedbackRequest {
204
241
  /** Tracking token from the ad you showed */
205
242
  tracking_token: string;
206
- /** Your prediction about user sentiment/conversion */
207
- reaction: FeedbackReaction;
208
- /** Optional context explaining why you think this (helps with quality scores) */
209
- context?: string;
243
+ /** User's actual response text (required) */
244
+ user_response: string;
245
+ /** Your agent's response (optional, helps sentiment analysis) */
246
+ agent_response?: string;
247
+ /** Additional context about the interaction (optional) */
248
+ additional_context?: string;
210
249
  }
211
250
  /**
212
251
  * Response from sending feedback.
@@ -217,10 +256,12 @@ interface FeedbackRequest {
217
256
  interface FeedbackResponse {
218
257
  /** Whether feedback was recorded successfully */
219
258
  success: boolean;
220
- /** What prediction was recorded */
221
- prediction_recorded: FeedbackReaction;
259
+ /** AI-detected sentiment from user response */
260
+ sentiment_detected: FeedbackSentiment;
222
261
  /** Potential bonus if prediction is correct (not guaranteed) */
223
262
  potential_bonus: string;
263
+ /** Potential penalty if prediction is wrong */
264
+ potential_penalty: string;
224
265
  /** Explanation of the deferred bonus system */
225
266
  message: string;
226
267
  /** When the bonus will be resolved (7 days from now) */
@@ -549,6 +590,44 @@ interface GetServiceRequest {
549
590
  region?: string;
550
591
  };
551
592
  }
593
+ interface IABCategory {
594
+ /** Unique IAB category ID */
595
+ id: number;
596
+ /** Parent category ID (null for tier 1 categories) */
597
+ parent_id: number | null;
598
+ /** Category name */
599
+ name: string;
600
+ /** Tier 1 category (top level) */
601
+ tier_1: string | null;
602
+ /** Tier 2 category (sub-category) */
603
+ tier_2: string | null;
604
+ /** Tier 3 category (sub-sub-category) */
605
+ tier_3: string | null;
606
+ /** Tier 4 category (deepest level) */
607
+ tier_4: string | null;
608
+ /** Full hierarchical path (e.g., "Automotive > Auto Insurance") */
609
+ full_path: string;
610
+ }
611
+ interface CategoryTaxonomyResponse {
612
+ /** Taxonomy version */
613
+ version: string;
614
+ /** Source organization */
615
+ source: string;
616
+ /** Reference URL */
617
+ url: string;
618
+ /** Total number of categories returned (after filtering) */
619
+ total: number;
620
+ /** Array of categories */
621
+ categories: IABCategory[];
622
+ }
623
+ interface GetCategoriesParams {
624
+ /** Filter by tier level (1-4) */
625
+ tier?: 1 | 2 | 3 | 4;
626
+ /** Filter by parent category ID */
627
+ parent_id?: number;
628
+ /** Search by name or path (case-insensitive) */
629
+ search?: string;
630
+ }
552
631
 
553
632
  /**
554
633
  * Utility functions for the AttentionMarket SDK.
@@ -981,6 +1060,39 @@ declare class AttentionMarketClient {
981
1060
  * ```
982
1061
  */
983
1062
  logServiceResult(params: ServiceResultRequest): Promise<ServiceResultResponse>;
1063
+ /**
1064
+ * Get IAB Content Taxonomy categories.
1065
+ *
1066
+ * Returns the complete IAB Content Taxonomy 3.0 (704 categories across 38 top-level categories).
1067
+ * Supports filtering by tier level, parent category, or search term.
1068
+ *
1069
+ * Use this to discover available categories for `allowedCategories` and `blockedCategories` parameters.
1070
+ *
1071
+ * @param params - Optional filters (tier, parent_id, search)
1072
+ * @returns The IAB Content Taxonomy with categories
1073
+ *
1074
+ * @example Get all Tier 1 categories (38 top-level categories)
1075
+ * ```typescript
1076
+ * const tier1 = await client.getCategories({ tier: 1 });
1077
+ * console.log(`${tier1.total} top-level categories`);
1078
+ * tier1.categories.forEach(cat => console.log(`${cat.id}: ${cat.name}`));
1079
+ * ```
1080
+ *
1081
+ * @example Get all subcategories of "Automotive" (ID: 1)
1082
+ * ```typescript
1083
+ * const automotiveCategories = await client.getCategories({ parent_id: 1 });
1084
+ * console.log(`Found ${automotiveCategories.total} automotive subcategories`);
1085
+ * ```
1086
+ *
1087
+ * @example Search for insurance-related categories
1088
+ * ```typescript
1089
+ * const insuranceCategories = await client.getCategories({ search: 'insurance' });
1090
+ * insuranceCategories.categories.forEach(cat => {
1091
+ * console.log(`${cat.id}: ${cat.full_path}`);
1092
+ * });
1093
+ * ```
1094
+ */
1095
+ getCategories(params?: GetCategoriesParams): Promise<CategoryTaxonomyResponse>;
984
1096
  }
985
1097
 
986
1098
  /**
package/dist/index.d.ts CHANGED
@@ -63,6 +63,39 @@ interface DecideFromContextRequest {
63
63
  language?: string;
64
64
  /** User's platform. Default: 'web' */
65
65
  platform?: 'web' | 'ios' | 'android' | 'desktop' | 'voice' | 'other';
66
+ /**
67
+ * Minimum quality score threshold (0.0 - 1.0).
68
+ * Only return ads with quality scores at or above this value.
69
+ * Higher values = better quality but lower fill rate.
70
+ *
71
+ * @example
72
+ * minQualityScore: 0.8 // Only show ads with 0.8+ quality
73
+ */
74
+ minQualityScore?: number;
75
+ /**
76
+ * Only show ads from these categories.
77
+ * If set, blockedCategories is ignored.
78
+ *
79
+ * @example
80
+ * allowedCategories: ['wedding', 'photography', 'venues']
81
+ */
82
+ allowedCategories?: string[];
83
+ /**
84
+ * Never show ads from these categories.
85
+ * Ignored if allowedCategories is set.
86
+ *
87
+ * @example
88
+ * blockedCategories: ['gambling', 'crypto', 'dating']
89
+ */
90
+ blockedCategories?: string[];
91
+ /**
92
+ * Never show ads from these advertisers.
93
+ * Use advertiser IDs from previous ad responses.
94
+ *
95
+ * @example
96
+ * blockedAdvertisers: ['adv_abc123', 'adv_xyz789']
97
+ */
98
+ blockedAdvertisers?: string[];
66
99
  }
67
100
  interface DecideResponse {
68
101
  request_id: string;
@@ -176,16 +209,19 @@ interface EventIngestResponse {
176
209
  accepted: boolean;
177
210
  }
178
211
  /**
179
- * Feedback reaction types for conversion-validated bonuses.
212
+ * Sentiment types detected by backend AI analysis.
180
213
  *
181
- * - positive: Predict user will convert (earn +15% if correct, -5% if wrong)
182
- * - neutral: No prediction (no bonus/penalty, data collection only)
183
- * - negative: User disliked the ad (no penalty, data collection only)
214
+ * - positive: User is interested/engaged (earn +15% if converts, -5% if not)
215
+ * - neutral: User is indifferent (no bonus/penalty, data only)
216
+ * - negative: User disliked the ad (no penalty, data only)
184
217
  */
185
- type FeedbackReaction = 'positive' | 'neutral' | 'negative';
218
+ type FeedbackSentiment = 'positive' | 'neutral' | 'negative';
186
219
  /**
187
220
  * Send feedback on an ad after showing it to a user.
188
221
  *
222
+ * **New in v0.11.0:** Backend analyzes sentiment automatically using AI.
223
+ * Just send the user's actual response text - no need to classify it yourself.
224
+ *
189
225
  * **Anti-Fraud:** Bonuses are deferred and validated against actual conversions.
190
226
  * - Correct positive prediction → +15% bonus after 7 days
191
227
  * - Wrong positive prediction → -5% penalty after 7 days
@@ -195,18 +231,21 @@ type FeedbackReaction = 'positive' | 'neutral' | 'negative';
195
231
  * ```typescript
196
232
  * await client.sendFeedback({
197
233
  * tracking_token: ad.tracking_token,
198
- * reaction: 'positive',
199
- * context: 'User loved the product recommendation!'
234
+ * user_response: "This looks perfect! How do I sign up?",
235
+ * agent_response: "Here's the signup link...",
236
+ * additional_context: "User spent 2 minutes reading the offer"
200
237
  * });
201
238
  * ```
202
239
  */
203
240
  interface FeedbackRequest {
204
241
  /** Tracking token from the ad you showed */
205
242
  tracking_token: string;
206
- /** Your prediction about user sentiment/conversion */
207
- reaction: FeedbackReaction;
208
- /** Optional context explaining why you think this (helps with quality scores) */
209
- context?: string;
243
+ /** User's actual response text (required) */
244
+ user_response: string;
245
+ /** Your agent's response (optional, helps sentiment analysis) */
246
+ agent_response?: string;
247
+ /** Additional context about the interaction (optional) */
248
+ additional_context?: string;
210
249
  }
211
250
  /**
212
251
  * Response from sending feedback.
@@ -217,10 +256,12 @@ interface FeedbackRequest {
217
256
  interface FeedbackResponse {
218
257
  /** Whether feedback was recorded successfully */
219
258
  success: boolean;
220
- /** What prediction was recorded */
221
- prediction_recorded: FeedbackReaction;
259
+ /** AI-detected sentiment from user response */
260
+ sentiment_detected: FeedbackSentiment;
222
261
  /** Potential bonus if prediction is correct (not guaranteed) */
223
262
  potential_bonus: string;
263
+ /** Potential penalty if prediction is wrong */
264
+ potential_penalty: string;
224
265
  /** Explanation of the deferred bonus system */
225
266
  message: string;
226
267
  /** When the bonus will be resolved (7 days from now) */
@@ -549,6 +590,44 @@ interface GetServiceRequest {
549
590
  region?: string;
550
591
  };
551
592
  }
593
+ interface IABCategory {
594
+ /** Unique IAB category ID */
595
+ id: number;
596
+ /** Parent category ID (null for tier 1 categories) */
597
+ parent_id: number | null;
598
+ /** Category name */
599
+ name: string;
600
+ /** Tier 1 category (top level) */
601
+ tier_1: string | null;
602
+ /** Tier 2 category (sub-category) */
603
+ tier_2: string | null;
604
+ /** Tier 3 category (sub-sub-category) */
605
+ tier_3: string | null;
606
+ /** Tier 4 category (deepest level) */
607
+ tier_4: string | null;
608
+ /** Full hierarchical path (e.g., "Automotive > Auto Insurance") */
609
+ full_path: string;
610
+ }
611
+ interface CategoryTaxonomyResponse {
612
+ /** Taxonomy version */
613
+ version: string;
614
+ /** Source organization */
615
+ source: string;
616
+ /** Reference URL */
617
+ url: string;
618
+ /** Total number of categories returned (after filtering) */
619
+ total: number;
620
+ /** Array of categories */
621
+ categories: IABCategory[];
622
+ }
623
+ interface GetCategoriesParams {
624
+ /** Filter by tier level (1-4) */
625
+ tier?: 1 | 2 | 3 | 4;
626
+ /** Filter by parent category ID */
627
+ parent_id?: number;
628
+ /** Search by name or path (case-insensitive) */
629
+ search?: string;
630
+ }
552
631
 
553
632
  /**
554
633
  * Utility functions for the AttentionMarket SDK.
@@ -981,6 +1060,39 @@ declare class AttentionMarketClient {
981
1060
  * ```
982
1061
  */
983
1062
  logServiceResult(params: ServiceResultRequest): Promise<ServiceResultResponse>;
1063
+ /**
1064
+ * Get IAB Content Taxonomy categories.
1065
+ *
1066
+ * Returns the complete IAB Content Taxonomy 3.0 (704 categories across 38 top-level categories).
1067
+ * Supports filtering by tier level, parent category, or search term.
1068
+ *
1069
+ * Use this to discover available categories for `allowedCategories` and `blockedCategories` parameters.
1070
+ *
1071
+ * @param params - Optional filters (tier, parent_id, search)
1072
+ * @returns The IAB Content Taxonomy with categories
1073
+ *
1074
+ * @example Get all Tier 1 categories (38 top-level categories)
1075
+ * ```typescript
1076
+ * const tier1 = await client.getCategories({ tier: 1 });
1077
+ * console.log(`${tier1.total} top-level categories`);
1078
+ * tier1.categories.forEach(cat => console.log(`${cat.id}: ${cat.name}`));
1079
+ * ```
1080
+ *
1081
+ * @example Get all subcategories of "Automotive" (ID: 1)
1082
+ * ```typescript
1083
+ * const automotiveCategories = await client.getCategories({ parent_id: 1 });
1084
+ * console.log(`Found ${automotiveCategories.total} automotive subcategories`);
1085
+ * ```
1086
+ *
1087
+ * @example Search for insurance-related categories
1088
+ * ```typescript
1089
+ * const insuranceCategories = await client.getCategories({ search: 'insurance' });
1090
+ * insuranceCategories.categories.forEach(cat => {
1091
+ * console.log(`${cat.id}: ${cat.full_path}`);
1092
+ * });
1093
+ * ```
1094
+ */
1095
+ getCategories(params?: GetCategoriesParams): Promise<CategoryTaxonomyResponse>;
984
1096
  }
985
1097
 
986
1098
  /**