> ## 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.

# Request coverage

> Create a new coverage request for the authenticated user.



## OpenAPI

````yaml https://api.shiftkeeper.io/openapi.json post /user/coverage_requests/
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:
  /user/coverage_requests/:
    post:
      tags:
        - Coverage
      summary: Request coverage
      description: Create a new coverage request for the authenticated user.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewCoverageRequest'
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  coverage_request:
                    $ref: '#/components/schemas/CoverageRequest'
                required:
                  - coverage_request
        '422':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      docs_url:
                        type: string
                      status:
                        type: number
                        enum:
                          - 422
                      code:
                        type: string
                        enum:
                          - too_many_shifts_in_coverage_request
                    required:
                      - message
                      - status
                      - code
                    example:
                      code: unprocessable_entity
                      status: 422
                      message: The request cannot be processed
                required:
                  - error
              example:
                error:
                  code: too_many_shifts_in_coverage_request
                  message: >-
                    A coverage request can have a maximum of 500 shifts. Please
                    select a shorter period for your coverage request.
                  status: 422
                  docs_url: >-
                    https://docs.shiftkeeper.io/api-reference/errors#too-many-shifts-in-coverage-request
components:
  schemas:
    NewCoverageRequest:
      type: object
      properties:
        start:
          type: string
          format: date-time
          description: The start date and time of the interval you need coverage for.
        end:
          type: string
          format: date-time
          description: The end date and time of the interval you need coverage for.
        reason:
          type: string
          minLength: 1
          maxLength: 300
          description: The reason you need coverage.
        schedule_ids:
          type: array
          items:
            type: string
          description: >-
            You can optionally limit the coverage request to specific schedules.
            If not provided, the coverage request will include all schedules you
            are a member of.
      required:
        - start
        - end
        - reason
      examples:
        - start: '2024-12-01T00:00:00Z'
          end: '2024-12-08T00:00:00Z'
          reason: >-
            I will be out of office during this week. Could someone jump in to
            cover these shifts?
          schedule_ids:
            - sch_KR5uoK0xD0rWQoKTDqwgu
            - sch_ldYmnBVr5o2ikebwmRRZv
    CoverageRequest:
      type: object
      properties:
        id:
          type: string
          description: The ID of the coverage request.
        reason:
          type: string
          description: The reason for the coverage request.
        user:
          $ref: '#/components/schemas/User'
        status:
          type: string
          enum:
            - pending
            - accepted
            - canceled
            - expired
        shifts:
          type: array
          items:
            $ref: '#/components/schemas/CoverageShift'
        accepted_by:
          $ref: '#/components/schemas/User'
        accepted_shifts:
          type: array
          items:
            $ref: '#/components/schemas/CoverageShift'
      required:
        - id
        - reason
        - user
        - status
        - shifts
      examples:
        - id: cov_RxQottluZ1oeM47nz4bVl
          user:
            id: usr_bq7CmsOKLmkMeZkUUu1hy
            name: Rick
            email: rick@example.org
            time_zone: Europe/Paris
            role: owner
            seat: member
            slack_id: U082KENSEQ3
          reason: >-
            I will be out of office during this week. Could someone jump in to
            cover these shifts?
          status: pending
          shifts:
            - start: '2024-12-02T09:00:00Z'
              end: '2024-12-02T17:00:00Z'
              schedule_reference:
                id: sch_KR5uoK0xD0rWQoKTDqwgu
                name: Portal support
            - start: '2024-12-03T09:00:00Z'
              end: '2024-12-03T17:00:00Z'
              schedule_reference:
                id: sch_KR5uoK0xD0rWQoKTDqwgu
                name: Portal support
            - start: '2024-12-04T09:00:00Z'
              end: '2024-12-04T17:00:00Z'
              schedule_reference:
                id: sch_KR5uoK0xD0rWQoKTDqwgu
                name: Portal support
            - start: '2024-12-05T09:00:00Z'
              end: '2024-12-05T17:00:00Z'
              schedule_reference:
                id: sch_KR5uoK0xD0rWQoKTDqwgu
                name: Portal support
            - start: '2024-12-06T09:00:00Z'
              end: '2024-12-06T17:00:00Z'
              schedule_reference:
                id: sch_KR5uoK0xD0rWQoKTDqwgu
                name: Portal support
            - start: '2024-12-01T00:00:00Z'
              end: '2024-12-08T00:00:00Z'
              schedule_reference:
                id: sch_ldYmnBVr5o2ikebwmRRZv
                name: Citadel
    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
    CoverageShift:
      type: object
      properties:
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        schedule_reference:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
          required:
            - id
            - name
      required:
        - start
        - end
        - schedule_reference
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Enter your API key which starts with 'keeper_'

````