Skip to content
Leadtime
English
Esc
↑↓navigate↵open⌘Jpreview

Create automation

Creates a new automation. Executor must be a bot/agent user (automations always execute as an agent). Personal scope requires managePersonalAutomations; workspace requires manageWorkspaceAutomations. userPrompt accepts HTML or Markdown (automation prompt format: basic nodes, mentions, images; no files or videos).

POST/automations
Authorization
AuthorizationOAuth2 access token · headerrequired
Scopes:api:write
or
AuthorizationBearer token (JWT) · headerrequired
Query parameters
fieldsToReturnstring

Comma-separated list of top-level response fields to return. Overrides the endpoint compact default unless responseShape=full is used.

responseShapestring

Advanced override. Omit for the endpoint compact default. Use full only when you need the complete endpoint response, including nested fields that are not selectable with fieldsToReturn.

Allowed:compactfull
Header parameters
LT-Response-Shapestring

Advanced override. Set to full only when you need the complete endpoint response, including nested fields that are not selectable with fieldsToReturn.

Allowed:full
Request body
requiredapplication/json
executionConfigobjectrequired

Execution config (agent-specific or workflow metadata). Not used for trigger matching filters; event trigger filters belong in triggers[].definition.filters.

executionTypestringrequired

Execution type (agent or workflow). Currently only agent is supported.

Allowed:agentworkflow
executorUserIdstringrequired

User id of the executing agent. Must be a bot/agent user — automations always execute as an agent, never as a human user.

isEnabledboolean

Whether the automation is enabled

scopestringrequired

Scope (personal or workspace). Personal requires managePersonalAutomations; workspace requires manageWorkspaceAutomations.

Allowed:personalworkspace
titlestringrequired

Automation title

triggersAutomationTriggerDto[]required

Triggers (daily, weekly, monthly, customCron, webhook, organizationCreated, projectCreated, taskCreated, objectCreated, slackMessageInPublicChannel, slackReactionAdded). At least one required. For webhook, POST JSON to {WORKC_URL}/api/automations/webhooks/{webhookSecret} (no auth). For slackMessageInPublicChannel, see definition.channelId (Slack public channel ID) and optional text filters in AutomationTriggerDto. For slackReactionAdded, see definition.emojiName and optional definition.channelId. For event triggers, filters belong inside triggers[].definition.filters, not executionConfig.

Show properties
Array of AutomationTriggerDto
definitionobject

Per-trigger settings. slackMessageInPublicChannel — required channelId: Slack public channel ID (C…), not the human-readable name. Optional textPattern (message must contain this substring, case-insensitive) and useRegex (if true, textPattern is a JavaScript regex). Example: {"channelId":"C012ABCDE","textPattern":"bug","useRegex":false}. slackReactionAdded — required emojiName: Slack emoji short name. Colons and common pasted/natural forms are accepted and normalized (eyes, :eyes:, +1, :+1:, thumbsup, thumbs up). Optional channelId limits the trigger to one channel. Example: {"emojiName":":+1:","channelId":"C012ABCDE"}. On run, the agent receives triggerEventPayload.slack: channelId, channelType, userId, text, ts, threadTs — use with Slack integration tools to reply in-thread (threadTs ?? ts) and add/remove reactions on ts. organizationCreated / projectCreated / taskCreated / objectCreated — optional filters (FilterStripModel). Field names and value shapes must match the list grid for that entity: use action-details on GET /tasks/grid for taskCreated, GET /projects for projectCreated, GET /organizations for organizationCreated, internal GET …/objects/grid for objectCreated (not interchangeable). For event triggers, definition.filters must be a full FilterStripModel object such as {"quickSearch":"","filters":[...]}. Schedules — timeOfDay (HH:mm), weekday (0-6), dayOfMonth (1-31), cronExpression (customCron). webhook — no required fields.

isEnabledboolean

Whether the trigger is enabled

sortOrdernumber

Sort order for multiple triggers

typestringrequired

Trigger variant: daily, weekly, monthly, customCron, webhook, organizationCreated, projectCreated, taskCreated, objectCreated, slackMessageInPublicChannel, or slackReactionAdded. slackMessageInPublicChannel fires on new messages in a monitored public Slack channel; the workspace must have Slack connected and the agent must be in that channel.

Allowed:dailyweeklymonthlycustomCronwebhookorganizationCreatedprojectCreatedtaskCreatedobjectCreatedslackMessageInPublicChannelslackReactionAdded
userPromptobject | nullrequired

User prompt for agent (HTML or Markdown). Automation prompt format: basic nodes, mentions, images; no files or videos.

Responses
200
createdAtstring<date-time>required

Creation timestamp

createdBystringrequired

Creator user ID

executionConfigobjectrequired

Execution config

executionTypestringrequired

Execution type

Allowed:agentworkflow
executorUserIdstringrequired

Executor user ID

idstringrequired

Automation ID

isEnabledbooleanrequired

Whether automation is enabled

ownerUserIdobject | nullrequired

Owner user ID (for personal scope)

scopestringrequired

Scope

Allowed:personalworkspace
titlestringrequired

Automation title

triggersobject[]required

Triggers. For type webhook, webhookSecret is present after save; use POST {base}/api/automations/webhooks/{webhookSecret} to run. For type slackMessageInPublicChannel, definition contains channelId (Slack C…) and optional textPattern/useRegex. For type slackReactionAdded, definition contains emojiName and optional channelId.

Show properties
Array of object
definitionobject
idstring
isEnabledboolean
sortOrdernumber
typestring
Allowed:dailyweeklymonthlycustomCronwebhookorganizationCreatedprojectCreatedtaskCreatedobjectCreatedslackMessageInPublicChannelslackReactionAdded
webhookSecretstring | null

Only for webhook triggers. Present after save. Inbound webhook: POST {base}/api/automations/webhooks/{webhookSecret} with Content-Type: application/json. No auth; secret authenticates. Request body is passed to the agent as context.

updatedAtstring<date-time>required

Last update timestamp

updatedByobject | nullrequired

Last updater user ID

userPromptobject | nullrequired

User prompt for agent (HTML, automation prompt format: basic nodes, mentions, images; no files or videos)

workspaceIdstringrequired

Workspace ID

401

Unauthorized - Invalid or missing authentication token

403

Forbidden - Insufficient API scopes or permissions

Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST "https://leadtime.app/api/public/automations" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "executionConfig": {},
  "executionType": "agent",
  "executorUserId": "123e4567-e89b-12d3-a456-426614174000",
  "isEnabled": true,
  "scope": "personal",
  "title": "Daily standup reminder",
  "triggers": [
    {
      "definition": {
        "channelId": "C012ABCDE",
        "textPattern": "bug",
        "useRegex": false
      },
      "isEnabled": true,
      "sortOrder": 0,
      "type": "daily"
    }
  ],
  "userPrompt": "<p>Summarize yesterday progress</p>"
}'
Response
{
  "createdAt": "2019-08-24T14:15:22Z",
  "createdBy": "string",
  "executionConfig": {},
  "executionType": "agent",
  "executorUserId": "string",
  "id": "string",
  "isEnabled": true,
  "ownerUserId": {},
  "scope": "personal",
  "title": "string",
  "triggers": [
    {
      "definition": {},
      "id": "string",
      "isEnabled": true,
      "sortOrder": 0,
      "type": "daily",
      "webhookSecret": "string"
    }
  ],
  "updatedAt": "2019-08-24T14:15:22Z",
  "updatedBy": {},
  "userPrompt": {},
  "workspaceId": "string"
}