Automations API

The Automations API provides full CRUD operations for managing engines (scheduled automations), controlling their lifecycle, triggering manual runs, and viewing run history. All endpoints require authentication.

Base URL

https://api.workjet.dev/v1

Endpoints

List Automations

GET /automations

Returns all automations (engines) for the authenticated user's organization.

Response

{
  "automations": [
    {
      "id": "auto_xyz789",
      "name": "Weekly Pipeline Report",
      "description": "Generate a sales pipeline summary every Monday",
      "status": "active",
      "schedule": "0 9 * * 1",
      "timezone": "America/New_York",
      "model": "claude-4-sonnet",
      "lastRunAt": "2026-04-07T13:00:02Z",
      "nextRunAt": "2026-04-14T13:00:00Z",
      "createdAt": "2026-03-01T10:00:00Z"
    }
  ],
  "total": 1
}

Create Automation

POST /automations

Request Body

Field Type Required Description
name string Yes Automation name
description string No Description of what the automation does
systemPrompt string Yes Instructions for the AI to follow on each run
model string No Model ID or tier. Default: standard
schedule string Yes Cron expression (e.g., 0 9 * * 1)
timezone string No IANA timezone. Default: UTC
tools string[] No Array of MCP connector IDs the automation can use
channels object[] No Output channels (Slack, email, webhook)

Example

curl -X POST https://api.workjet.dev/v1/automations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer wj_live_..." \
  -d '{
    "name": "Daily Documentation Scan",
    "description": "Check documentation for accuracy and flag outdated sections",
    "systemPrompt": "Review the documentation files and identify any sections that are outdated, inaccurate, or missing. Report findings as a bullet list.",
    "model": "premium",
    "schedule": "0 8 * * 1-5",
    "timezone": "America/Los_Angeles",
    "tools": ["filesystem", "github"],
    "channels": [
      { "type": "slack", "channel": "#docs-team" }
    ]
  }'

Get Automation

GET /automations/:id

Returns a single automation with full details including run history summary.

Update Automation

PUT /automations/:id

Updates an automation's configuration. Same fields as Create, all optional.

Delete Automation

DELETE /automations/:id

Permanently deletes an automation and its run history.

Lifecycle

Activate

POST /automations/:id/activate

Activates a paused automation. It will resume running on its configured schedule.

Response

{
  "id": "auto_xyz789",
  "status": "active",
  "nextRunAt": "2026-04-14T13:00:00Z"
}

Pause

POST /automations/:id/pause

Pauses an active automation. Scheduled runs are skipped until the automation is reactivated.

Response

{
  "id": "auto_xyz789",
  "status": "paused"
}

Manual Run

POST /automations/:id/run

Triggers an immediate execution of the automation, regardless of its schedule. The automation does not need to be active to trigger a manual run.

Response

{
  "runId": "run_abc456",
  "automationId": "auto_xyz789",
  "status": "running",
  "startedAt": "2026-04-14T15:30:00Z"
}

Run History

List Runs

GET /automations/:id/runs

Returns the run history for an automation, ordered by most recent first.

Query Parameters

Parameter Type Description
limit integer Number of runs to return. Default: 20, max: 100
offset integer Pagination offset. Default: 0
status string Filter by status: success, failure, running

Response

{
  "runs": [
    {
      "id": "run_abc456",
      "automationId": "auto_xyz789",
      "status": "success",
      "startedAt": "2026-04-14T13:00:02Z",
      "completedAt": "2026-04-14T13:00:18Z",
      "duration": 16000,
      "tokensInput": 2340,
      "tokensOutput": 1856,
      "estimatedCost": 0.0312,
      "output": "## Weekly Pipeline Report\n\n..."
    }
  ],
  "total": 12
}

Duration is reported in milliseconds. Estimated cost is calculated using the configured per-model rates.

Next Steps