> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getdialed.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a scheduled job

> Creates a recurring trigger backed by a managed schedule. The cron expression is a 5-field UTC expression (aliases like `@hourly` are rejected). The record is written first, then the schedule — on a scheduling failure the record is rolled back and 503 is returned.



## OpenAPI

````yaml /openapi.json post /scheduled-jobs
openapi: 3.1.0
info:
  title: GetDialed Flows API
  version: 0.1.0
servers:
  - url: https://api.getdialed.ai/flows
    description: Production
  - url: http://localhost:8000
    description: Local development
security: []
paths:
  /scheduled-jobs:
    post:
      tags:
        - scheduled-jobs
      summary: Create a scheduled job
      description: >-
        Creates a recurring trigger backed by a managed schedule. The cron
        expression is a 5-field UTC expression (aliases like `@hourly` are
        rejected). The record is written first, then the schedule — on a
        scheduling failure the record is rolled back and 503 is returned.
      operationId: create_scheduled_job_scheduled_jobs_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScheduledJobCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledJobResponse'
        '401':
          description: Missing or invalid authentication
          content:
            application/json:
              example:
                detail: Authentication required
        '403':
          description: Admin role required
          content:
            application/json:
              example:
                detail: Admin role required
        '404':
          description: Not found — also returned on cross-tenant access (never 403)
          content:
            application/json:
              example:
                detail: Definition not found
        '422':
          description: Validation error (see body for field details)
          content:
            application/json:
              example:
                detail: Validation error
        '429':
          description: Rate limit exceeded — retry after the Retry-After header
          content:
            application/json:
              example:
                detail: Rate limit exceeded
        '503':
          description: Schedule operation failed
          content:
            application/json:
              example:
                detail: Schedule create failed, record cleaned up
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    ScheduledJobCreate:
      properties:
        definition_id:
          type: string
          title: Definition Id
        description:
          type: string
          maxLength: 200
          minLength: 1
          title: Description
        cron_expression:
          type: string
          title: Cron Expression
        enabled:
          type: boolean
          title: Enabled
          default: true
        input_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Input Data
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
      additionalProperties: false
      type: object
      required:
        - definition_id
        - description
        - cron_expression
      title: ScheduledJobCreate
      description: POST /scheduled-jobs body. All fields required except optional ones.
      example:
        cron_expression: 0 9 * * 1-5
        definition_id: def_a1b2c3d4
        description: Nightly Five9 report sync
        enabled: true
        input_data:
          report: daily_calls
        metadata:
          owner: ops
    ScheduledJobResponse:
      properties:
        id:
          type: string
          title: Id
        definition_id:
          type: string
          title: Definition Id
        org_id:
          type: string
          title: Org Id
        description:
          type: string
          title: Description
        cron_expression:
          type: string
          title: Cron Expression
        enabled:
          type: boolean
          title: Enabled
        input_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Input Data
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        next_fire_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Next Fire At
        last_fired_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Fired At
        last_fire_status:
          anyOf:
            - type: string
              enum:
                - success
                - failure
                - running
            - type: 'null'
          title: Last Fire Status
      type: object
      required:
        - id
        - definition_id
        - org_id
        - description
        - cron_expression
        - enabled
        - input_data
        - metadata
        - created_at
        - updated_at
        - next_fire_at
        - last_fired_at
        - last_fire_status
      title: ScheduledJobResponse
      description: >-
        GET response — `next_fire_at` is injected by the router via croniter
        (D-14).


        `next_fire_at` is None only for legacy rows whose stored cron cannot

        produce a next fire (CR-02 defense in depth) — the write gate rejects

        such expressions for all new/updated records.
      example:
        created_at: '2026-07-09T09:00:00Z'
        cron_expression: 0 9 * * 1-5
        definition_id: def_a1b2c3d4
        description: Nightly Five9 report sync
        enabled: true
        id: sched_1a2b3c4d
        input_data:
          report: daily_calls
        metadata:
          owner: ops
        next_fire_at: '2026-07-10T09:00:00Z'
        org_id: org_e5f6g7h8
        updated_at: '2026-07-09T09:00:00Z'
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
    HTTPBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````