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

# Create schedule

> Creates a new scheduled job.



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/schedules.yaml post /api/schedules
openapi: 3.0.3
info:
  title: Insforge Schedules API
  version: 1.0.0
  description: Schedule management endpoints
servers: []
security: []
paths:
  /api/schedules:
    post:
      tags:
        - Admin
      summary: Create schedule
      description: Creates a new scheduled job.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateScheduleRequest'
      responses:
        '201':
          description: Schedule created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  cronJobId:
                    type: string
                    nullable: true
                  message:
                    type: string
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Referenced secret not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    CreateScheduleRequest:
      type: object
      required:
        - name
        - cronSchedule
        - functionUrl
        - httpMethod
      properties:
        name:
          type: string
          minLength: 3
        cronSchedule:
          type: string
          description: 5-field cron expression or interval form (1-59 seconds)
        functionUrl:
          type: string
          format: uri
        httpMethod:
          type: string
          enum:
            - GET
            - POST
            - PUT
            - PATCH
            - DELETE
        headers:
          type: object
          additionalProperties:
            type: string
        body:
          type: object
    ErrorResponse:
      type: object
      required:
        - error
        - message
        - statusCode
      properties:
        error:
          type: string
        message:
          type: string
        statusCode:
          type: integer
        nextActions:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````