The problem: You need to research a legal issue across multiple jurisdictions. Manual research takes days.
The solution: Use AI-powered web search to get answers with citations, or run deep research for comprehensive analysis.
Web data only. This searches publicly available web content. For comprehensive legal research (case law, statutes, regulations), use specialized platforms like Lexis, Westlaw, or OpenLaws.
Quick answer with citations
Let your users get AI-generated answers to questions:
import Casedev from 'casedev';
const client = new Casedev({ apiKey: process.env.CASEDEV_API_KEY });
// Answer your user's question
const result = await client.search.v1.answer({
query: userQuery, // e.g., "What is the statute of limitations for medical malpractice in California?"
includeDomains: ['law.cornell.edu', 'findlaw.com', 'justia.com']
});
// Return answer with citations to your user
console.log(result.answer);
// "In California, the statute of limitations for medical malpractice
// is 3 years from the date of injury or 1 year from discovery [1]..."
console.log('\nSources:');
for (const citation of result.citations) {
console.log(`[${citation.id}] ${citation.title}`);
console.log(` ${citation.url}`);
}
Deep research
For complex topics, offer your users comprehensive multi-step research:
// Start deep research for your user
const research = await client.search.v1.research({
instructions: userResearchTopic, // e.g., "Research non-compete agreement enforceability across US states"
model: 'pro' // Most thorough
});
console.log(`Research started: ${research.researchId}`);
// Wait for completion
let result = await client.search.v1.retrieveResearch(research.researchId);
while (result.status !== 'completed') {
console.log(`Status: ${result.status}...`);
await new Promise(r => setTimeout(r, 10000));
result = await client.search.v1.retrieveResearch(research.researchId);
}
// Deliver the report to your user
console.log(result.report);
console.log(`\nSources analyzed: ${result.metadata.sourcesAnalyzed}`);
Web search
For simple searches, expose the search endpoint directly:
// Search on behalf of your user
const results = await client.search.v1.search({
query: userSearchQuery,
numResults: 20,
startPublishedDate: '2024-01-01',
excludeDomains: ['reddit.com', 'twitter.com'],
includeText: true
});
// Return results to your user
for (const result of results.results) {
console.log(`${result.title}`);
console.log(`${result.url}`);
console.log(`Published: ${result.publishedDate}\n`);
}
Research models
Choose based on your users’ needs:
| Model | Time | Depth | Use case |
|---|
fast | ~30 sec | Basic | Quick fact-checking |
normal | ~2 min | Good | Standard research |
pro | ~5 min | Best | Complex topics |
Tip: Use includeDomains to restrict results to authoritative sources like government sites and legal databases.