Generate Structured Object
Extract or generate structured data from natural language using AI. Perfect for parsing unstructured text, form filling, data extraction, and more.
Best for Extracting Sales Intelligence: Combine with services.scrape.website() to extract structured
information from prospect websites. Perfect for questions like “What products does this company sell?” or “How many
decision-makers are listed on their about page?”
Method
services.ai.generateObject(params);
Parameters
The prompt describing what object to generate or what data to extract
The schema defining the structure of the output. Accepts a Zod schema instance or a plain JSON Schema object
model
string
default:"gpt-5-mini"
The AI model to use. Options: - "gpt-5-mini" - Fast and cost-effective (default) - "gemini-2.0-flash" - Google’s
fast model - "gemini-2.5-pro" - Google’s most capable model - "claude-sonnet-4-5-20250929" - Anthropic’s latest
model
Returns
Returns a Promise with:
The generated JSON object matching the provided schema
Examples
// Extract structured lead data from an email signature or bio
const emailSignature = ctx.thisRow.get("Email Signature");
const result = await services.ai.generateObject({
prompt: `Extract contact info from this email signature: ${emailSignature}`,
schema: z.object({
name: z.string(),
email: z.string(),
phone: z.string().optional(),
company: z.string(),
title: z.string(),
linkedin: z.string().optional(),
}),
});
ctx.thisRow.set({
Name: result.object.name,
Email: result.object.email,
Phone: result.object.phone,
Company: result.object.company,
Title: result.object.title,
});
// Scrape and extract what products/services a prospect company offers
const website = ctx.thisRow.get("Website");
const scraped = await services.scrape.website({ url: website });
const result = await services.ai.generateObject({
prompt: `Extract the company's product/service offerings from this website: ${scraped.markdown}`,
schema: z.object({
primary_products: z.array(z.string()),
target_market: z.string(),
pricing_model: z.string().optional(),
key_features: z.array(z.string()),
use_cases: z.array(z.string()).optional(),
}),
});
ctx.thisRow.set({
Products: result.object.primary_products.join(", "),
"Target Market": result.object.target_market,
"Pricing Model": result.object.pricing_model,
});
Recommended Pattern: This is the preferred approach for enriching prospect data from their website. It’s more
accurate and cost-effective than using web search for targeted data extraction.
// Scrape prospect's about page for company intelligence
const website = ctx.thisRow.get("Website");
const scraped = await services.scrape.website({
url: `${website}/about`,
});
// Extract structured company data for sales context
const result = await services.ai.generateObject({
prompt: `Extract company information from this about page: ${scraped.markdown}`,
schema: z.object({
company_name: z.string(),
founded_year: z.number().optional(),
headquarters: z.string().optional(),
employee_count_estimate: z.string().optional(),
description: z.string(),
key_executives: z
.array(
z.object({
name: z.string(),
title: z.string(),
})
)
.optional(),
mission_statement: z.string().optional(),
}),
});
ctx.thisRow.set({
"Company Name": result.object.company_name,
Founded: result.object.founded_year,
"HQ Location": result.object.headquarters,
"Company Description": result.object.description,
});
Identify Decision Makers from Team Page
// Extract decision makers from a prospect's team/about page
const website = ctx.thisRow.get("Website");
const scraped = await services.scrape.website({
url: `${website}/team`,
});
const result = await services.ai.generateObject({
prompt: `Extract all executives and decision makers from this team page.
Focus on C-level, VPs, and Directors: ${scraped.markdown}`,
schema: z.object({
total_decision_makers: z.number(),
decision_makers: z.array(
z.object({
name: z.string(),
title: z.string(),
department: z.string().optional(),
linkedin_url: z.string().optional(),
})
),
}),
});
ctx.thisRow.set({
"Decision Maker Count": result.object.total_decision_makers,
"Key Contacts": result.object.decision_makers.map((dm) => `${dm.name} (${dm.title})`).join("; "),
});