Create Automation
The API request creates an automation by sending an HTTP POST request to the specified endpoint. The request body is in JSON format and includes the name, description, runType, trigger, and action details. The trigger type is "folders" with specific folder IDs, and the action type is "magic-prompt" with associated details like title, assistantType, prompt, and assistantTemplateId.
The last call to this request used the following payload with the raw request body type:
{
"name": "First Automation",
"description": "Test",
"action": {
"type": "magic-prompt",
"magicPrompt": {
"prompt": "Summarize my meetings",
"assistantType": "general"
}
},
"trigger": {
"type": "folders",
"folderIds": ["3711858e52a6"]
}
}
The response to the last execution returned a 200 status code with the following content in JSON format:
{
"status": "",
"data": {
"automationId": "",
"message": ""
}
}
Additionally, related responses from other endpoints of this API also returned 200 status codes with similar data models, including email, access token, refresh token, totalCount, automation list, and trigger details.
Please note that the specific values (such as automationId, email, accessToken, refreshToken, folderIds, etc.) have been intentionally masked for privacy.
1. Instant Automation with AI Chat Action
Body (JSON):
{
"name": "Instant Folder Analysis",
"description": "Automatically analyze documents in specific folders using AI assistant",
"runType": "instant",
"trigger": {
"type": "folders",
"folderIds": ["folder123", "folder456"]
},
"action": {
"type": "magic-prompt",
"magicPrompt": {
"title": "Document Analysis",
"assistantType": "researcher",
"prompt": "Analyze the document content and provide key insights, main topics, and actionable recommendations.",
"assistantTemplateId": "template123"
}
},
"fieldId": "field789"
}
2. Scheduled Automation with Translation Action
Method: POST
Body (JSON):
{
"name": "Weekly Document Translation",
"description": "Translate documents in selected folders every week",
"runType": "schedule",
"schedule": {
"timePeriod": "last7days",
"repeatAt": "09:00"
},
"trigger": {
"type": "folders",
"folderIds": ["folder789", "folder101"]
},
"action": {
"type": "translation",
"translation": {
"targetLanguage": "spanish"
}
}
}
3. Instant Automation with Custom AI Chat
Method: POST
Body (JSON):
{
"name": "Sales Lead Analysis",
"description": "Analyze potential leads and generate sales insights",
"runType": "instant",
"trigger": {
"type": "folders",
"folderIds": ["leads-folder"]
},
"action": {
"type": "magic-prompt",
"magicPrompt": {
"title": "Sales Intelligence",
"assistantType": "sales",
"prompt": "Review the lead information and provide: 1) Lead quality score (1-10), 2) Key pain points identified, 3) Recommended follow-up strategy, 4) Potential deal size estimate",
"assistantTemplateId": ""
}
}
}
4. Scheduled Automation with Marketing Analysis
Method: POST
Body (JSON):
{
"name": "Daily Marketing Report",
"description": "Generate daily marketing insights from campaign data",
"runType": "schedule",
"schedule": {
"timePeriod": "yesterday",
"repeatAt": "08:00"
},
"trigger": {
"type": "folders",
"folderIds": ["marketing-data", "campaign-reports"]
},
"action": {
"type": "magic-prompt",
"magicPrompt": {
"title": "Marketing Daily Digest",
"assistantType": "marketer",
"prompt": "Analyze yesterday's marketing data and provide: 1) Top performing campaigns, 2) Key metrics summary, 3) Trends identified, 4) Recommendations for today",
"assistantTemplateId": "marketing-template-001"
}
},
"fieldId": "marketing-field-123"
}
Available Enum Values:
Run Types:
-
"instant" - Executes immediately when triggered
-
"schedule" - Executes based on schedule configuration
Trigger Types:
-
"folders" - Triggered by folder changes
-
"tags" - Triggered by tag changes
-
"keywords" - Triggered by keyword matches
Action Types:
-
"magic-prompt" - AI-powered content analysis
-
"translation" - Document translation
Assistant Types (for magic-prompt):
- "researcher", "marketer", "sales", "general", "recruiter", "custom"
Schedule Time Periods:
- "today", "yesterday", "last7days", "last14days", "thisWeek"
These examples cover both instant and scheduled automation types with different actions. Make sure to replace the placeholder values (folder IDs, template IDs, etc.) with actual values from your system.
Request rules. schedule is required only when runType is schedule, and then both schedule.timePeriod and schedule.repeatAt are required too. For any other runType, schedule is optional. Each step's config object has to match that step's stepType; a mismatched config is rejected with a 400.
Request
- Base URL: https://api.speakai.co/v1
- URL: https://api.speakai.co/v1/automations
- Auth: API key in header x-speakai-key and API key in header x-access-token
Request body
Response
Success
Changes
No recorded changes to this operation across all 2 revisions of this API.