{
  "openapi": "3.1.0",
  "info": {
    "title": "Simplcron API",
    "version": "0.1.0",
    "description": "Register HTTPS tasks, submit background jobs, inspect traces, and configure lifecycle webhooks. The dashboard and MCP use the same scoped API."
  },
  "servers": [
    {
      "url": "/",
      "description": "Origin serving your Simplcron console"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "browserSession": []
    },
    {
      "localBrowserSession": []
    }
  ],
  "tags": [
    {
      "name": "Tasks"
    },
    {
      "name": "Jobs"
    },
    {
      "name": "Runs"
    },
    {
      "name": "Schedules"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "API keys"
    },
    {
      "name": "Session"
    }
  ],
  "paths": {
    "/v1/tasks": {
      "get": {
        "operationId": "listTasks",
        "summary": "List tasks",
        "tags": [
          "Tasks"
        ],
        "description": "Read task registrations in the environment resolved by the credential.",
        "responses": {
          "200": {
            "description": "List for the authenticated environment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tasks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Task"
                      }
                    }
                  },
                  "required": [
                    "tasks"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createTask",
        "summary": "Register a task",
        "tags": [
          "Tasks"
        ],
        "description": "Register an HTTPS handler. Store its one-time signing secret before delivering work. The destination must be allowlisted.",
        "responses": {
          "201": {
            "description": "Task registered",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "task": {
                      "$ref": "#/components/schemas/Task"
                    },
                    "secret": {
                      "type": "string",
                      "description": "One-time HMAC signing secret. Store it in your application’s secret store."
                    }
                  },
                  "required": [
                    "task",
                    "secret"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Task slug already registered",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Task limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskInput"
              }
            }
          }
        }
      }
    },
    "/v1/tasks/starters": {
      "get": {
        "operationId": "listTaskStarters",
        "summary": "List task starters",
        "tags": [
          "Tasks"
        ],
        "description": "List the starter tasks available to the authenticated workspace, project, and environment. An API key needs tasks:read. The list is empty when the test fixture is unavailable.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Environment"
          }
        ],
        "responses": {
          "200": {
            "description": "Starter catalog",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "starters": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TaskStarter"
                      }
                    }
                  },
                  "required": [
                    "starters"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the required permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/starters/{id}": {
      "post": {
        "operationId": "createTaskFromStarter",
        "summary": "Create a task from a starter",
        "tags": [
          "Tasks"
        ],
        "description": "Register the starter in the authenticated workspace, project, and environment. An API key needs tasks:write. Repeating the request returns the previously registered task. Submit a job or configure a schedule separately.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Environment"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "run-now",
                "schedule-once",
                "wait-until",
                "wait-for-reply",
                "retry-once",
                "recurring-report",
                "webhook-trigger",
                "failed-run"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Existing starter task returned with created set to false",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskStarterRegistration"
                }
              }
            }
          },
          "201": {
            "description": "Starter task registered with created set to true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskStarterRegistration"
                }
              }
            }
          },
          "400": {
            "description": "This operation expects an empty request body",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the required permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The starter is unknown or unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Another task already uses this starter's slug",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Task limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/jobs": {
      "post": {
        "operationId": "submitJob",
        "summary": "Submit a job",
        "tags": [
          "Jobs"
        ],
        "description": "Queue a registered task or schedule a future execution. Use waitUntil with starter-wait-until or replyTimeoutSeconds with starter-wait-for-reply to pause before the first handler attempt. The wait resumes under the same run ID. The submit_job MCP tool accepts these fields. Use Idempotency-Key to retry submission.",
        "responses": {
          "202": {
            "description": "Run accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            },
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Path to the run."
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Task not found in this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "An idempotency key already exists for different inputs",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Previously accepted run with the same idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            },
            "headers": {
              "Idempotency-Replayed": {
                "schema": {
                  "type": "string",
                  "const": "true"
                }
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Path to the run."
              }
            }
          },
          "429": {
            "description": "Workspace run limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInput"
              },
              "example": {
                "task": "starter-run-now",
                "payload": {
                  "report": "daily-summary"
                }
              }
            }
          }
        }
      }
    },
    "/v1/triggers/{slug}": {
      "post": {
        "operationId": "triggerTask",
        "summary": "Trigger a task via webhook",
        "tags": [
          "Jobs"
        ],
        "description": "Call a task-specific inbound webhook from a server or automation. It creates the same kind of job as POST /v1/jobs. Use waitUntil for starter-wait-until or replyTimeoutSeconds for starter-wait-for-reply.",
        "responses": {
          "202": {
            "description": "Run accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            },
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Path to the run."
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Task not found in this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "An idempotency key already exists for different inputs",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Previously accepted run with the same idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            },
            "headers": {
              "Idempotency-Replayed": {
                "schema": {
                  "type": "string",
                  "const": "true"
                }
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Path to the run."
              }
            }
          },
          "429": {
            "description": "Workspace run limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TaskSlug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerInput"
              },
              "example": {
                "payload": {
                  "event": "order.completed",
                  "orderId": "sample-order-001"
                }
              }
            }
          }
        }
      }
    },
    "/v1/runs": {
      "get": {
        "operationId": "listRuns",
        "summary": "List runs",
        "tags": [
          "Runs"
        ],
        "description": "Read environment-scoped run history. Continue at the next cursor using the same filters.",
        "responses": {
          "200": {
            "description": "Page of runs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Run"
                      }
                    },
                    "nextCursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "runs",
                    "nextCursor"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Filter by status. Use waiting for runs paused at a Wait Until or Wait for Reply checkpoint and scheduled for runs that have a future start time.",
            "schema": {
              "type": "string",
              "enum": [
                "scheduled",
                "queued",
                "waiting",
                "running",
                "retrying",
                "succeeded",
                "failed",
                "cancelled"
              ]
            }
          },
          {
            "name": "task",
            "in": "query",
            "description": "Filter by task slug.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
              "maxLength": 64
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum runs to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque nextCursor returned by a previous page.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/runs/{runId}": {
      "get": {
        "operationId": "getRun",
        "summary": "Get a run",
        "tags": [
          "Runs"
        ],
        "description": "Inspect the job payload, result, run state, attempt timings and recorded activity.",
        "responses": {
          "200": {
            "description": "Run with attempts and events",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "run": {
                      "$ref": "#/components/schemas/Run"
                    },
                    "attempts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Attempt"
                      }
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RunEvent"
                      }
                    }
                  },
                  "required": [
                    "run",
                    "attempts",
                    "events"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/RunId"
          }
        ]
      }
    },
    "/v1/runs/{runId}/trace": {
      "get": {
        "operationId": "getRunTrace",
        "summary": "Get a run trace",
        "tags": [
          "Runs"
        ],
        "description": "Read the recorded lifecycle timeline of a run. Wait starters record wait.started and wait.resumed. Wait for Reply records wait.reply_received or wait.timed_out before resumption.",
        "responses": {
          "200": {
            "description": "Recorded chronological trace",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "scheduled",
                        "queued",
                        "waiting",
                        "running",
                        "retrying",
                        "succeeded",
                        "failed",
                        "cancelled"
                      ]
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RunEvent"
                      }
                    }
                  },
                  "required": [
                    "runId",
                    "status",
                    "events"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/RunId"
          }
        ]
      }
    },
    "/v1/runs/{runId}/logs": {
      "get": {
        "operationId": "getRunLogs",
        "summary": "Get run logs",
        "tags": [
          "Runs"
        ],
        "description": "Read Simplcron’s event log for this run, including wait transitions, execution, and retry results.",
        "responses": {
          "200": {
            "description": "Recorded run events",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runId": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RunEvent"
                      }
                    }
                  },
                  "required": [
                    "runId",
                    "events"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/RunId"
          }
        ]
      }
    },
    "/v1/runs/{runId}/reply": {
      "post": {
        "operationId": "replyToRun",
        "summary": "Send a reply to a run",
        "tags": [
          "Runs"
        ],
        "description": "Record the first reply to a Wait for Reply run before its deadline, including while the run is queued. Simplcron resumes the same run. Server calls require a bearer API key with runs:write from the run's workspace, project, and environment. The signed-in console can use its same-origin session. A retry of the same JSON payload is safe even after the run finishes. Object key order is ignored for this check.",
        "parameters": [
          {
            "$ref": "#/components/parameters/RunId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplyInput"
              },
              "example": {
                "payload": {
                  "message": "Yes, I can make it"
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "First reply accepted. The existing run will resume.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplyReceipt"
                },
                "example": {
                  "runId": "run_0123456789abcdef0123456789abcdef",
                  "accepted": true
                }
              }
            }
          },
          "200": {
            "description": "The same payload was already accepted. The original reply is retained.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplyReceipt"
                },
                "example": {
                  "runId": "run_0123456789abcdef0123456789abcdef",
                  "accepted": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON or missing object payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Run not found in the credential's scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Reply conflicts with a prior reply or the run cannot accept a reply",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Reply payload exceeds 2 KiB of normalized JSON data or request exceeds the body limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/runs/{runId}/cancel": {
      "post": {
        "operationId": "cancelRun",
        "summary": "Cancel a run",
        "tags": [
          "Runs"
        ],
        "description": "Cancel a scheduled, queued, waiting or retrying run. Running work may already have affected your application.",
        "responses": {
          "200": {
            "description": "Cancelled run",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "This operation conflicts with the current state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/RunId"
          }
        ]
      }
    },
    "/v1/runs/{runId}/replay": {
      "post": {
        "operationId": "replayRun",
        "summary": "Replay a run",
        "tags": [
          "Runs"
        ],
        "description": "Create a new run ID with the earlier payload and a link to the failed or cancelled run.",
        "responses": {
          "202": {
            "description": "Run accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            },
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Path to the run."
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "This operation conflicts with the current state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Previously accepted run with the same idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            },
            "headers": {
              "Idempotency-Replayed": {
                "schema": {
                  "type": "string",
                  "const": "true"
                }
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Path to the run."
              }
            }
          },
          "429": {
            "description": "Workspace run limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/RunId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/v1/schedules": {
      "get": {
        "operationId": "listSchedules",
        "summary": "List schedules",
        "tags": [
          "Schedules"
        ],
        "description": "Read recurring jobs in this environment.",
        "responses": {
          "200": {
            "description": "List for the authenticated environment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schedules": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Schedule"
                      }
                    }
                  },
                  "required": [
                    "schedules"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createSchedule",
        "summary": "Create a schedule",
        "tags": [
          "Schedules"
        ],
        "description": "Create a recurring job with a UTC cadence preset. Daily and weekdays run at 09:00 UTC, and weekly runs on Mondays at 09:00 UTC. The Wait Until and Wait for Reply starters are available for one-off submissions.",
        "responses": {
          "201": {
            "description": "Created schedule",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schedule": {
                      "$ref": "#/components/schemas/Schedule"
                    }
                  },
                  "required": [
                    "schedule"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Task not found in this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Schedule limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScheduleInput"
              }
            }
          }
        }
      }
    },
    "/v1/schedules/{scheduleId}": {
      "patch": {
        "operationId": "updateSchedule",
        "summary": "Pause or resume a schedule",
        "tags": [
          "Schedules"
        ],
        "description": "Change whether the schedule creates future runs. Pausing preserves existing runs.",
        "responses": {
          "200": {
            "description": "Updated schedule",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schedule": {
                      "$ref": "#/components/schemas/Schedule"
                    }
                  },
                  "required": [
                    "schedule"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Schedule not found in this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/ScheduleId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "summary": "List subscriptions",
        "tags": [
          "Webhooks"
        ],
        "description": "Read lifecycle event subscriptions in this environment.",
        "responses": {
          "200": {
            "description": "List for the authenticated environment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "webhooks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      }
                    }
                  },
                  "required": [
                    "webhooks"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "summary": "Subscribe to lifecycle events",
        "tags": [
          "Webhooks"
        ],
        "description": "Register an allowed HTTPS endpoint for execution, completion and failure events. Store the returned one-time signing secret.",
        "responses": {
          "201": {
            "description": "Created subscription",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/Webhook"
                    },
                    "secret": {
                      "type": "string",
                      "description": "One-time HMAC signing secret. Store it in your application’s secret store."
                    }
                  },
                  "required": [
                    "webhook",
                    "secret"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Webhook limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookInput"
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{webhookId}": {
      "delete": {
        "operationId": "removeWebhook",
        "summary": "Remove a subscription",
        "tags": [
          "Webhooks"
        ],
        "description": "Remove an environment-scoped subscription so it receives no new events.",
        "responses": {
          "204": {
            "description": "Subscription removed"
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          }
        ]
      }
    },
    "/v1/keys": {
      "get": {
        "operationId": "listApiKeys",
        "summary": "List API keys",
        "tags": [
          "API keys"
        ],
        "description": "List API key metadata from an owner or admin browser session.",
        "responses": {
          "200": {
            "description": "List for the authenticated environment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keys": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiKey"
                      }
                    }
                  },
                  "required": [
                    "keys"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [
          {
            "browserSession": []
          },
          {
            "localBrowserSession": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Environment"
          }
        ]
      },
      "post": {
        "operationId": "createApiKey",
        "summary": "Create an API key",
        "tags": [
          "API keys"
        ],
        "description": "Create a key fixed to the current project and environment. Store the full API key immediately.",
        "responses": {
          "201": {
            "description": "Key created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "$ref": "#/components/schemas/ApiKey"
                    },
                    "secret": {
                      "type": "string",
                      "description": "One-time bearer API key."
                    }
                  },
                  "required": [
                    "key",
                    "secret"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [
          {
            "browserSession": []
          },
          {
            "localBrowserSession": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Environment"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiKeyInput"
              }
            }
          }
        }
      }
    },
    "/v1/keys/{keyId}": {
      "delete": {
        "operationId": "revokeApiKey",
        "summary": "Revoke an API key",
        "tags": [
          "API keys"
        ],
        "description": "Revoke an API key from an owner or admin browser session.",
        "responses": {
          "204": {
            "description": "API key revoked"
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [
          {
            "browserSession": []
          },
          {
            "localBrowserSession": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/KeyId"
          },
          {
            "$ref": "#/components/parameters/Environment"
          }
        ]
      }
    },
    "/auth/config": {
      "get": {
        "operationId": "getSignupPolicy",
        "summary": "Get the signup policy",
        "tags": [
          "Session"
        ],
        "description": "Check whether signup is open, requires a staging access code, or is closed.",
        "responses": {
          "200": {
            "description": "Current signup policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignupPolicy"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/auth/signup": {
      "post": {
        "operationId": "signup",
        "summary": "Sign up",
        "tags": [
          "Session"
        ],
        "description": "Create an account with a workspace and default project. The console receives a browser session cookie. Supply inviteCode when the signup policy is invite.",
        "responses": {
          "201": {
            "description": "Session cookie and new workspace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Signup is closed, the access code is missing or invalid, or the request's origin is disallowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Unable to create account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many attempts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignupInput"
              }
            }
          }
        }
      }
    },
    "/auth/login": {
      "post": {
        "operationId": "login",
        "summary": "Log in",
        "tags": [
          "Session"
        ],
        "description": "Start a console session using an email address and password.",
        "responses": {
          "200": {
            "description": "New session cookie and account scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many attempts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Credentials"
              }
            }
          }
        }
      }
    },
    "/auth/session": {
      "get": {
        "operationId": "getSession",
        "summary": "Get the current session",
        "tags": [
          "Session"
        ],
        "description": "Read the signed-in user, workspace, project and selected environment.",
        "responses": {
          "200": {
            "description": "Account and selected scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [
          {
            "browserSession": []
          },
          {
            "localBrowserSession": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Environment"
          }
        ]
      }
    },
    "/auth/logout": {
      "post": {
        "operationId": "logout",
        "summary": "Log out",
        "tags": [
          "Session"
        ],
        "description": "Revoke the current console session.",
        "responses": {
          "204": {
            "description": "Session ended"
          }
        },
        "security": [
          {
            "browserSession": []
          },
          {
            "localBrowserSession": []
          }
        ]
      }
    },
    "/v1/runs/{runId}/attempts": {
      "get": {
        "operationId": "listRunAttempts",
        "summary": "List run attempts",
        "tags": [
          "Runs"
        ],
        "description": "Read each recorded attempt and its outcome in order.",
        "responses": {
          "200": {
            "description": "Attempt history",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "runId",
                    "attempts"
                  ],
                  "properties": {
                    "runId": {
                      "type": "string"
                    },
                    "attempts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Attempt"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential lacks permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found in this environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/RunId"
          }
        ]
      }
    }
  },
  "webhooks": {
    "task.execution": {
      "post": {
        "operationId": "task_execution_event",
        "summary": "task.execution",
        "tags": [
          "Webhooks"
        ],
        "description": "A run attempt was claimed and is starting. Deliveries can repeat. Deduplicate by the event ID.",
        "security": [],
        "parameters": [
          {
            "name": "X-Simplcron-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "t=<Unix seconds>,v1=<HMAC SHA-256 hex> over the exact body prefixed by the timestamp and a period."
          },
          {
            "name": "X-Simplcron-Event",
            "in": "header",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/WebhookEvent"
            },
            "description": "Lifecycle event name."
          },
          {
            "name": "X-Simplcron-Delivery",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Delivery identifier. Use the event body ID to deduplicate."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookDelivery"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receiver accepted the event"
          },
          "204": {
            "description": "Receiver accepted the event"
          }
        }
      }
    },
    "task.completed": {
      "post": {
        "operationId": "task_completed_event",
        "summary": "task.completed",
        "tags": [
          "Webhooks"
        ],
        "description": "The run succeeded. Deliveries can repeat. Deduplicate by the event ID.",
        "security": [],
        "parameters": [
          {
            "name": "X-Simplcron-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "t=<Unix seconds>,v1=<HMAC SHA-256 hex> over the exact body prefixed by the timestamp and a period."
          },
          {
            "name": "X-Simplcron-Event",
            "in": "header",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/WebhookEvent"
            },
            "description": "Lifecycle event name."
          },
          {
            "name": "X-Simplcron-Delivery",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Delivery identifier. Use the event body ID to deduplicate."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookDelivery"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receiver accepted the event"
          },
          "204": {
            "description": "Receiver accepted the event"
          }
        }
      }
    },
    "task.failed": {
      "post": {
        "operationId": "task_failed_event",
        "summary": "task.failed",
        "tags": [
          "Webhooks"
        ],
        "description": "The run ended in failure after it stopped retrying. Deliveries can repeat. Deduplicate by the event ID.",
        "security": [],
        "parameters": [
          {
            "name": "X-Simplcron-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "t=<Unix seconds>,v1=<HMAC SHA-256 hex> over the exact body prefixed by the timestamp and a period."
          },
          {
            "name": "X-Simplcron-Event",
            "in": "header",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/WebhookEvent"
            },
            "description": "Lifecycle event name."
          },
          {
            "name": "X-Simplcron-Delivery",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Delivery identifier. Use the event body ID to deduplicate."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookDelivery"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receiver accepted the event"
          },
          "204": {
            "description": "Receiver accepted the event"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Environment-scoped Simplcron API key."
      },
      "browserSession": {
        "type": "apiKey",
        "in": "cookie",
        "name": "__Host-simplcron_session",
        "description": "Same-origin HTTPS console session."
      },
      "localBrowserSession": {
        "type": "apiKey",
        "in": "cookie",
        "name": "simplcron_session",
        "description": "Same-origin loopback console session."
      }
    },
    "parameters": {
      "RunId": {
        "name": "runId",
        "in": "path",
        "required": true,
        "description": "ID returned at submission.",
        "schema": {
          "type": "string",
          "pattern": "^run_[a-f0-9]{32}$"
        }
      },
      "TaskSlug": {
        "name": "slug",
        "in": "path",
        "required": true,
        "description": "Registered task slug.",
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
          "maxLength": 64
        }
      },
      "ScheduleId": {
        "name": "scheduleId",
        "in": "path",
        "required": true,
        "description": "ID of a schedule in the current environment.",
        "schema": {
          "type": "string"
        }
      },
      "WebhookId": {
        "name": "webhookId",
        "in": "path",
        "required": true,
        "description": "ID of a webhook subscription in the current environment.",
        "schema": {
          "type": "string"
        }
      },
      "KeyId": {
        "name": "keyId",
        "in": "path",
        "required": true,
        "description": "ID of an API key in the current environment.",
        "schema": {
          "type": "string"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "description": "Reuse the same value when repeating the same submission. Reusing it with different inputs returns a conflict.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160
        }
      },
      "Environment": {
        "name": "X-Simplcron-Environment",
        "in": "header",
        "description": "Environment for a browser session. Bearer keys always use their fixed environment.",
        "schema": {
          "type": "string",
          "enum": [
            "production",
            "development"
          ],
          "default": "production"
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ]
      },
      "TaskInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "maxLength": 64
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Allowed public HTTPS destination on port 443; redirects are not followed.",
            "maxLength": 2048
          },
          "description": {
            "type": "string",
            "maxLength": 200
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "default": 3
          }
        },
        "required": [
          "slug",
          "name",
          "url"
        ]
      },
      "Task": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "maxLength": 64
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "An allowlisted public HTTPS handler or a fixture URL for a built-in starter.",
            "maxLength": 2048
          },
          "description": {
            "type": "string",
            "maxLength": 200
          },
          "starterId": {
            "type": "string",
            "description": "The catalog identifier when this task was registered from a starter."
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "default": 3
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "url",
          "maxAttempts",
          "createdAt"
        ]
      },
      "TaskStarter": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Identifier to use when registering this starter."
          },
          "slug": {
            "type": "string",
            "description": "Task slug to use when submitting a run or creating a supported schedule."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          "payload": {
            "type": "object",
            "additionalProperties": true,
            "description": "Sample payload for a test run."
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "description",
          "maxAttempts",
          "payload"
        ]
      },
      "TaskStarterRegistration": {
        "type": "object",
        "properties": {
          "task": {
            "$ref": "#/components/schemas/Task"
          },
          "created": {
            "type": "boolean",
            "description": "True when this request registered the task."
          }
        },
        "required": [
          "task",
          "created"
        ]
      },
      "ReplyInput": {
        "type": "object",
        "properties": {
          "payload": {
            "type": "object",
            "additionalProperties": true,
            "description": "Reply data to pass to the handler. Up to 2 KiB of normalized JSON data."
          }
        },
        "required": [
          "payload"
        ]
      },
      "ReplyReceipt": {
        "type": "object",
        "properties": {
          "runId": {
            "type": "string",
            "pattern": "^run_[a-f0-9]{32}$"
          },
          "accepted": {
            "type": "boolean",
            "description": "True if this request recorded the reply. A retry of previously accepted data returns false."
          }
        },
        "required": [
          "runId",
          "accepted"
        ]
      },
      "TriggerInput": {
        "type": "object",
        "properties": {
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "description": "Defaults to the task's maximum attempts."
          },
          "runAt": {
            "type": "string",
            "format": "date-time",
            "description": "An explicit-offset RFC 3339 timestamp for a delayed start. Omit when using a wait starter."
          },
          "waitUntil": {
            "type": "string",
            "format": "date-time",
            "description": "Required for starter-wait-until and available only for that starter. Give an explicit-offset RFC 3339 resume time. For new submissions it must be in the future, up to 30 days ahead. Omit runAt."
          },
          "replyTimeoutSeconds": {
            "type": "integer",
            "minimum": 5,
            "maximum": 2592000,
            "default": 60,
            "description": "Available only for starter-wait-for-reply. The timeout starts when Simplcron accepts the job. Omit runAt and waitUntil."
          }
        },
        "required": [
          "payload"
        ]
      },
      "JobInput": {
        "type": "object",
        "properties": {
          "task": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "maxLength": 64
          },
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "description": "Defaults to the task's maximum attempts."
          },
          "runAt": {
            "type": "string",
            "format": "date-time",
            "description": "An explicit-offset RFC 3339 timestamp for a delayed start. Omit when using a wait starter."
          },
          "waitUntil": {
            "type": "string",
            "format": "date-time",
            "description": "Required for starter-wait-until and available only for that starter. Give an explicit-offset RFC 3339 resume time. For new submissions it must be in the future, up to 30 days ahead. Omit runAt."
          },
          "replyTimeoutSeconds": {
            "type": "integer",
            "minimum": 5,
            "maximum": 2592000,
            "default": 60,
            "description": "Available only for starter-wait-for-reply. The timeout starts when Simplcron accepts the job. Omit runAt and waitUntil."
          }
        },
        "required": [
          "task",
          "payload"
        ]
      },
      "Run": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "task": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "maxLength": 64
          },
          "taskName": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "scheduled",
              "queued",
              "waiting",
              "running",
              "retrying",
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "source": {
            "type": "string"
          },
          "attempt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "default": 3
          },
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "output": {},
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "startedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "runAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "nextAttemptAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "waitUntil": {
            "type": "string",
            "format": "date-time",
            "description": "Planned resume time for Wait Until or the reply deadline for Wait for Reply."
          },
          "waitStartedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "Time when a wait run entered its pause, or null until it has paused."
          },
          "waitResumedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "Time when a wait run resumed, or null before resumption."
          },
          "replyTimeoutSeconds": {
            "type": "integer",
            "minimum": 5,
            "maximum": 2592000,
            "description": "Timeout applied to this Wait for Reply run."
          },
          "waitOutcome": {
            "type": ["string", "null"],
            "enum": ["reply", "timeout", null],
            "description": "Outcome of a Wait for Reply run. Null until the run resumes."
          },
          "reply": {
            "type": ["object", "null"],
            "description": "The accepted reply on a full Wait for Reply run record. Null while there is no accepted reply, including after timeout. Run summaries omit this field.",
            "properties": {
              "receivedAt": {
                "type": "string",
                "format": "date-time"
              },
              "payload": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "required": ["receivedAt", "payload"]
          },
          "durationMs": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "previousRunId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "task",
          "status",
          "attempt",
          "maxAttempts",
          "createdAt"
        ]
      },
      "Attempt": {
        "type": "object",
        "properties": {
          "number": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          },
          "status": {
            "type": "string",
            "enum": [
              "scheduled",
              "queued",
              "running",
              "retrying",
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "statusCode": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "durationMs": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "number",
          "status",
          "startedAt"
        ]
      },
      "RunEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "description": "Recorded event type. Wait checkpoints emit wait.started followed by wait.resumed if they resume. Wait for Reply records wait.reply_received or wait.timed_out before wait.resumed."
          },
          "time": {
            "type": "string",
            "format": "date-time"
          },
          "attempt": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 5
              },
              {
                "type": "null"
              }
            ]
          },
          "detail": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "type",
          "time"
        ]
      },
      "ScheduleInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "task": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "maxLength": 64
          },
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "preset": {
            "type": "string",
            "enum": [
              "every-minute",
              "hourly",
              "daily",
              "weekdays",
              "weekly"
            ]
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "description": "Defaults to the task's maximum attempts."
          }
        },
        "required": [
          "name",
          "task",
          "preset",
          "payload"
        ]
      },
      "Schedule": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "task": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "maxLength": 64
          },
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "preset": {
            "type": "string",
            "enum": [
              "every-minute",
              "hourly",
              "daily",
              "weekdays",
              "weekly"
            ]
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "default": 3
          },
          "enabled": {
            "type": "boolean"
          },
          "nextRunAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "timezone": {
            "type": "string",
            "const": "UTC"
          }
        },
        "required": [
          "id",
          "name",
          "task",
          "preset",
          "enabled",
          "payload"
        ]
      },
      "WebhookEvent": {
        "type": "string",
        "enum": [
          "task.execution",
          "task.completed",
          "task.failed"
        ]
      },
      "WebhookInput": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Allowed public HTTPS destination on port 443; redirects are not followed."
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEvent"
            },
            "minItems": 1,
            "uniqueItems": true,
            "maxItems": 3
          }
        },
        "required": [
          "url",
          "events"
        ]
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Allowed public HTTPS destination on port 443; redirects are not followed."
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEvent"
            },
            "minItems": 1,
            "uniqueItems": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "revokedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "url",
          "events"
        ]
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/WebhookEvent"
          },
          "runId": {
            "type": "string"
          },
          "task": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "maxLength": 64
          },
          "status": {
            "type": "string",
            "enum": [
              "scheduled",
              "queued",
              "running",
              "retrying",
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "attempt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          },
          "time": {
            "type": "string",
            "format": "date-time"
          },
          "environment": {
            "type": "string",
            "enum": [
              "production",
              "development"
            ]
          }
        },
        "required": [
          "id",
          "type",
          "time",
          "runId",
          "task",
          "environment",
          "attempt",
          "status"
        ]
      },
      "ApiKeyInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "tasks:read",
                "tasks:write",
                "runs:read",
                "runs:write",
                "schedules:read",
                "schedules:write",
                "webhooks:read",
                "webhooks:write"
              ]
            }
          }
        },
        "required": [
          "name"
        ]
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "prefix": {
            "type": "string"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "tasks:read",
                "tasks:write",
                "runs:read",
                "runs:write",
                "schedules:read",
                "schedules:write",
                "webhooks:read",
                "webhooks:write"
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "revokedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "prefix",
          "createdAt"
        ]
      },
      "Credentials": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "password": {
            "type": "string",
            "format": "password",
            "minLength": 15
          }
        },
        "required": [
          "email",
          "password"
        ]
      },
      "SignupPolicy": {
        "type": "object",
        "properties": {
          "signup": {
            "type": "string",
            "enum": [
              "open",
              "invite",
              "closed"
            ]
          }
        },
        "required": [
          "signup"
        ]
      },
      "SignupInput": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "password": {
            "type": "string",
            "format": "password",
            "minLength": 15
          },
          "workspaceName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "inviteCode": {
            "type": "string",
            "format": "password",
            "maxLength": 256,
            "writeOnly": true,
            "description": "Required for invite-only staging signup."
          }
        },
        "required": [
          "email",
          "password"
        ]
      },
      "Session": {
        "type": "object",
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "email": {
                "type": "string",
                "format": "email"
              }
            },
            "required": [
              "id",
              "email"
            ]
          },
          "workspace": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              }
            },
            "required": [
              "id",
              "name"
            ]
          },
          "project": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              }
            },
            "required": [
              "id",
              "name"
            ]
          },
          "environment": {
            "type": "string",
            "enum": [
              "production",
              "development"
            ]
          }
        },
        "required": [
          "user",
          "workspace",
          "project",
          "environment"
        ]
      }
    }
  }
}
