Automations

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.

post/automations

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

namestring required

Name the automation. This is what you see in the automations list. required, max length 150

descriptionstring

Describe what the automation does. You can send an empty string. optional, max length 1000, empty string allowed

isActiveboolean

Set whether the automation runs after you create it. Leave it out and the automation is created active. optional. The schema.default(true) is not what produces this: the controller writes isActive only when you send a boolean, and the stored record defaults to true.

runOnceOnlystring

Ignore this field. The server accepts it and then never reads it, so whatever you send has no effect. optional. unconstrained.strip, so any JSON type passes validation. The.strip has no runtime effect here because RequestValidation discards the validated value; the field is simply never read by the controller, so it is never persisted.

runType'instant' | 'schedule' | ''

Choose whether the automation runs as soon as its trigger fires or on a schedule. optional, empty string accepted. Values come from AutomationRunType plus an explicit ''. The declared default is 'instant', and although that default is not what reaches the controller, the effect holds anyway: createAutomation writes SCHEDULE only when runType strictly equals "schedule" and writes INSTANT otherwise.

fieldIdstring

Ignore this field. The server validates it and then never reads it, so setting it has no effect. optional, no length cap. Neither createAutomation nor updateAutomation destructures a top-level fieldId from req.body, so it is never persisted. Field targeting is done per step through magicPrompt.fieldId and magicPrompt.fieldIds.

isUpdatedboolean

Ignore this field. The server always marks a newly created automation as updated for the scheduler, whatever you send. optional. The controller does not read the client value; it hardcodes isUpdated: true on the new document.

Response

Success

Changes

No recorded changes to this operation across all 2 revisions of this API.