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

# Get a schedule

> Get a schedule by its ID.



## OpenAPI

````yaml https://api.shiftkeeper.io/openapi.json get /schedules/{schedule_id}
openapi: 3.1.0
info:
  title: Shiftkeeper API
  description: API reference to interact with Shiftkeeper programatically
  version: 0.0.1
servers:
  - url: https://api.shiftkeeper.io
security:
  - apiKey: []
externalDocs:
  url: https://docs.shiftkeeper.io
  description: Learn more about Shiftkeeper
paths:
  /schedules/{schedule_id}:
    get:
      tags:
        - Schedules
      summary: Get a schedule
      description: Get a schedule by its ID.
      parameters:
        - schema:
            type: string
          examples:
            sch_oKjoLJUl47g7OYYVPUG5t:
              value: sch_oKjoLJUl47g7OYYVPUG5t
            sch_kje7ER643ED0STVnB8Zc9:
              value: sch_kje7ER643ED0STVnB8Zc9
          in: path
          name: schedule_id
          required: true
          description: The ID of the schedule.
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  schedule:
                    $ref: '#/components/schemas/Schedule'
                required:
                  - schedule
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/NotFoundError'
                required:
                  - error
components:
  schemas:
    Schedule:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 60
          description: The name of the schedule.
        description:
          type: string
          maxLength: 200
          description: The description of the schedule.
        time_zone:
          type: string
          description: The IANA time zone of the schedule.
        layers:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleLayer'
          description: The layers of the schedule.
        teams:
          type: array
          items:
            $ref: '#/components/schemas/Team'
          description: The teams linked to the schedule.
        current_revision:
          type: integer
          minimum: 0
          description: >-
            The current revision of the schedule. A new revision is created
            every time the schedule layer configuration is changed.
        current_revision_valid_from:
          type: string
          format: date-time
          description: The timestamp that marks the start of the current revision.
        current_oncall_shift:
          $ref: '#/components/schemas/ScheduleShift'
          description: The current on-call shift for the schedule.
        next_oncall_shift:
          $ref: '#/components/schemas/ScheduleShift'
          description: The next on-call shift for the schedule.
        users:
          type: array
          items:
            $ref: '#/components/schemas/User'
          description: >-
            The users in the schedule. The order does not necessarily match
            rotation order.
      required:
        - name
        - time_zone
        - layers
        - teams
        - current_revision
        - current_revision_valid_from
        - users
      examples:
        - name: Incident responders
          description: Incident responders
          time_zone: Europe/Berlin
          layers:
            - name: Main
              rotation_start: '2024-01-01T00:00:00Z'
              concurrent_oncall_users: 1
              users:
                - id: usr_bq7CmsOKLmkMeZkUUu1hy
                  name: Rick
                  email: rick@example.org
                  time_zone: Europe/Paris
                  role: owner
                  seat: member
                  slack_id: U082KENSEQ3
                - id: usr_C0GwCFdk0I4pBMRny4qYV
                  name: Dena
                  email: dena@example.org
                  role: standard
                  seat: member
                  slack_id: U082GMAFR1T
                - id: usr_YlxrjoB1JqUsollScfFYT
                  name: Lily
                  email: lily@example.org
                  time_zone: America/New_York
                  role: standard
                  seat: viewer
                  slack_id: U0529FWNCG2
              shift_length:
                amount: 1
                unit: weeks
              restriction_intervals: []
          current_revision: 1
          current_revision_valid_from: '2024-12-01T00:00:00Z'
          current_oncall_shift:
            users:
              - id: usr_bq7CmsOKLmkMeZkUUu1hy
                name: Rick
                email: rick@example.org
                time_zone: Europe/Paris
                role: owner
                seat: member
                slack_id: U082KENSEQ3
            start: '2024-01-01T00:00:00Z'
            end: '2024-01-01T01:00:00Z'
          next_oncall_shift:
            users:
              - id: usr_C0GwCFdk0I4pBMRny4qYV
                name: Dena
                email: dena@example.org
                role: standard
                seat: member
                slack_id: U082GMAFR1T
            start: '2024-01-01T01:00:00Z'
            end: '2024-01-01T02:00:00Z'
          users:
            - id: usr_bq7CmsOKLmkMeZkUUu1hy
              name: Rick
              email: rick@example.org
              time_zone: Europe/Paris
              role: owner
              seat: member
              slack_id: U082KENSEQ3
            - id: usr_C0GwCFdk0I4pBMRny4qYV
              name: Dena
              email: dena@example.org
              role: standard
              seat: member
              slack_id: U082GMAFR1T
            - id: usr_YlxrjoB1JqUsollScfFYT
              name: Lily
              email: lily@example.org
              time_zone: America/New_York
              role: standard
              seat: viewer
              slack_id: U0529FWNCG2
          teams:
            - id: tea_VJ4sYEOOXVvJBXqFjRzpm
              name: Payments
              description: All about payments and billing
    NotFoundError:
      type: object
      properties:
        message:
          type: string
        docs_url:
          type: string
        status:
          type: number
          const: 404
        code:
          type: string
          const: not_found
      required:
        - message
        - status
        - code
      example:
        code: not_found
        status: 404
        message: The requested resource was not found
    ScheduleLayer:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 60
          description: The name of the schedule layer.
        rotation_start:
          type: string
          format: date-time
          description: >-
            The start date and time of the rotation. ISO 8601 format, UTC
            timezone.
        concurrent_oncall_users:
          type: integer
          minimum: 1
          maximum: 4
          description: The number of concurrent on-call users for this layer.
        users:
          type: array
          items:
            $ref: '#/components/schemas/User'
          description: >-
            The rotation users in the schedule layer. The order of the users in
            the array determines the round-robin rotation order. A user can
            appear multiple times in the rotation.
        shift_length:
          type: object
          properties:
            amount:
              type: integer
              minimum: 1
            unit:
              type: string
              enum:
                - hours
                - days
                - weeks
          required:
            - amount
            - unit
          description: Determines how often shifts are rotated.
        restriction_intervals:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleLayerRestrictionInterval'
          maxItems: 35
          description: >-
            Determines the time intervals that the layer is restricted to.
            Useful if you want to limit the on-call hours to specific times,
            e.g., only during business hours. If not provided, the layer is
            unrestricted and covers everyday of the week.
      required:
        - name
        - rotation_start
        - concurrent_oncall_users
        - users
        - shift_length
    Team:
      type: object
      properties:
        id:
          type: string
          description: The ID of the team.
        name:
          type: string
          minLength: 1
          maxLength: 60
          description: The name of the team.
        description:
          type: string
          maxLength: 200
          description: The description of the team.
      required:
        - id
        - name
      examples:
        - id: tea_VJ4sYEOOXVvJBXqFjRzpm
          name: Payments
          description: All about payments and billing
    ScheduleShift:
      type: object
      properties:
        users:
          type: array
          items:
            $ref: '#/components/schemas/User'
          description: The users on-call for this shift.
        start:
          type: string
          format: date-time
          description: The start time of the on-call shift.
        end:
          type: string
          format: date-time
          description: The end time of the on-call shift.
      required:
        - users
        - start
        - end
    User:
      type: object
      properties:
        id:
          type: string
          description: The ID of the user.
        name:
          type: string
          description: The name of the user.
        email:
          type: string
          format: email
          description: The email of the user.
        time_zone:
          type: string
          description: >-
            The preferred time zone of the user. If not set, the organization's
            time zone will be used.
        role:
          type: string
          enum:
            - owner
            - standard
          description: >-
            The role of the user. Learn more about roles in [our
            docs](/shiftkeeper/workspace/users#roles).
        seat:
          type: string
          enum:
            - viewer
            - member
          description: >-
            The seat of the user. Learn more about seat in [our
            docs](/shiftkeeper/workspace/users#seats).
        slack_id:
          type: string
          description: The Slack ID of the user.
      required:
        - id
        - name
        - email
        - role
        - seat
      examples:
        - id: usr_bq7CmsOKLmkMeZkUUu1hy
          name: Rick
          email: rick@example.org
          time_zone: Europe/Paris
          role: owner
          seat: member
          slack_id: U082KENSEQ3
        - id: usr_C0GwCFdk0I4pBMRny4qYV
          name: Dena
          email: dena@example.org
          role: standard
          seat: member
          slack_id: U082GMAFR1T
        - id: usr_YlxrjoB1JqUsollScfFYT
          name: Lily
          email: lily@example.org
          time_zone: America/New_York
          role: standard
          seat: viewer
          slack_id: U0529FWNCG2
    ScheduleLayerRestrictionInterval:
      type: object
      properties:
        day:
          type: string
          enum:
            - monday
            - tuesday
            - wednesday
            - thursday
            - friday
            - saturday
            - sunday
          description: The day of the restriction interval.
        from:
          type: string
          description: The start time of the restriction interval.
        to:
          type: string
          description: The end time of the restriction interval.
      required:
        - day
        - from
        - to
      examples:
        - day: monday
          from: '09:00'
          to: '17:00'
        - day: tuesday
          from: '09:00'
          to: '17:00'
        - day: wednesday
          from: '09:00'
          to: '17:00'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Enter your API key which starts with 'keeper_'

````