Skip to content

API reference: automations and notifications ​

Automations run through the built-in GsKnora Assistant on behalf of the creator. The interfaces below require a signed-in user, Viewer+ role in the workspace, and only access the caller’s tasks and notifications; API keys are not allowed on these routes.

Task management ​

Method and pathUsage
GET /api/v1/automationsList the user’s tasks
POST /api/v1/automationsCreate a task
POST /api/v1/automations/validate-triggerValidate schedule and preview next run
GET /api/v1/automations/by-session/:session_idTask linked to a session
GET /api/v1/automations/:idTask detail
PUT /api/v1/automations/:idUpdate task (fields present in AutomationPatch)
DELETE /api/v1/automations/:idDelete a task
POST /api/v1/automations/:id/pausePause schedule
POST /api/v1/automations/:id/resumeResume schedule
POST /api/v1/automations/:id/runRun immediately

Required fields on create: name, instruction, trigger. Example:

json
{
  "name": "Daily knowledge summary",
  "instruction": "Read knowledge bases I can access, summarize recent additions with sources, without modifying data.",
  "trigger": {"type": "cron", "expr": "0 9 * * *", "timezone": "Asia/Shanghai"},
  "session_mode": "per_run",
  "access_level": "read_only",
  "notify_on_success": true
}
FieldDescription
trigger.typecron or once
trigger.exprFive- or six-field Cron, or descriptors like @daily; minimum interval 5 minutes
trigger.atOne-time time, RFC3339 or local time in the given zone; nonexistent local times are rejected
trigger.timezoneIANA time zone; UTC if omitted
model_idOptional model; empty = assistant default model
session_modeper_run (default) or persistent
carry_last_resultInject last success into each new session; default false
misfire_policyskip (default) or run_once
overlap_policyskip (default) or queue
access_levelread_only / confirm (default) / auto_write, capped by assistant access level
approval_timeout_minutesDefault 1440, range 5–10080
limits.max_duration_minutesDefault 30, max 240; does not include approval wait
notify_on_successDefault false; failures always notify

Task instructions accept template variables now, last_run_at, last_success_at, run_id, automation_name in double braces. Execution goes through the built-in assistant; collaboration needs are expressed in the instruction.

Runs and grants ​

Method and pathUsage
GET /api/v1/automations/:id/runsRun history
GET /api/v1/automation-runs/:idRun detail
POST /api/v1/automation-runs/:id/cancelCancel this run
GET /api/v1/automations/:id/grantsTask durable grants
GET /api/v1/automations/:id/grant-candidatesCandidates derived from existing approvals
POST /api/v1/automations/:id/grantsAdd a grant with {"prompt_id":"..."}

Run statuses include queued, running, awaiting_approval, succeeded, failed, cancelled, skipped, and needs_attention. The last means interruption with uncertain outcome—do not automatically replay writes that may already have been applied.

Unified list and revoke: GET /api/v1/agent/grants and DELETE /api/v1/agent/grants/:id; respond to approvals with POST /api/v1/agent/prompts/:prompt_id. Structure and validation: internal/handler/mcp_service.go, agent_grant.go.

In-app notifications ​

Method and pathUsage
GET /api/v1/notificationsUser notifications
POST /api/v1/notifications/readMark read: {"ids":["..."]}
DELETE /api/v1/notifications/readDelete read notifications

Implementation reference: internal/router/routes_automation.go, internal/handler/automation.go, internal/types/automation.go. Product usage: Automations.