Background Jobs
Validate a CRON expression and return the next 5 fire times.
Used by the Job Creation wizard's "Schedule" step so the user can sanity check the schedule before submitting.
Enter your JWT token (without 'Bearer ' prefix)
5-field CRON: 'minute hour dom month dow'.
IANA tz name used to render the next-run timestamps.
UTCSuccessful Response
ISO-8601 timestamps in the requested timezone.
5Validation Error
POST /api/v1/background_jobs/cron/preview HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 43
{
"cron_expression": "text",
"timezone": "UTC"
}{
"valid": true,
"error": "text",
"human_readable": "text",
"next_runs": [
"text"
],
"min_interval_minutes": 5,
"suggestion": "text"
}Whether the caller's role can create / trigger background jobs.
Used by the FE to gate the "Schedule a job" entry points (wizard starter button, Run-now / Edit actions, etc.). Returns true for admins, "Power user", and any custom role with can_create_background_job=true.
Enter your JWT token (without 'Bearer ' prefix)
Successful Response
Whether the caller is allowed to create / trigger background jobs.
Field name mirrors CustomAgentSubmitResponse.submitAgent so the FE
has a consistent "permission probe" shape across features.
Validation Error
GET /api/v1/background_jobs/user/can-create HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"canCreateBackgroundJob": true
}List jobs in a project.
By default returns only the caller's jobs (matches the LLM tool's behaviour). Pass mine_only=false to see all jobs in the project (useful for project-admin views and the Admin Console).
Enter your JWT token (without 'Bearer ' prefix)
Project whose jobs to list.
If true, return only the caller's jobs.
trueInclude removed jobs.
falseSuccessful Response
Validation Error
GET /api/v1/background_jobs?project_id=1 HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"jobs": [
{
"job_id": "text",
"project_id": 1,
"project_name": "text",
"name": "text",
"agent_name": "text",
"prompt": "text",
"trigger_type": "text",
"cron_expression": "text",
"timezone": "text",
"status": "text",
"creator_username": "text",
"created_at": "2026-01-01T00:00:00.000Z",
"last_run_at": "2026-01-01T00:00:00.000Z",
"last_run_status": "text",
"last_conversation_id": 1,
"next_run_at": "2026-01-01T00:00:00.000Z",
"unread_count": 0,
"notification_channels": [
"text"
],
"slack_channel_ids": [
"text"
]
}
],
"total": 1
}Create a recurring background job.
Validates the agent + CRON + project membership, persists the row, then registers the schedule in redbeat. Same code path the LLM tool uses.
Enter your JWT token (without 'Bearer ' prefix)
UTCSuccessful Response
0Validation Error
POST /api/v1/background_jobs HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 170
{
"project_id": 1,
"agent_name": "text",
"prompt": "text",
"cron_expression": "text",
"timezone": "UTC",
"name": "text",
"notification_channels": [
"text"
],
"slack_channel_ids": [
"text"
]
}{
"job_id": "text",
"project_id": 1,
"project_name": "text",
"name": "text",
"agent_name": "text",
"prompt": "text",
"trigger_type": "text",
"cron_expression": "text",
"timezone": "text",
"status": "text",
"creator_username": "text",
"created_at": "2026-01-01T00:00:00.000Z",
"last_run_at": "2026-01-01T00:00:00.000Z",
"last_run_status": "text",
"last_conversation_id": 1,
"next_run_at": "2026-01-01T00:00:00.000Z",
"unread_count": 0,
"notification_channels": [
"text"
],
"slack_channel_ids": [
"text"
]
}List every background job across all projects with project names.
Role-aware (matches the Data Connectors pattern):
Admins see every job in the system.
Non-admins see only the jobs they created — across every project they're a member of.
The endpoint path stays /admin/all for backwards compatibility with the existing FE hook; the gating moved from "is admin?" to "filter by creator for non-admins".
Enter your JWT token (without 'Bearer ' prefix)
Include removed jobs.
falseSuccessful Response
Validation Error
GET /api/v1/background_jobs/admin/all HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"jobs": [
{
"job_id": "text",
"project_id": 1,
"project_name": "text",
"name": "text",
"agent_name": "text",
"prompt": "text",
"trigger_type": "text",
"cron_expression": "text",
"timezone": "text",
"status": "text",
"creator_username": "text",
"created_at": "2026-01-01T00:00:00.000Z",
"last_run_at": "2026-01-01T00:00:00.000Z",
"last_run_status": "text",
"last_conversation_id": 1,
"next_run_at": "2026-01-01T00:00:00.000Z",
"unread_count": 0,
"notification_channels": [
"text"
],
"slack_channel_ids": [
"text"
]
}
],
"total": 1
}Fetch a single job. Accessible to any member of the job's project.
Enter your JWT token (without 'Bearer ' prefix)
Successful Response
0Validation Error
GET /api/v1/background_jobs/{job_id} HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"job_id": "text",
"project_id": 1,
"project_name": "text",
"name": "text",
"agent_name": "text",
"prompt": "text",
"trigger_type": "text",
"cron_expression": "text",
"timezone": "text",
"status": "text",
"creator_username": "text",
"created_at": "2026-01-01T00:00:00.000Z",
"last_run_at": "2026-01-01T00:00:00.000Z",
"last_run_status": "text",
"last_conversation_id": 1,
"next_run_at": "2026-01-01T00:00:00.000Z",
"unread_count": 0,
"notification_channels": [
"text"
],
"slack_channel_ids": [
"text"
]
}Permanently remove a job. Unregisters the schedule, marks the job row removed (soft delete for audit), and hard-deletes the result conversation so it disappears from the sidebar and the conversations table.
Enter your JWT token (without 'Bearer ' prefix)
Successful Response
0Validation Error
DELETE /api/v1/background_jobs/{job_id} HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"job_id": "text",
"project_id": 1,
"project_name": "text",
"name": "text",
"agent_name": "text",
"prompt": "text",
"trigger_type": "text",
"cron_expression": "text",
"timezone": "text",
"status": "text",
"creator_username": "text",
"created_at": "2026-01-01T00:00:00.000Z",
"last_run_at": "2026-01-01T00:00:00.000Z",
"last_run_status": "text",
"last_conversation_id": 1,
"next_run_at": "2026-01-01T00:00:00.000Z",
"unread_count": 0,
"notification_channels": [
"text"
],
"slack_channel_ids": [
"text"
]
}Edit an existing background job.
Only fields included in the request body are modified. If trigger_type or cron_expression changes, the redbeat entry is updated automatically. Switching to 'manual' unregisters the schedule; switching to 'scheduled' re-registers it with the new (or existing) cron expression.
Enter your JWT token (without 'Bearer ' prefix)
Successful Response
0Validation Error
PATCH /api/v1/background_jobs/{job_id} HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 178
{
"name": "text",
"prompt": "text",
"agent_name": "text",
"trigger_type": "text",
"cron_expression": "text",
"timezone": "text",
"notification_channels": [
"text"
],
"slack_channel_ids": [
"text"
]
}{
"job_id": "text",
"project_id": 1,
"project_name": "text",
"name": "text",
"agent_name": "text",
"prompt": "text",
"trigger_type": "text",
"cron_expression": "text",
"timezone": "text",
"status": "text",
"creator_username": "text",
"created_at": "2026-01-01T00:00:00.000Z",
"last_run_at": "2026-01-01T00:00:00.000Z",
"last_run_status": "text",
"last_conversation_id": 1,
"next_run_at": "2026-01-01T00:00:00.000Z",
"unread_count": 0,
"notification_channels": [
"text"
],
"slack_channel_ids": [
"text"
]
}Trigger an immediate one-off run of an existing job.
Backs the "Run now" button on the success card and the Admin Console. Enqueues the same Celery task that the CRON schedule fires; the task holds its own Redis lock per job_id so concurrent triggers are naturally serialized.
Valid for both scheduled and manual jobs. A removed job is not runnable.
Enter your JWT token (without 'Bearer ' prefix)
Successful Response
Validation Error
POST /api/v1/background_jobs/{job_id}/run-now HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
Pause an active job — unregisters the redbeat entry; the DB row is preserved so the job can be resumed later. No-op if already paused.
Enter your JWT token (without 'Bearer ' prefix)
Successful Response
0Validation Error
POST /api/v1/background_jobs/{job_id}/pause HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"job_id": "text",
"project_id": 1,
"project_name": "text",
"name": "text",
"agent_name": "text",
"prompt": "text",
"trigger_type": "text",
"cron_expression": "text",
"timezone": "text",
"status": "text",
"creator_username": "text",
"created_at": "2026-01-01T00:00:00.000Z",
"last_run_at": "2026-01-01T00:00:00.000Z",
"last_run_status": "text",
"last_conversation_id": 1,
"next_run_at": "2026-01-01T00:00:00.000Z",
"unread_count": 0,
"notification_channels": [
"text"
],
"slack_channel_ids": [
"text"
]
}Resume a paused job — re-registers it in redbeat using its stored cron_expression. No-op if already active.
Enter your JWT token (without 'Bearer ' prefix)
Successful Response
0Validation Error
POST /api/v1/background_jobs/{job_id}/resume HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"job_id": "text",
"project_id": 1,
"project_name": "text",
"name": "text",
"agent_name": "text",
"prompt": "text",
"trigger_type": "text",
"cron_expression": "text",
"timezone": "text",
"status": "text",
"creator_username": "text",
"created_at": "2026-01-01T00:00:00.000Z",
"last_run_at": "2026-01-01T00:00:00.000Z",
"last_run_status": "text",
"last_conversation_id": 1,
"next_run_at": "2026-01-01T00:00:00.000Z",
"unread_count": 0,
"notification_channels": [
"text"
],
"slack_channel_ids": [
"text"
]
}List a job's runs and basic aggregates.
Backs the Job Detail screen: the "Execution history" table plus the Total runs / Success rate / Average duration stat cards. Each run row is derived from a single assistant message in the job's result conversation that carries a background_job_run card.
Enter your JWT token (without 'Bearer ' prefix)
Successful Response
Ratio of succeeded runs to runs with a definite outcome (succeeded + failed). None if there have been no such runs yet.
Mean wall-clock duration over runs that reported one.
Validation Error
GET /api/v1/background_jobs/{job_id}/runs HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"job_id": "text",
"runs": [
{
"message_id": 1,
"run_at": "2026-01-01T00:00:00.000Z",
"status": "text",
"duration_seconds": 1,
"total_tokens": 1,
"reason": "text"
}
],
"total_runs": 1,
"succeeded_runs": 1,
"failed_runs": 1,
"skipped_runs": 1,
"success_rate": 1,
"avg_duration_seconds": 1
}Fetch a single run's metadata and output.
Backs the Run Detail screen (Run #N). message_id is the id of the assistant message that holds the run's card and output — the same handle returned by list_background_job_runs.
Enter your JWT token (without 'Bearer ' prefix)
Successful Response
Single-run payload — backs the Run Detail screen.
""Validation Error
GET /api/v1/background_jobs/{job_id}/runs/{message_id} HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"job_id": "text",
"message_id": 1,
"run_at": "2026-01-01T00:00:00.000Z",
"status": "text",
"duration_seconds": 1,
"output": "",
"ui_resources": [
{
"ANY_ADDITIONAL_PROPERTY": "anything"
}
],
"timeline": [
{
"phase": "text",
"at": "2026-01-01T00:00:00.000Z",
"name": "text",
"status": "text",
"error": "text"
}
],
"usage": {
"total_tokens": 1,
"prompt_tokens": 1,
"completion_tokens": 1,
"iterations": 0,
"mcp_connectors_used": [
"text"
],
"kb_files_used": [
"text"
]
},
"reason": "text"
}Last updated
