7shifts Time Off API

Time off requests and approvals.

OpenAPI Specification

7shifts-time-off-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: 7shifts Availability Time Off API
  version: '2.0'
  description: 7shifts is a restaurant employee scheduling, time-tracking, and team management platform. The 7shifts API v2 is a REST API for managing companies, locations, departments, roles, users (employees), schedules, shifts, time punches, wages, time off, availability, sales receipts, forecasts, tasks, tip pools, and webhooks. Authentication uses Bearer access tokens for internal access or OAuth 2.0 client credentials for partner integrations. Endpoints documented here were confirmed from the 7shifts developer reference (developers.7shifts.com) and its llms.txt index. Most resources are scoped to a company via the /v2/company/{company_id} path prefix. Collection endpoints use cursor-based pagination via the cursor and limit query parameters. Date-based API versions are selected with the x-api-version header (YYYY-MM-DD).
  contact:
    name: 7shifts Developer Portal
    url: https://developers.7shifts.com/reference/introduction
  license:
    name: 7shifts API Terms
    url: https://www.7shifts.com/legal/terms-of-service
servers:
- url: https://api.7shifts.com
  description: 7shifts API production base URL
tags:
- name: Time Off
  description: Time off requests and approvals.
paths:
  /v2/company/{company_id}/time_off:
    get:
      tags:
      - Time Off
      operationId: listTimeOff
      summary: List Time Off
      parameters:
      - $ref: '#/components/parameters/CompanyIdPath'
      - name: user_id
        in: query
        required: false
        description: Filter by user.
        schema:
          type: integer
          format: int64
      - name: status
        in: query
        required: false
        description: Filter by request status.
        schema:
          type: string
          enum:
          - pending
          - approved
          - declined
      - $ref: '#/components/parameters/Cursor'
      - $ref: '#/components/parameters/Limit'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/TimeOff'
                  meta:
                    $ref: '#/components/schemas/CursorMeta'
      security:
      - bearerAuth: []
    post:
      tags:
      - Time Off
      operationId: createTimeOff
      summary: Create Time Off
      parameters:
      - $ref: '#/components/parameters/CompanyIdPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TimeOff'
      responses:
        '201':
          description: Created
      security:
      - bearerAuth: []
  /v2/company/{company_id}/time_off/{time_off_id}/approve:
    post:
      tags:
      - Time Off
      operationId: approveTimeOff
      summary: Approve Time Off Request
      parameters:
      - $ref: '#/components/parameters/CompanyIdPath'
      - name: time_off_id
        in: path
        required: true
        description: Time off request identifier.
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: Approved
        '404':
          description: Not found
      security:
      - bearerAuth: []
components:
  parameters:
    Cursor:
      name: cursor
      in: query
      required: false
      description: Pagination cursor for the next or previous page.
      schema:
        type: string
    CompanyIdPath:
      name: company_id
      in: path
      required: true
      description: Company identifier.
      schema:
        type: integer
        format: int64
    Limit:
      name: limit
      in: query
      required: false
      description: Results per page (1-500, default 100; 20 for some collections).
      schema:
        type: integer
        minimum: 1
        maximum: 500
        default: 100
  schemas:
    CursorMeta:
      title: Cursor Meta
      type: object
      description: Cursor-based pagination metadata.
      properties:
        cursor:
          type: object
          properties:
            current:
              type: string
            next:
              type: string
              nullable: true
            prev:
              type: string
              nullable: true
        count:
          type: integer
    TimeOff:
      title: Time Off
      type: object
      properties:
        id:
          type: integer
          format: int64
        user_id:
          type: integer
          format: int64
        status:
          type: string
          enum:
          - pending
          - approved
          - declined
        from_date:
          type: string
          format: date
        to_date:
          type: string
          format: date
        partial:
          type: boolean
        category:
          type: string
        comments:
          type: string
        created:
          type: string
          format: date-time
        modified:
          type: string
          format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Access token obtained from /oauth2/token passed as a Bearer token.
    oauth2:
      type: oauth2
      description: OAuth 2.0 with client_credentials, password, authorization_code, and refresh_token grant types.
      flows:
        clientCredentials:
          tokenUrl: https://api.7shifts.com/oauth2/token
          scopes: {}