Scheduled Tasks

Run backend functions automatically on a recurring interval or manually on demand.

Scheduled Tasks

Scheduled tasks run backend functions automatically at a recurring interval. Use them for cleanup jobs, report generation, external API syncs, periodic health checks, and other work that should happen without a user request.

Create A Task

Open Tasks from the sidebar

Click Create Task

Give the task a clear name, like "Daily Cleanup" or "Sync Inventory"

Add a schedule by choosing a frequency and unit, such as every 5 minutes, every hour, or every day

Optionally set start and end times

Build the function steps that should run on each execution

Save and enable the task

Manual Tasks

If a task should only run when another function starts it, remove the schedule and keep it manual. Manual tasks are useful for reusable jobs such as "Send Report", "Process Upload", or "Rebuild Search Index".

Background Execution

Tasks can run in the main API process or in a background process.

Use Run in Background when the task may be slow, resource-heavy, or safe to queue. Background execution runs in an isolated process with configurable timeout and memory limits.

Background work can be delayed

Background tasks run through a queue. Use them for async work, not for request-response behavior that must finish immediately.

Task Configuration

Examples

Daily cleanup

// Schedule: every 1 day
// Step 1: Delete expired sessions
// Step 2: Delete old temporary files
// Step 3: Log cleanup counts

Hourly inventory sync

// Schedule: every 1 hour
// Step 1: Call supplier API
// Step 2: Loop through products
// Step 3: Update local inventory rows

Manual export job

// No schedule
// Triggered by an admin endpoint or another function
// Step 1: Query records
// Step 2: Generate file
// Step 3: Send download link

Error Handling

When a task fails, Spala records the run with diagnostic details. If the task runs in the background, inspect it from the Background Tasks monitor to see status, output, and logs.

A descriptive name for the task
How often the task should run
Seconds, minutes, hours, or days
Optional time when the schedule becomes active
Optional time when the schedule stops running
Whether the task is active and will run on schedule
Run in an isolated background process instead of the main API process
Optional timeout and memory limits for background execution
Background Tasks
/tasks/background-tasks
Monitor queued, running, completed, and failed background work
Tasks Overview
/tasks
Learn about all task types in Spala
Project Agents
/features/project-agents
Use agents for richer triggered automations