What You’ll Build
A workflow that:- Accepts a vault ID and search query via webhook
- Searches your indexed documents
- Analyzes the results with GPT-4o
- Returns structured insights
Architecture
Prerequisites
- Case.dev API key (get one here)
- A vault with ingested documents (we’ll set one up if you don’t have one)
Step 1: Set Up Your Vault
If you already have a vault with indexed documents, skip to Step 2.Create a vault
cURL
id — you’ll need it.
Upload a document
cURL
Ingest (index) the document
cURL
Ingestion is async. Wait for
ingestionStatus: "completed" before searching. Poll the object endpoint to check status.cURL
Step 2: Create the Workflow
Now let’s create the document analyzer workflow. Save this asdocument-analyzer.json:
JSON
Deploy the workflow
cURL
Response
Step 3: Execute the Workflow
Now trigger your workflow with a vault ID and query:cURL
Async execution (default)
The default response returns an execution ID immediately:Response
cURL
Synchronous execution
For immediate results, add?mode=sync:
cURL
Response
Step 4: Access the Analysis
The LLM response is at:cURL
Extending the Workflow
Add PDF Report Generation
Generate a formatted PDF report from the analysis:JSON
{ "source": "analyze-1", "target": "format-1" }
Add Entity Extraction
Extract named entities before analysis:JSON
Add Web Research
Supplement vault search with live web research:JSON
Complete Enhanced Workflow
Here’s the full enhanced workflow with all extensions:JSON
Production Tips
Error Handling
Check execution status before accessing results:JavaScript
Rate Limits
- Vault search: 100 requests/minute
- LLM calls: Based on your plan
- Workflow executions: 1000/hour (default)
Cost Optimization
| Component | Cost Driver | Optimization |
|---|---|---|
| Vault Search | Per query | Cache common queries |
| LLM Analysis | Token count | Use smaller limit values |
| PDF Generation | Per page | Summarize before formatting |
Monitoring
View all executions in the Visual Builder:- Execution timeline
- Step-by-step inputs/outputs
- Error details with stack traces
Next Steps
- Document Workflows Guide — More patterns and examples
- Vault Search Reference — Advanced search options
- API Reference — Full endpoint documentation