Skip to main content
Version: PromptQL

Schedules API

Introduction

The Schedules API allows you to create and manage scheduled executions of automations and other recurring tasks. This API enables you to set up automated workflows that run at specific times or intervals, perfect for data processing pipelines, report generation, and other time-based operations.

To enable schedules you must enable the flag in metadata

In your promptql-config.hml file, add the following:

kind: PromptQlConfig
version: v2
definition:
featureFlags:
enable_scheduled_automations: true

Additionally, while you can currently schedule automations, you cannot yet run them. This feature is coming soon.

Base URL

Schedule endpoints use the following base URL:

https://promptql.ddn.hasura.app/schedules

Private DDN Endpoint

For Private DDN setups the endpoint will change to use the fully qualified domain name (FQDN) for the project assigned by the control plane. For example:

https://promptql.<FQDN>/schedules

You can find your API endpoint in the project's settings under PromptQL API Endpoint.

Authentication

Schedule endpoints require JWT authentication for all operations:

Authorization: Bearer <jwt-token>
Content-Type: application/json
Getting JWT Tokens

For information on obtaining JWT tokens, see the Authentication guide.

List Schedules

Retrieve all schedules for your project.

GET /schedules

Response

[
{
"schedule_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Daily Report Generation",
"description": "Generate daily analytics report",
"cron_expression": "0 9 * * *",
"automation_name": "generate_daily_report",
"enabled": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"next_run": "2024-01-16T09:00:00Z",
"last_run": "2024-01-15T09:00:00Z",
"last_run_status": "success"
}
]

Response Fields

FieldTypeDescription
schedule_idstringUnique identifier for the schedule
namestringHuman-readable name for the schedule
descriptionstringOptional description of what the schedule does
cron_expressionstringCron expression defining when to run
automation_namestringName of the automation to execute
enabledbooleanWhether the schedule is currently active
created_atstringISO 8601 timestamp of creation
updated_atstringISO 8601 timestamp of last update
next_runstringISO 8601 timestamp of next scheduled run
last_runstringISO 8601 timestamp of last execution
last_run_statusstringStatus of the last execution

Create Schedule

Create a new scheduled task.

POST /schedules

Request Body

{
"name": "Daily Report Generation",
"description": "Generate daily analytics report at 9 AM",
"cron_expression": "0 9 * * *",
"automation_name": "generate_daily_report",
"enabled": true,
"input_data": {
"report_type": "daily",
"include_charts": true
}
}

Request Fields

FieldTypeRequiredDescription
namestringYesHuman-readable name for the schedule
descriptionstringNoOptional description of what the schedule does
cron_expressionstringYesCron expression defining when to run
automation_namestringYesName of the automation to execute
enabledbooleanNoWhether the schedule should be active (default: true)
input_dataobjectNoOptional input data to pass to the automation

Cron Expression Format

The cron expression follows the standard 5-field format:

* * * * *
│ │ │ │ │
│ │ │ │ └─── Day of week (0-7, Sunday = 0 or 7)
│ │ │ └───── Month (1-12)
│ │ └─────── Day of month (1-31)
│ └───────── Hour (0-23)
└─────────── Minute (0-59)

Common Examples:

  • 0 9 * * * - Every day at 9:00 AM
  • 0 */6 * * * - Every 6 hours
  • 0 9 * * 1 - Every Monday at 9:00 AM
  • 30 14 1 * * - First day of every month at 2:30 PM

Response

{
"schedule_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Daily Report Generation",
"description": "Generate daily analytics report at 9 AM",
"cron_expression": "0 9 * * *",
"automation_name": "generate_daily_report",
"enabled": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"next_run": "2024-01-16T09:00:00Z"
}

Error Responses

  • 400 Bad Request - Invalid cron expression or automation name
  • 404 Not Found - Referenced automation does not exist
  • 422 Unprocessable Entity - Validation errors in request body

Get Schedule

Retrieve a specific schedule by its ID.

GET /schedules/{schedule_id}

Path Parameters

ParameterTypeRequiredDescription
schedule_idstringYesUUID of the schedule to retrieve

Response

{
"schedule_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Daily Report Generation",
"description": "Generate daily analytics report at 9 AM",
"cron_expression": "0 9 * * *",
"automation_name": "generate_daily_report",
"enabled": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"next_run": "2024-01-16T09:00:00Z",
"last_run": "2024-01-15T09:00:00Z",
"last_run_status": "success",
"input_data": {
"report_type": "daily",
"include_charts": true
},
"execution_history": [
{
"execution_id": "exec-uuid-1",
"started_at": "2024-01-15T09:00:00Z",
"completed_at": "2024-01-15T09:02:30Z",
"status": "success",
"output": {
"report_generated": true,
"records_processed": 1250
}
}
]
}

Error Responses

  • 404 Not Found - Schedule not found or access denied
  • 422 Unprocessable Entity - Invalid schedule ID format