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

# Trigger Schedule

> Manually trigger a schedule to run immediately, regardless of its cron schedule. Creates a new job that will execute the HTTP request.



## OpenAPI

````yaml POST /schedules/{id}/trigger
openapi: 3.1.0
info:
  title: Cronhost API
  description: >-
    Schedule HTTP requests with cron expressions. Cronhost allows you to
    automate HTTP requests on a schedule using familiar cron syntax.
  license:
    name: MIT
  version: 1.0.0
  contact:
    name: Cronhost Support
    email: help@cronho.st
    url: https://cronho.st
servers:
  - url: https://cronho.st/api/v1
    description: Production API
security:
  - apiKeyAuth: []
tags:
  - name: Schedules
    description: Create, manage, and control scheduled HTTP requests
  - name: Jobs
    description: Monitor and retrieve job execution details
paths:
  /schedules/{id}/trigger:
    post:
      tags:
        - Schedules
      summary: Trigger Schedule
      description: >-
        Manually trigger a schedule to run immediately, regardless of its cron
        schedule. Creates a new job that will execute the HTTP request.
      operationId: triggerSchedule
      parameters:
        - name: id
          in: path
          required: true
          description: Unique schedule identifier
          schema:
            type: string
            example: schedule_123
      responses:
        '200':
          description: Schedule triggered successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Job'
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Schedule triggered successfully
                required:
                  - data
                  - success
                  - message
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    Job:
      type: object
      required:
        - id
        - scheduleId
        - status
        - scheduledRunAtUtc
        - attemptNumber
        - httpMethod
        - endpoint
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          description: Unique job identifier
          example: job_456
        scheduleId:
          type: string
          description: ID of the associated schedule
          example: schedule_123
        status:
          type: string
          enum:
            - PENDING
            - RUNNING
            - SUCCESS
            - FAILED
          description: Current job execution status
          example: SUCCESS
        scheduledRunAtUtc:
          type: string
          format: date-time
          description: When the job was scheduled to run
          example: '2024-01-14T14:00:00.000Z'
        attemptNumber:
          type: integer
          minimum: 1
          description: Current retry attempt (1-based)
          example: 1
        httpMethod:
          type: string
          enum:
            - GET
            - POST
            - PUT
            - DELETE
            - PATCH
          description: HTTP method used for the request
          example: GET
        endpoint:
          type: string
          format: uri
          description: Target endpoint URL
          example: https://api.example.com/health
        body:
          type: string
          nullable: true
          description: Request body (null for GET requests)
          example: '{"key": "value"}'
        headers:
          type: string
          nullable: true
          description: HTTP headers as JSON string
          example: '{"User-Agent": "Cronhost-Monitor"}'
        statusCode:
          type: integer
          nullable: true
          description: HTTP response status code (null if request failed)
          example: 200
        response:
          type: string
          nullable: true
          description: HTTP response body (null if request failed)
          example: '{"status": "ok"}'
        startedAtUtc:
          type: string
          format: date-time
          nullable: true
          description: When execution started
          example: '2024-01-14T14:00:01.000Z'
        completedAtUtc:
          type: string
          format: date-time
          nullable: true
          description: When execution completed
          example: '2024-01-14T14:00:02.500Z'
        errorMessage:
          type: string
          nullable: true
          description: Error details (null for successful jobs)
          example: Request timeout after 30 seconds
        createdAt:
          type: string
          format: date-time
          description: Job creation timestamp
          example: '2024-01-14T14:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
          example: '2024-01-14T14:00:02.500Z'
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - code
          properties:
            message:
              type: string
              description: Human-readable error message
            code:
              type: string
              description: Error code for programmatic handling
            details:
              description: Additional error details
  responses:
    UnauthorizedError:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            missingApiKey:
              summary: Missing API key
              value:
                error:
                  message: API key is required
                  code: MISSING_API_KEY
            invalidApiKey:
              summary: Invalid API key
              value:
                error:
                  message: Invalid API key
                  code: INVALID_API_KEY
    NotFoundError:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            scheduleNotFound:
              summary: Schedule not found
              value:
                error:
                  message: Schedule not found
                  code: NOT_FOUND
            jobNotFound:
              summary: Job not found
              value:
                error:
                  message: Job not found
                  code: NOT_FOUND
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            error:
              message: Internal server error
              code: INTERNAL_ERROR
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Get your API key from the [Cronhost
        dashboard](https://cronho.st/settings).

````