CircleCI Schedule API

Endpoints for creating, updating, and managing scheduled pipeline triggers.

OpenAPI Specification

circleci-schedule-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: CircleCI REST API v1 Artifact Schedule API
  description: The CircleCI REST API v1 is the legacy API that provides access to build information, project details, and user data. While still available, CircleCI recommends migrating to the v2 API for newer features and improved functionality. The v1 API supports operations for retrieving build details, triggering builds, managing SSH keys, and accessing test metadata. Authentication is handled through API tokens passed as query parameters or HTTP headers.
  version: '1.1'
  contact:
    name: CircleCI Support
    url: https://support.circleci.com
  termsOfService: https://circleci.com/terms-of-service/
servers:
- url: https://circleci.com/api/v1.1
  description: CircleCI Production API v1.1
security:
- apiToken: []
tags:
- name: Schedule
  description: Endpoints for creating, updating, and managing scheduled pipeline triggers.
paths:
  /project/{project-slug}/schedule:
    get:
      operationId: listSchedules
      summary: List schedules for a project
      description: Returns a list of scheduled pipeline triggers for a given project.
      tags:
      - Schedule
      parameters:
      - $ref: '#/components/parameters/ProjectSlugParam'
      - $ref: '#/components/parameters/PageTokenParam'
      responses:
        '200':
          description: Successfully retrieved schedules
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduleList'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    post:
      operationId: createSchedule
      summary: Create a schedule
      description: Creates a scheduled pipeline trigger for the specified project.
      tags:
      - Schedule
      parameters:
      - $ref: '#/components/parameters/ProjectSlugParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateScheduleRequest'
      responses:
        '201':
          description: Schedule created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Schedule'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /schedule/{schedule-id}:
    get:
      operationId: getSchedule
      summary: Get a schedule by ID
      description: Returns a schedule by its unique identifier.
      tags:
      - Schedule
      parameters:
      - $ref: '#/components/parameters/ScheduleIdParam'
      responses:
        '200':
          description: Successfully retrieved schedule
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Schedule'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Schedule not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    patch:
      operationId: updateSchedule
      summary: Update a schedule
      description: Updates an existing schedule with the provided parameters.
      tags:
      - Schedule
      parameters:
      - $ref: '#/components/parameters/ScheduleIdParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateScheduleRequest'
      responses:
        '200':
          description: Schedule updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Schedule'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    delete:
      operationId: deleteSchedule
      summary: Delete a schedule
      description: Deletes a schedule by its unique identifier.
      tags:
      - Schedule
      parameters:
      - $ref: '#/components/parameters/ScheduleIdParam'
      responses:
        '200':
          description: Schedule deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    MessageResponse:
      type: object
      properties:
        message:
          type: string
          description: A message describing the result of the operation
    Timetable:
      type: object
      required:
      - per-hour
      - hours-of-day
      - days-of-week
      properties:
        per-hour:
          type: integer
          minimum: 1
          maximum: 60
          description: Number of times per hour to trigger
        hours-of-day:
          type: array
          items:
            type: integer
            minimum: 0
            maximum: 23
          description: Hours of the day to trigger (UTC)
        days-of-week:
          type: array
          items:
            type: string
            enum:
            - MON
            - TUE
            - WED
            - THU
            - FRI
            - SAT
            - SUN
          description: Days of the week to trigger
        days-of-month:
          type: array
          items:
            type: integer
            minimum: 1
            maximum: 31
          description: Days of the month to trigger
        months:
          type: array
          items:
            type: string
            enum:
            - JAN
            - FEB
            - MAR
            - APR
            - MAY
            - JUN
            - JUL
            - AUG
            - SEP
            - OCT
            - NOV
            - DEC
          description: Months to trigger
    CreateScheduleRequest:
      type: object
      required:
      - name
      - timetable
      - attribution-actor
      - parameters
      properties:
        name:
          type: string
          description: The name of the schedule
        description:
          type: string
          description: The description of the schedule
        timetable:
          $ref: '#/components/schemas/Timetable'
        attribution-actor:
          type: string
          enum:
          - current
          - system
          description: Who to attribute pipeline triggers to
        parameters:
          type: object
          additionalProperties: true
          description: Pipeline parameters for the schedule
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message
    ScheduleList:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Schedule'
          description: List of schedules
        next_page_token:
          type: string
          description: Token for retrieving the next page
    Schedule:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The unique identifier of the schedule
        name:
          type: string
          description: The name of the schedule
        description:
          type: string
          description: The description of the schedule
        timetable:
          $ref: '#/components/schemas/Timetable'
        parameters:
          type: object
          additionalProperties: true
          description: Pipeline parameters for the schedule
        project_slug:
          type: string
          description: The project slug
        actor:
          type: object
          properties:
            id:
              type: string
              format: uuid
              description: The actor ID
            login:
              type: string
              description: The actor login
            name:
              type: string
              description: The actor name
          description: The user who created the schedule
        created_at:
          type: string
          format: date-time
          description: When the schedule was created
        updated_at:
          type: string
          format: date-time
          description: When the schedule was last updated
    UpdateScheduleRequest:
      type: object
      properties:
        name:
          type: string
          description: The name of the schedule
        description:
          type: string
          description: The description of the schedule
        timetable:
          $ref: '#/components/schemas/Timetable'
        attribution-actor:
          type: string
          enum:
          - current
          - system
          description: Who to attribute pipeline triggers to
        parameters:
          type: object
          additionalProperties: true
          description: Pipeline parameters for the schedule
  parameters:
    ProjectSlugParam:
      name: project-slug
      in: path
      required: true
      description: The project slug in the form vcs-slug/org-name/repo-name (e.g., gh/CircleCI-Public/api-preview-docs)
      schema:
        type: string
    PageTokenParam:
      name: page-token
      in: query
      description: Token for retrieving the next page of results
      schema:
        type: string
    ScheduleIdParam:
      name: schedule-id
      in: path
      required: true
      description: The unique identifier of the schedule
      schema:
        type: string
        format: uuid
  securitySchemes:
    apiToken:
      type: apiKey
      in: header
      name: Circle-Token
      description: Personal API token for authenticating with the CircleCI API. Can also be passed as a query parameter.
externalDocs:
  description: CircleCI API v1 Reference
  url: https://circleci.com/docs/api/v1/