You’re viewing the V1 docs. V2 is now recommended — read the V2 docs.
Watt Data

generate_audience

Description: Generates a lookalike audience from an ICP persona. Takes personas from analyze_customers output and executes the targeting expression for the selected persona and strategy. Optionally applies geographic filtering.

Note: The cluster identifiers in persona expressions are cluster_hash values (stable identifiers) from analyze_customers output, not numeric cluster IDs. These hash values persist across data rebuilds, ensuring reliable targeting.

Tool Identifier: generate_audience

Input Parameters

ParameterTypeRequiredDefaultConstraintsDescription
csv_keystringYes-Min length: 1S3 key from generate_url_for_upload (for workflow tracking)
personasarrayYes-Min 1 itemPersonas array from analyze_customers.icp_synthesis.personas
market_contextobjectYes-See analyze_customersMarket context for agentic decision-making
persona_indexnumberYes-Min: 0Index of the persona to use (0-based)
strategystringYes-"precision", "balanced", or "reach"Targeting strategy
geo_filterobjectNo-See belowGeographic filter with radius
custom_expressionstringNo-Boolean expressionOverride persona expression
audience_limitnumberNo1000000Min: 1, Max: 15000000Maximum audience size
identifier_typesarrayNo["email"]Valid: email, phone, address, name, maidIdentifier types to include in export
workflow_idstringNo-Valid UUIDWorkflow session identifier

geo_filter Object:

FieldTypeRequiredDescription
latitudenumberYesLatitude (-90 to 90)
longitudenumberYesLongitude (-180 to 180)
radius_milesnumberYesRadius in miles

Targeting Strategies:

StrategyDescriptionUse When
precisionAND-heavy expressions, narrow targetingNeed high-quality, precise matches
balancedMixed AND/OR operatorsGeneral audience building
reachOR-heavy expressions, broad targetingNeed maximum audience size

Request Schema:

interface GenerateAudienceParams {
  csv_key: string;
  personas: Array<{
    name: string;
    description: string;
    key_traits: Array<{...}>;
    expressions: {
      precision: string;
      balanced: string;
      reach: string;
    };
  }>;
  market_context: {
    base_context: string;
    refinements?: string[];
  };
  persona_index: number;
  strategy: "precision" | "balanced" | "reach";
  geo_filter?: {
    latitude: number;
    longitude: number;
    radius_miles: number;
  };
  custom_expression?: string;
  audience_limit?: number;
  identifier_types?: ("email" | "phone" | "address" | "name" | "maid")[];
  workflow_id?: string;
}

Output Format

Success Response:

{
  expression: string;              // The boolean expression used
  audience_size: number;           // Total audience size
  audience_download_url: string;   // Presigned URL (expires in 1 hour)
  expires_at: string;              // ISO timestamp when URL expires
  identifier_types: string[];      // Identifier types in export
  geo_filter_applied?: {           // Only if geo_filter was provided
    latitude: number;
    longitude: number;
    radius_miles: number;
  };
  warning?: {                      // Only if audience size suboptimal
    code: string;
    message: string;
    suggestion: string;
  };
  tool_trace_id: string;
  workflow_id: string;
}

Warning Codes:

CodeTriggerMessage
AUDIENCE_TOO_SMALLSize < 10,000Audience size is below optimal threshold (10,000)
AUDIENCE_TOO_LARGESize > 10,000,000Audience size exceeds optimal threshold (10,000,000)

Example Response:

{
  "expression": "a8f3bc1d2e3f4a5b6c7d8e9f0a1b2c3d AND b2e4df5a6b7c8d9e0f1a2b3c4d5e6f7a",
  "audience_size": 1250000,
  "audience_download_url": "https://watt-exports.s3.amazonaws.com/audiences/...",
  "expires_at": "2025-01-16T15:30:00Z",
  "identifier_types": ["email"],
  "tool_trace_id": "a1b2c3d4e5f6",
  "workflow_id": "550e8400-e29b-41d4-a716-446655440000"
}

Example Response (With Warning):

{
  "expression": "a8f3bc1d2e3f4a5b6c7d8e9f0a1b2c3d AND b2e4df5a6b7c8d9e0f1a2b3c4d5e6f7a AND c3f5de8a9b0c1d2e3f4a5b6c7d8e9f0a",
  "audience_size": 5000,
  "audience_download_url": "https://watt-exports.s3.amazonaws.com/audiences/...",
  "expires_at": "2025-01-16T15:30:00Z",
  "identifier_types": ["email"],
  "warning": {
    "code": "AUDIENCE_TOO_SMALL",
    "message": "Audience size of 5,000 is below optimal threshold (10,000).",
    "suggestion": "Consider using 'reach' strategy for broader targeting."
  },
  "tool_trace_id": "a1b2c3d4e5f6",
  "workflow_id": "550e8400-e29b-41d4-a716-446655440000"
}

Error Handling

Common Errors:

  • Invalid persona_index: "persona_index 5 is out of bounds. Available personas: 0-2"
  • Missing personas: "At least one persona is required"
  • Invalid strategy: "strategy must be one of: precision, balanced, reach"
  • Export failed: "Failed to generate audience export. Check that the expression is valid."

Usage Examples

Example 1: Basic audience generation

{
  "csv_key": "uploads/abc123/customers.csv",
  "personas": [...],
  "market_context": {
    "base_context": "B2B SaaS platform",
    "refinements": []
  },
  "persona_index": 0,
  "strategy": "balanced"
}

Example 2: With geographic filter

{
  "csv_key": "uploads/abc123/customers.csv",
  "personas": [...],
  "market_context": {
    "base_context": "B2B SaaS platform",
    "refinements": []
  },
  "persona_index": 0,
  "strategy": "precision",
  "geo_filter": {
    "latitude": 37.7749,
    "longitude": -122.4194,
    "radius_miles": 50
  }
}

Example 3: With custom expression

{
  "csv_key": "uploads/abc123/customers.csv",
  "personas": [...],
  "market_context": {
    "base_context": "B2B SaaS platform",
    "refinements": []
  },
  "persona_index": 0,
  "strategy": "balanced",
  "custom_expression": "a8f3bc1d2e3f4a5b6c7d8e9f0a1b2c3d OR b2e4df5a6b7c8d9e0f1a2b3c4d5e6f7a OR c3f5de8a9b0c1d2e3f4a5b6c7d8e9f0a"
}

Example 4: With multiple identifier types

{
  "csv_key": "uploads/abc123/customers.csv",
  "personas": [...],
  "market_context": {
    "base_context": "B2B SaaS platform",
    "refinements": []
  },
  "persona_index": 0,
  "strategy": "reach",
  "identifier_types": ["email", "phone"]
}

On this page