Overview
Automations allow you to schedule recurring queries that run automatically based on a cron schedule. Perfect for daily summaries, weekly reports, periodic research, or any recurring AI task.Key Features
- Cron Scheduling: Flexible scheduling using cron expressions
- Email Delivery: Results sent to your email automatically
- Dedicated Conversations: Each automation has its own conversation thread
- Manual Triggers: Run automations on-demand in addition to scheduled times
- Query Transformation: Khoj interprets and optimizes your query before execution
List Automations
Get all active automations for your account.cURL
Python
Unique identifier for the automation
Email subject line / automation title
The actual query that will be executed (may be transformed from original request)
Original natural language scheduling request
Cron expression defining the schedule
Human-readable description of the schedule
ISO timestamp of next scheduled execution
Associated conversation thread ID
Create Automation
Schedule a new recurring automation.cURL
Python
Request Parameters
The query to execute. Can be natural language - Khoj will interpret and optimize it.
Cron expression defining when to run (standard 5-field format)Examples:
0 9 * * *- Daily at 9:00 AM0 18 * * 5- Every Friday at 6:00 PM30 14 1 * *- 1st of every month at 2:30 PM0 */4 * * *- Every 4 hours
Email subject / automation title. Auto-generated if not provided.
Timezone for schedule (e.g., “America/New_York”, “Europe/London”, “Asia/Tokyo”)
City for location-aware queries
Region/state for location-aware queries
Country for location-aware queries
Response
Returns the created automation object with all metadata.Update Automation
Modify an existing automation.cURL
ID of the automation to update
Updated query
Updated subject line
Updated cron schedule
Updated timezone
Delete Automation
Remove an automation.cURL
ID of the automation to delete
Trigger Automation Manually
Run an automation immediately without waiting for the schedule.cURL
ID of the automation to trigger
Cron Schedule Format
Khoj uses standard 5-field cron expressions:Common Patterns
| Pattern | Description | Example |
|---|---|---|
0 9 * * * | Daily at 9 AM | Morning summary |
0 */6 * * * | Every 6 hours | Periodic check-ins |
0 9 * * 1 | Every Monday at 9 AM | Weekly planning |
0 18 * * 5 | Every Friday at 6 PM | Week wrap-up |
0 9 1 * * | 1st of month at 9 AM | Monthly report |
30 8 * * 1-5 | Weekdays at 8:30 AM | Workday briefing |
0 0 * * 0 | Every Sunday at midnight | Weekly reset |
Special Characters
*- Any value,- Value list separator (e.g.,1,15= 1st and 15th)-- Range (e.g.,1-5= Monday through Friday)/- Step values (e.g.,*/2= every 2 units)
Khoj replaces
? with * automatically. Both are equivalent.Use Cases
Daily Summaries
Weekly Research Digest
Monthly Financial Review
Morning Briefing
Project Status Updates
Automation Query Tips
Be Specific
Clear, specific queries produce better results. Instead of “summarize notes”, try “summarize meeting notes about the Q1 marketing campaign”.
Use Time References
Queries can reference relative times: “today”, “this week”, “last month”, “recent”, etc.
Include Context
Specify what types of content to focus on: “from my project notes”, “in my research folder”, etc.
Define Output Format
Request specific formats: “create a bullet list”, “write a brief summary”, “generate a detailed report”.
How Automations Work
- Schedule: Automation triggers at the scheduled cron time in your timezone
- Query Execution: Khoj executes the query, searching your knowledge base and/or web
- Response Generation: AI generates a comprehensive response with references
- Email Delivery: Results are sent to your registered email address
- Conversation Storage: The exchange is saved to the dedicated conversation thread
Error Handling
400 Bad Request - Missing Parameters
q and crontime are provided.
400 Bad Request - Invalid Cron
400 Bad Request - Too Frequent
403 Forbidden
500 Internal Server Error
Best Practices
Smart Scheduling
Schedule automations at times when results are most useful. Daily summaries work well end-of-day.
Descriptive Subjects
Use clear subject lines so you can identify automation emails easily.
Test First
Use manual trigger to test your query before scheduling.
Review Conversations
Check the conversation thread periodically to see automation history and refine queries.
Limitations
- Minimum scheduling interval: 1 hour
- Maximum automations per user: Varies by subscription tier
- Automations use the default Khoj agent (you can’t specify custom agents yet)
Next Steps
Chat API
Learn about the chat capabilities used by automations
Agents API
Create specialized agents for different automation tasks
