openapi: 3.1.0
servers:
  - description: Sakari Externals API
    url: https://external.sakari.io
info:
  description: >
    For more information about Sakari, visit
    [https://sakari.io](https://sakari.io).
  version: 1.0.0
  title: Sakari
  termsOfService: https://sakari.io/terms-service.html
  contact:
    email: help@sakari.io
tags:
  - name: meetings
    description: Book, reschedule or cancel meetings
paths:
  /forms/v1/{id}:
    get:
      operationId: forms.fetch
      summary: Fetch form
      tags:
        - forms
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FormResponse'
        4XX:
          $ref: '#/components/responses/4XX'
        5XX:
          $ref: '#/components/responses/5XX'
  /forms/v1/{id}/submissions/{impressionId}:
    post:
      operationId: forms.submit
      summary: Submit a form
      tags:
        - forms
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: impressionId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                fields:
                  type: object
                  additionalProperties:
                    type: string
              required:
                - fields
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FormSubmissionResponse'
        4XX:
          $ref: '#/components/responses/4XX'
        5XX:
          $ref: '#/components/responses/5XX'
  /meetingevents/v1/{slug}:
    get:
      tags:
        - externals.meetingevents
      summary: Fetch a meeting event
      operationId: externals.meetingevents.fetch
      parameters:
        - $ref: '#/components/parameters/slug'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MeetingEventResponse'
        4XX:
          $ref: '#/components/responses/4XX'
        5XX:
          $ref: '#/components/responses/5XX'
  /meetingevents/v1/{slug}/book:
    post:
      tags:
        - externals.meetingevents
      summary: Book a Meeting
      operationId: externals.meetings.create
      parameters:
        - $ref: '#/components/parameters/slug'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MeetingRequest'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MeetingResponse'
        4XX:
          $ref: '#/components/responses/4XX'
        5XX:
          $ref: '#/components/responses/5XX'
  /meetingevents/v1/{slug}/slots:
    get:
      tags:
        - externals.meetingevents
      summary: Get available timeslots
      operationId: externals.meetings.slots
      parameters:
        - $ref: '#/components/parameters/slug'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimeslotsResponse'
        4XX:
          $ref: '#/components/responses/4XX'
        5XX:
          $ref: '#/components/responses/5XX'
  /meetingevents/v1/{slug}/logo:
    get:
      tags:
        - externals.meetingevents
      summary: Get meeting event logo
      operationId: externals.meetings.logo
      parameters:
        - $ref: '#/components/parameters/slug'
      responses:
        '200':
          description: successful operation
          content:
            image/*:
              schema:
                type: string
                format: binary
        4XX:
          $ref: '#/components/responses/4XX'
        5XX:
          $ref: '#/components/responses/5XX'
  /meetingevents/v1/{slug}/cover:
    get:
      tags:
        - externals.meetingevents
      summary: Get meeting event cover
      operationId: externals.meetings.cover
      parameters:
        - $ref: '#/components/parameters/slug'
      responses:
        '200':
          description: successful operation
          content:
            image/*:
              schema:
                type: string
                format: binary
        4XX:
          $ref: '#/components/responses/4XX'
        5XX:
          $ref: '#/components/responses/5XX'
  /meetings/v1/{meetingId}:
    get:
      tags:
        - externals.meetings
      summary: Fetch a Meeting
      operationId: externals.meetings.fetch
      parameters:
        - $ref: '#/components/parameters/meetingId'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MeetingResponse'
        4XX:
          $ref: '#/components/responses/4XX'
        5XX:
          $ref: '#/components/responses/5XX'
    put:
      tags:
        - externals.meetings
      summary: Reschedule a Meeting
      operationId: externals.meetings.reschedule
      parameters:
        - $ref: '#/components/parameters/meetingId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MeetingRequest'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MeetingResponse'
        4XX:
          $ref: '#/components/responses/4XX'
        5XX:
          $ref: '#/components/responses/5XX'
    delete:
      tags:
        - externals.meetings
      summary: Cancel a Meeting
      operationId: externals.meetings.cancel
      parameters:
        - $ref: '#/components/parameters/meetingId'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BasicResponse'
        4XX:
          $ref: '#/components/responses/4XX'
        5XX:
          $ref: '#/components/responses/5XX'
components:
  parameters:
    meetingId:
      name: meetingId
      in: path
      required: true
      description: The ID of the meeting
      schema:
        type: string
    slug:
      name: slug
      in: path
      required: true
      description: The slug of the meeting event
      schema:
        type: string
  schemas:
    BasicResponse:
      type: object
      properties:
        success:
          type: boolean
      required:
        - success
    Error:
      type: object
      properties:
        code:
          type: string
          example: CONT-010
        description:
          type: string
          example: Contact has requested no further communication
      required:
        - code
        - description
    ErrorResponse:
      allOf:
        - $ref: '#/components/schemas/BasicResponse'
        - type: object
          properties:
            error:
              $ref: '#/components/schemas/Error'
      required:
        - error
    Pagination:
      type: object
      properties:
        limit:
          type: integer
        offset:
          type: integer
        hasNext:
          type: boolean
      required:
        - limit
        - offset
        - hasNext
    PaginatedResponse:
      allOf:
        - $ref: '#/components/schemas/BasicResponse'
        - type: object
          properties:
            pagination:
              $ref: '#/components/schemas/Pagination'
      required:
        - pagination
    Hours:
      type: object
      properties:
        start:
          $ref: '#/components/schemas/Hours/properties/end'
        end:
          type: object
          properties:
            hour:
              type: number
            minute:
              type: number
          required:
            - hour
            - minute
      required:
        - start
        - end
    InternationalNumber:
      type: object
      properties:
        country:
          type: string
        number:
          type: string
          example: 123-456-7890
        verified:
          type: string
          format: date-time
        valid:
          type: boolean
        lineType:
          type: string
          example: mobile
      required:
        - country
        - number
    Form:
      type: object
      properties:
        id:
          type: string
          readOnly: true
        name:
          type: string
        active:
          type: string
          format: date-time
          readOnly: true
        views:
          type: object
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/FormField'
        styling:
          type: object
          additionalProperties:
            type: string
        settings:
          $ref: '#/components/schemas/FormSettings'
      required:
        - id
        - name
    FormField:
      type: object
      properties:
        name:
          type: string
        color:
          type: string
        bgColor:
          type: string
        value:
          type: string
        type:
          type: string
        mandatory:
          type: boolean
        size:
          type: string
      required:
        - name
        - type
    FormSettings:
      type: object
      properties:
        list:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
          required:
            - id
        trigger:
          type: number
        repeat:
          type: number
        display:
          type: object
          properties:
            start:
              type: string
              format: date-time
            end:
              type: string
              format: date-time
    FormSubmission:
      properties:
        mobile:
          $ref: '#/components/schemas/InternationalNumber'
        email:
          type: string
        firstName:
          type: string
        lastName:
          type: string
        consent:
          type: boolean
    FormResponse:
      allOf:
        - $ref: '#/components/schemas/BasicResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/Form'
      required:
        - data
    FormSubmissionResponse:
      allOf:
        - $ref: '#/components/schemas/BasicResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/Form'
      required:
        - data
    Meeting:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        notes:
          type: string
        status:
          type: string
          enum:
            - upcoming
            - confirmed
            - cancelled
        hosts:
          type: array
          items:
            allOf:
              - type: object
                properties:
                  id:
                    type: string
                    readOnly: true
                  email:
                    type: string
                    example: chris@sakari.io
                  firstName:
                    type: string
                    example: Chris
                  lastName:
                    type: string
                    example: Bloggs
                  mobile:
                    $ref: '#/components/schemas/InternationalNumber'
            required:
              - id
        attendees:
          type: array
          items:
            $ref: '#/components/schemas/Meeting/properties/hosts/items'
        rescheduleLink:
          type: string
        cancelLink:
          type: string
      required:
        - id
        - name
        - start
        - end
    MeetingRequest:
      type: object
      properties:
        start:
          type: string
          format: date-time
        duration:
          type: number
        attendees:
          type: array
          items:
            type: object
            properties:
              firstName:
                type: string
              lastName:
                type: string
              email:
                type: string
              mobile:
                $ref: '#/components/schemas/InternationalNumber'
        notes:
          type: string
      required:
        - start
        - duration
        - attendees
    MeetingResponse:
      allOf:
        - $ref: '#/components/schemas/BasicResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/Meeting'
      required:
        - data
    MeetingEvent:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        slug:
          type: string
        description:
          type: string
        durations:
          type: array
          items:
            type: number
        allowAdditionalAttendees:
          type: boolean
        hosts:
          type: array
          items:
            $ref: '#/components/schemas/Meeting/properties/hosts/items'
        styling:
          type: object
          properties:
            logo:
              type: string
            cover:
              type: string
        availability:
          type: object
          properties:
            timezone:
              type: string
            times:
              type: object
              properties:
                sun:
                  type: array
                  items:
                    $ref: '#/components/schemas/Hours'
                mon:
                  type: array
                  items:
                    $ref: '#/components/schemas/Hours'
                tue:
                  type: array
                  items:
                    $ref: '#/components/schemas/Hours'
                wed:
                  type: array
                  items:
                    $ref: '#/components/schemas/Hours'
                thu:
                  type: array
                  items:
                    $ref: '#/components/schemas/Hours'
                fri:
                  type: array
                  items:
                    $ref: '#/components/schemas/Hours'
                sat:
                  type: array
                  items:
                    $ref: '#/components/schemas/Hours'
          required:
            - timezone
            - times
        bufferTime:
          type: number
        minimumNotice:
          type: number
        enabled:
          type: boolean
      required:
        - name
        - slug
        - durations
        - hosts
    MeetingEventResponse:
      allOf:
        - $ref: '#/components/schemas/BasicResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/MeetingEvent'
      required:
        - data
    TimeslotsResponse:
      allOf:
        - $ref: '#/components/schemas/BasicResponse'
        - type: object
          properties:
            data:
              type: array
              items:
                type: string
                format: date-time
      required:
        - data
  responses:
    4XX:
      description: invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    5XX:
      description: invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
