Linea Docs

Triggers

Automate workflow execution with cron schedules and inbound webhooks.

Triggers

Linea supports two automated trigger types: Schedules (cron-based) and Webhooks (HTTP-based). Both are scoped to a space.


Schedules

All schedule endpoints: /v1/workspaces/:workspaceId/spaces/:spaceId/schedules

POST /v1/workspaces/:wId/spaces/:sId/schedules

Create a cron schedule for a workflow.

Body

{
  "workflowId": "uuid",
  "cronExpr": "0 8 * * *",
  "input": { "timezone": "UTC" },
  "enabled": true
}
FieldTypeDescription
workflowIduuidWorkflow to execute
cronExprstringStandard cron expression (5-field)
inputobject?Static input passed to each run
enabledboolean?Defaults to true

Response 201: schedule object


GET /v1/workspaces/:wId/spaces/:sId/schedules

List all schedules in the space.

Response 200: array of schedule objects


PATCH /v1/workspaces/:wId/spaces/:sId/schedules/:id

Update cron expression, input, or enabled state.

Body: any subset of { cronExpr, input, enabled }

Response 200: updated schedule object


DELETE /v1/workspaces/:wId/spaces/:sId/schedules/:id

Delete a schedule.

Response 204


Schedule Object

{
  "id": "uuid",
  "spaceId": "uuid",
  "workflowId": "uuid",
  "cronExpr": "0 8 * * *",
  "input": {},
  "enabled": true,
  "createdAt": "2025-01-01T00:00:00Z",
  "updatedAt": "2025-01-01T00:00:00Z"
}

Standard 5-field cron syntax: minute hour day-of-month month day-of-week. Example: 0 8 * * 1-5 runs at 08:00 UTC on weekdays.


Webhooks

Management endpoints: /v1/workspaces/:workspaceId/spaces/:spaceId/webhooks

Public trigger endpoint: /v1/webhooks/:id/trigger

POST /v1/workspaces/:wId/spaces/:sId/webhooks

Create a webhook trigger for a workflow. Returns a secret: store it securely, it is shown only once.

Body

{ "workflowId": "uuid" }

Response 201

{
  "id": "uuid",
  "spaceId": "uuid",
  "workflowId": "uuid",
  "secret": "whsec_...",
  "createdAt": "2025-01-01T00:00:00Z"
}

GET /v1/workspaces/:wId/spaces/:sId/webhooks

List webhooks in the space. The secret field is never returned after creation.

Response 200: array of webhook objects (without secret)


DELETE /v1/workspaces/:wId/spaces/:sId/webhooks/:id

Delete a webhook.

Response 204


POST /v1/webhooks/:id/trigger (public)

Trigger a workflow via webhook. This endpoint is public (no Bearer token) but requires the x-webhook-secret header.

Headers

HeaderRequiredDescription
x-webhook-secretYesSecret returned at webhook creation time

Body: arbitrary JSON, passed as input to the workflow execution

Response 201: execution object

fetch('/v1/webhooks/your-webhook-id/trigger', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-webhook-secret': 'whsec_...'
  },
  body: JSON.stringify({ event: 'order.created', orderId: '123' })
});

Rotate your webhook secret by deleting the webhook and creating a new one. There is no secret-rotation endpoint.


Webhook Object

{
  "id": "uuid",
  "spaceId": "uuid",
  "workflowId": "uuid",
  "createdAt": "2025-01-01T00:00:00Z"
}