openapi: 3.0.2
info:
  version: "1.0.0"
  title: CRM API
  description: |-

servers:
  # Added by API Auto Mocking Plugin
  - description: SwaggerHub API Auto Mocking
    url: "https://your-crm-domain.com"
  - url: "https://your-crm-domain.com/api/v1"
    description: Development
  - url: "https://your-crm-domain.com/api/v1"
    description: Production
  - url: https://localhost/api/v1
    description: Test server

tags:
  - name: public
    description: Public methods
  - name: auth
    description: Authorization
  - name: common
    description: Common information
  - name: contacts
    description: Contacts
  - name: organizations
    description: Organizations
  - name: purchases
    description: Purchases
  - name: calendar
    description: Calendar
  - name: support
    description: Support
  - name: activities
    description: Activities
  - name: my account
    description: My Account
  - name: files
    description: Files & Media
  - name: company
    description: Company data and company general information
  - name: social
    description: Social networks
  - name: content
    description: Content for sharing
  - name: templates
    description: Templates

paths:

  /login:
    post:
      tags:
        - auth
      summary: Receive access token
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                login:
                  type: string
                  minLength: 3
                  maxLength: 255
                  description: Login or email
                password:
                  type: string
                  format: password
                  minLength: 3
                  maxLength: 255
                device_name:
                  type: string
                  description: Name of the device (i.e. iPhone 14)
                  maxLength: 255
              required:
                - login
                - password
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                properties:
                  access_token:
                    type: string
                    description: access token for using in header
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "401":
          description: Wrong login or password
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: It is forbidden to use the mobile app for this user
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /reset-password:
    post:
      tags:
        - auth
      summary: Generate a reset link and send it to the specified email
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  minLength: 3
                  maxLength: 255
                  description: Login or email
                password:
                  type: string
                  format: password
                  minLength: 3
                  maxLength: 255
              required:
                - login
                - password
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "401":
          description: Wrong login or password
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: It is forbidden to use the mobile app for this user
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /logout:
    post:
      tags:
        - auth
      summary: Log out and destroy current access token
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  #---------------------------------------------------------------------------------------------------------------------

  /common/app-state:
    get:
      tags:
        - common
      summary: Current state of the app (should be loaded on every screen change to update badges etc)
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  badges:
                    description: Badges data
                    type: object
                    properties:
                      new_activities:
                        description: Number for activities tab
                        type: integer
                        default: 0
                      unread_emails:
                        description: Unread messages
                        type: integer
                        default: 0
                      unread_sms:
                        description: Unread text messages
                        type: integer
                        default: 0
                      unread_messages:
                        description: Unread email messages
                        type: integer
                        default: 0
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /common/app-user-settings:
    get:
      tags:
        - common
      summary: General app settings for current user (should be loaded once at every launch)
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  twilio:
                    description: Twilio data
                    type: object
                    properties:
                      AccountSid:
                        type: string
                      AuthToken:
                        type: string
                      from_number:
                        type: string
                      twiml_app_sid:
                        type: string
                      json_token_url:
                        type: string
                      json_access_token_url:
                        type: string
                  default_status_view:
                    description: Default Stage View (affects the availability of the stage and status dropdowns on the Contacts and Companies Sections)
                    type: string
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /dashboard:
    get:
      tags:
        - common
      parameters:
        - in: query
          name: interval
          required: false
          description: Interval to display statisticts
          schema:
            type: string
            default: day
            enum:
              - day
              - week
              - two_weeks
              - month
      summary: Dashboard (Statistic Tab)
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  statuses:
                    description: Information about pipelines
                    type: object
                    properties:
                      customers:
                        description: Information for pipeline status `customers`
                        type: object
                        properties:
                          title:
                            type: string
                            description: title of pipeline status `customer`
                          received:
                            description: Count of stage `received`
                            type: object
                            properties:
                              title:
                                description: Title of stage `received`
                                type: string
                              value:
                                description: count with stage `received`
                                type: integer
                          contact:
                            description: Count of stage `contact`
                            type: object
                            properties:
                              title:
                                description: Title of stage `contact`
                                type: string
                              value:
                                description: count with stage `contact`
                                type: integer
                          appointment:
                            description: Count of stage `appointment`
                            type: object
                            properties:
                              title:
                                description: Title of stage `appointment`
                                type: string
                              value:
                                description: count with stage `appointment`
                                type: integer
                          sold:
                            description: Count of stage `sold`
                            type: object
                            properties:
                              title:
                                description: Title of stage `sold`
                                type: string
                              value:
                                description: count with stage `sold`
                                type: integer
                          lost:
                            description: Count of stage `lost`
                            type: object
                            properties:
                              title:
                                description: Title of stage `lost`
                                type: string
                              value:
                                description: count with stage `lost`
                                type: integer
                      opportunities:
                        description: Information for pipeline status `opportunities`
                        type: object
                        properties:
                          title:
                            type: string
                            description: title of pipeline status `opportunities`
                          received:
                            description: Count of stage `received`
                            type: object
                            properties:
                              title:
                                description: Title of stage `received`
                                type: string
                              value:
                                description: count with stage `received`
                                type: integer
                          contact:
                            description: Count of stage `contact`
                            type: object
                            properties:
                              title:
                                description: Title of stage `contact`
                                type: string
                              value:
                                description: count with stage `contact`
                                type: integer
                          appointment:
                            description: Count of stage `appointment`
                            type: object
                            properties:
                              title:
                                description: Title of stage `appointment`
                                type: string
                              value:
                                description: count with stage `appointment`
                                type: integer
                          sold:
                            description: Count of stage `sold`
                            type: object
                            properties:
                              title:
                                description: Title of stage `sold`
                                type: string
                              value:
                                description: count with stage `sold`
                                type: integer
                          lost:
                            description: Count of stage `lost`
                            type: object
                            properties:
                              title:
                                description: Title of stage `lost`
                                type: string
                              value:
                                description: count with stage `lost`
                                type: integer
                      leads:
                        description: Information for pipeline status `leads`
                        type: object
                        properties:
                          title:
                            type: string
                            description: title of pipeline status `leads`
                          received:
                            description: Count of stage `received`
                            type: object
                            properties:
                              title:
                                description: Title of stage `received`
                                type: string
                              value:
                                description: count with stage `received`
                                type: integer
                          contact:
                            description: Count of stage `contact`
                            type: object
                            properties:
                              title:
                                description: Title of stage `contact`
                                type: string
                              value:
                                description: count with stage `contact`
                                type: integer
                          appointment:
                            description: Count of stage `appointment`
                            type: object
                            properties:
                              title:
                                description: Title of stage `appointment`
                                type: string
                              value:
                                description: count with stage `appointment`
                                type: integer
                          sold:
                            description: Count of stage `sold`
                            type: object
                            properties:
                              title:
                                description: Title of stage `sold`
                                type: string
                              value:
                                description: count with stage `sold`
                                type: integer
                          lost:
                            description: Count of stage `lost`
                            type: object
                            properties:
                              title:
                                description: Title of stage `lost`
                                type: string
                              value:
                                description: count with stage `lost`
                                type: integer
                  calls:
                    description: Count of calls
                    type: object
                    properties:
                      incoming:
                        description: Incoming calls count
                        type: integer
                      outgoing:
                        description: Outgoing calls count
                        type: integer
                  emails:
                    description: Count of emails
                    type: object
                    properties:
                      incoming:
                        description: Incoming emails count
                        type: integer
                      outgoing:
                        description: Outgoing emails count
                        type: integer
                  sms:
                    description: Count of SMS messages
                    type: object
                    properties:
                      incoming:
                        description: Incoming SMS messages count
                        type: integer
                      outgoing:
                        description: Outgoing SMS messages count
                        type: integer
                  campaigns_stats:
                    description: Counts for campaigns overall statistics
                    type: object
                    properties:
                      opens:
                        description: Total opened
                        type: integer
                      clicks:
                        description: Total clicks
                        type: integer
                      unsubsribes:
                        description: Total unsubsribes
                        type: integer
                  campaigns_count:
                    description: Counts of campaigns
                    type: object
                    properties:
                      sent:
                        description: Total sent
                        type: integer
                      scheduled:
                        description: Total scheduled
                        type: integer
                      draft:
                        description: Total draft
                        type: integer
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /dashboard/calendar:
    get:
      tags:
        - common
      summary: Dashboard (Calendar Tab)
      security:
        - access_token: []
      parameters:
        - in: query
          name: year
          required: true
          description: Year (4 digits)
          schema:
            type: integer
        - in: query
          name: month
          required: true
          description: Month (1-12)
          schema:
            type: integer
        - in: query
          name: day
          required: true
          description: Day (1-31)
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: array
                items:
                  type: object
                  properties:
                    contact_id:
                      type: integer
                      description: ID of the contact
                    name:
                      type: string
                      description: Contact's Name
                    time:
                      type: string
                      description: Scheduled Time (W3C format)
                    note:
                      type: string
                      description: Note
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /search:
    get:
      tags:
        - common
      summary: Global search
      security:
        - access_token: []
      parameters:
        - in: query
          name: search
          required: true
          description: search query
          schema:
            type: string
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                properties:
                  contacts:
                    type: array
                    items:
                      $ref: "#/components/schemas/ContactBrief"
                  organizations:
                    type: array
                    items:
                      $ref: "#/components/schemas/Organization"
                  tickets:
                    type: array
                    items:
                      $ref: "#/components/schemas/SupportTicketBrief"

        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /system/push/firebase/ios:
    post:
      tags:
        - common
      summary: Submit iOS token for push-notifications via firebase
      security:
        - access_token: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                token:
                  type: string
                  description: Token of the device
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /system/push/firebase/android:
    post:
      tags:
        - common
      summary: Submit Android token for push-notifications via firebase
      security:
        - access_token: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                token:
                  type: string
                  description: Token of the device
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /common/app-phones-prefixes:
    get:
      tags:
        - common
      summary: Phones prefixes with countries names and flags
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: array
                description: Prefixes data
                items:
                  type: object
                  properties:
                    country:
                      type: string
                    prefix:
                      type: string
                    flag:
                      type: string
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError" 
  
  /common/app-phone-main-type:
    get:
      tags:
        - common
      summary: Phone main type
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: string
                description: Phone type main
                properties:
                  type:
                    title: string
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
  
  /common/app-phone-types:
    get:
      tags:
        - common
      summary: Phones types besides main type
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                description: Phone types
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        value:
                          type: integer
                        title:
                          type: string
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
  #---------------------------------------------------------------------------------------------------------------------

  /contacts:
    get:
      tags:
        - contacts
      summary: List of contacts
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
        - in: query
          name: status
          required: false
          description: Status of contacts (available if contact_section['show_status'] = true in GET /common/app-user-settings)
          schema:
            $ref: "#/components/schemas/ContactStatusValue"
        - in: query
          name: stage
          required: false
          description: Stage of contacts (available if contact_section['show_stage'] = true in GET /common/app-user-settings)
          schema:
            $ref: "#/components/schemas/ContactStageValue"
        - in: query
          name: last_name_beginning
          required: false
          description: Filter for beginnig of the last name, case insensitive
          schema:
            type: string
            minLength: 1
            example: "a"
        - in: query
          name: name
          required: false
          description: Filter for part of first/last name, case insensitive
          schema:
            type: string
            minLength: 1
            example: "john"
        - in: query
          name: tags
          required: false
          description: Filter for tags (separated by ",")
          schema:
            type: string
            minLength: 1
            example: 1,2
        - in: query
          name: user
          required: false
          description: Filter for assigned user
          schema:
            type: integer
            minLength: 1
            example: 2
        - in: query
          name: organization
          required: false
          description: Filter for organization
          schema:
            type: integer
            minLength: 1
            example: 1
        - in: query
          name: contactlist
          required: false
          description: Filter for contact list
          schema:
            type: integer
            minLength: 1
            example: 1
        - in: query
          name: phone
          required: false
          description: Filter for phone number part
          schema:
            type: integer
            minLength: 1
            example: 1234
        - in: query
          name: touches
          required: false
          description: Filter for number contact points
          schema:
            type: integer
            minLength: 1
            example: 5
        - in: query
          name: confidence_level
          required: false
          description: Filter for confidence level (in percents %)
          schema:
            type: string
            enum:
              - 10
              - 20
              - 30
              - 40
              - 50
              - 60
              - 70
              - 80
              - 90
              - 100
        - in: query
          name: orderby
          required: false
          description: Sort Order (Fields ARR (ASC, DESC), MRR (ASC, DESC), Confidence Level (ASC, DESC), Estimated Close Date (ASC, DESC), Touches (ASC, DESC), Value (ASC, DESC))
          schema:
            type: string
            enum:
              - arr
              - arr_desc
              - mrr
              - mrr_desc
              - confidence_level
              - confidence_level_desc
              - deal_close_date
              - deal_close_date_desc
              - touches_asc
              - touches_desc
              - value_asc
              - value_desc
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ContactBrief"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/stats:
    get:
      tags:
        - contacts
      summary: Videos, Campaigns Support tickets and Unreaded SMS/Email count
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Contact ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  contact_stats:
                    description: stats data
                    type: object
                    properties:
                      videos_count:
                        description: Number for uploaded videos
                        type: integer
                        default: 0
                      campaigns_count:
                        description: Number of started campaigns
                        type: integer
                        default: 0
                      support_tickets_count:
                        description: Number of assigned support tickets
                        type: integer
                        default: 0
                      support_active_tickets_count:
                        description: Number of assigned active support tickets
                        type: integer
                        default: 0
                      unread_emails:
                        description: Unread messages
                        type: integer
                        default: 0
                      unread_sms:
                        description: Unread text messages
                        type: integer
                        default: 0
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}:
    get:
      tags:
        - contacts
      summary: Information of the contact
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Contact ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ContactDetails"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
    patch:
      tags:
        - contacts
      summary: Edit the contact
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Contact ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ContactEdit"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ContactDetails"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/new:
    post:
      tags:
        - contacts
      summary: New contact
      security:
        - access_token: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ContactEdit"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ContactDetails"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/lists:
    get:
      tags:
        - contacts
      summary: Contact lists for current user
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ContactList"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/campaigns:
    get:
      tags:
        - contacts
      summary: Campaigns for the contact
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/CampaignForContactBrief"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/available-campaigns:
    get:
      tags:
        - contacts
      summary: Campaigns available to start for the contact
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/CampaignBrief"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/settag:
    post:
      tags:
        - contacts
      summary: Set tag for the contact
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                id_tag:
                  type: integer
                  description: Tag ID
              required:
                - id_tag
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ContactDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/unsettag:
    post:
      tags:
        - contacts
      summary: Unset tag for the contact
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                id_tag:
                  type: integer
                  description: Unset ID
              required:
                - id_tag
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ContactDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/campaigns/create:
    post:
      tags:
        - contacts
      summary: Start Campaign for the contact
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                campaign_id:
                  type: integer
                  description: campaign ID
              required:
                - campaign_id
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/CampaignForContactBrief"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/campaigns/stop:
    post:
      tags:
        - contacts
      summary: Stop Campaign for the contact
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                campaign_id:
                  type: integer
                  description: campaign ID
              required:
                - campaign_id
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/setstatus:
    post:
      tags:
        - contacts
      summary: Set status for the contact
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  $ref: "#/components/schemas/ContactStatusValue"
                  type: string
                  description: contact status
              required:
                - status
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ContactDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/setstage:
    post:
      tags:
        - contacts
      summary: Set stage for the contact
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                stage:
                  $ref: "#/components/schemas/ContactStageValue"
                  type: string
                  description: contact stage
              required:
                - stage
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ContactDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/subscribesms:
    get:
      tags:
        - contacts
      summary: Subscribe contact to recive sms messages
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ContactDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/unsubscribesms:
    get:
      tags:
        - contacts
      summary: Unsubscribe contact from reciving sms messages
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ContactDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/subscribeemail:
    get:
      tags:
        - contacts
      summary: Subscribe contact to recive emails
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ContactDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/unsubscribeemail:
    get:
      tags:
        - contacts
      summary: Unsubscribe contact from reciving emails
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ContactDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /contacts/{id}/sendvideourl:
    get:
      tags:
        - contacts
      summary: Send SMS with upload video URL
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
  #---------------------------------------------------------------------------------------------------------------------

  /organizations:
    get:
      tags:
        - organizations
      summary: List of organizations
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
        - in: query
          name: title_beginning
          required: false
          description: Filter for beginnig of the title, case insensitive
          schema:
            type: string
            minLength: 1
            example: "a"
        - in: query
          name: employees
          required: false
          description: Filter for employee size
          schema:
            $ref: "#/components/schemas/Range1_500"
        - in: query
          name: status
          required: false
          description: Status of companies (available if organization_section['show_status'] = true in GET /common/app-user-settings)
          schema:
            $ref: "#/components/schemas/ContactStatusValue"
        - in: query
          name: stage
          required: false
          description: Stage of companies (available if organization_section['show_stage'] = true in GET /common/app-user-settings)
          schema:
            $ref: "#/components/schemas/ContactStageValue"
        - in: query
          name: email_beginning
          required: false
          description: Filter for beginning of the email, case insensitive
          schema:
            type: string
            minLength: 1
            example: "a"
        - in: query
          name: tags
          required: false
          description: Filter for tags (separated by ",")
          schema:
            type: string
            minLength: 1
            example: 1,2
        - in: query
          name: user
          required: false
          description: Filter for assigned user
          schema:
            type: integer
            minLength: 1
            example: 2
        - in: query
          name: phone
          required: false
          description: Filter for phone number part
          schema:
            type: integer
            minLength: 1
            example: 1234
        - in: query
          name: city
          required: false
          description: Filter for city (case insensitive)
          schema:
            type: string
            minLength: 1
            example: new york
        - in: query
          name: confidence_level
          required: false
          description: Filter for confidence level (in percents %)
          schema:
            type: string
            enum:
              - 10
              - 20
              - 30
              - 40
              - 50
              - 60
              - 70
              - 80
              - 90
              - 100
        - in: query
          name: state
          required: false
          description: Filter for state
          schema:
            $ref: "#/components/schemas/State2SymbolsUSA"
        - in: query
          name: orderby
          required: false
          description: Sort Order (Fields ARR (ASC, DESC), MRR (ASC, DESC), Confidence Level (ASC, DESC), Value (ASC, DESC))
          schema:
            type: string
            enum:
              - arr
              - arr_desc
              - mrr
              - mrr_desc
              - confidence_level
              - confidence_level_desc
              - deal_close_date
              - deal_close_date_desc
              - value_asc
              - value_desc
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/Organization"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /organizations/{id}:
    get:
      tags:
        - organizations
      summary: Information about organization
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Organization ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/OrganizationDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
    patch:
      tags:
        - organizations
      summary: Edit organization
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Organization ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OrganizationEdit"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/OrganizationDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /organizations/new:
    post:
      tags:
        - organizations
      summary: Add organization
      security:
        - access_token: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OrganizationEdit"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/OrganizationDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /organizations/{id}/setstatus:
    post:
      tags:
        - organizations
      summary: Set status for the organization
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: organization ID
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  $ref: "#/components/schemas/ContactStatusValue"
                  type: string
                  description: organizations status
              required:
                - status
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/OrganizationDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /organizations/{id}/setstage:
    post:
      tags:
        - organizations
      summary: Set stage for the organization
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: organization ID
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                stage:
                  $ref: "#/components/schemas/ContactStageValue"
                  type: string
                  description: organization stage
              required:
                - stage
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/OrganizationDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /organizations/{id}/settag:
    post:
      tags:
        - organizations
      summary: Set tag for the organization
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: contact ID
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                id_tag:
                  type: integer
                  description: Tag ID
              required:
                - id_tag
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/OrganizationDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /organizations/{id}/unsettag:
    post:
      tags:
        - organizations
      summary: Unset tag for the organization
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: organization ID
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                id_tag:
                  type: integer
                  description: Unset ID
              required:
                - id_tag
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/OrganizationDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
  #---------------------------------------------------------------------------------------------------------------------

  /purchases:
    get:
      tags:
        - purchases
      summary: List of purchases
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
        - in: query
          name: contact_id
          required: false
          description: contact ID
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          description: Purchase ID
                        title:
                          type: string
                          description: Purchased product title
                        price:
                          type: integer
                          description: Price (in cents)
                        discount:
                          type: integer
                          description: Discount (in cents)
                        product_id:
                          type: integer
                          description: Product ID
                        time:
                          type: string
                          description: purchased time in W3C format
                          example: "2022-05-15T06:31:00+00:00"
                        download:
                          type: object
                          description: Information about download if purchase is downloadable
                          properties:
                            status_title:
                              type: string
                              description: Title of the status
                              example: Download URL sent
                            send_url_available:
                              type: boolean
                              description: true if URL can be sent to customer
                      required:
                      - id
                      - title
                      - price
                      - discount
                      - product_id
                      - time
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /purchases/{id}:
    post:
      tags:
        - purchases
      summary: Send SMS with download URL
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: purchase ID
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  #---------------------------------------------------------------------------------------------------------------------

  /calendar/list:
    get:
      tags:
        - calendar
      summary: List task and calendar events
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
        - in: query
          name: contact_id
          required: false
          description: contact ID
          schema:
            type: integer
        - in: query
          name: type
          required: false
          description: event type
          schema:
            type: string
            enum:
              - task
              - calendar
        - in: query
          name: year
          required: false
          description: Year (4 digits)
          schema:
            type: integer
        - in: query
          name: month
          required: false
          description: Month (1-12)
          schema:
            type: integer
        - in: query
          name: day
          required: false
          description: Day (1-31)
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        contact_id:
                          type: integer
                          description: ID of the contact
                        name:
                          type: string
                          description: Contact's Name
                        time:
                          type: string
                          description: Scheduled Time (W3C format)
                        note:
                          type: string
                          description: Note
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  #---------------------------------------------------------------------------------------------------------------------

  /support/contacts:
    get:
      tags:
        - support
      summary: List of Support Contacts
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          description: Support Contact ID
                        name:
                          type: string
                          description: Support Contact Name
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/contact/create:
    post:
      tags:
        - support
      summary: Create Support Contact
      security:
        - access_token: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                first_name:
                  type: string
                last_name:
                  type: string
                email:
                  type: string
                phone:
                  type: array
                  items:
                    type: object
                    properties:
                      country:
                        type: string
                        description: Phone Country
                        example: United States
                      phone:
                        type: string
                        description: Phone Number (without prefix)
                        example: (702) 659-1462
              required:
                - first_name
                - last_name
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Support Contact ID
                  name:
                    type: string
                    description: "John smith"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/statuses:
    get:
      tags:
        - support
      summary: List of Support Statuses
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: array
                items:
                  type: object
                  properties:
                    tag:
                      type: string
                      description: Support status tag
                    title:
                      type: string
                      description: Support status title
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/tickets:
    get:
      tags:
        - support
      summary: List of support tickets
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
        - in: query
          name: contact_id
          required: false
          description: contact ID
          schema:
            type: integer
        - in: query
          name: subject
          required: false
          description: Title Subject
          schema:
            type: string
        - in: query
          name: priority
          required: false
          description: Ticket Priority
          schema:
            $ref: "#/components/schemas/SupportTicketPriority"
        - in: query
          name: status
          required: false
          description: Status tag of tickets
          schema:
            $ref: "#/components/schemas/SupportTicketStatus"
        - in: query
          name: department_id
          required: false
          description: Department ID (`GET /company/departments`)
          schema:
            type: integer
        - in: query
          name: user_id
          required: false
          description: User ID (`GET /company/users`)
          schema:
            type: integer
        - in: query
          name: support_contact_id
          required: false
          description: Support Contact ID (dropdown list - `GET /support/contacts`)
          schema:
            type: integer
        - in: query
          name: organization
          required: false
          description: Company Title
          schema:
            type: string
        - in: query
          name: year
          required: false
          description: Due Date Year (4 digits)
          schema:
            type: integer
        - in: query
          name: month
          required: false
          description: Due Date Month (1-12)
          schema:
            type: integer
        - in: query
          name: day
          required: false
          description: Due Date Day (1-31)
          schema:
            type: integer
        - in: query
          name: created_year
          required: false
          description: Created Year (4 digits)
          schema:
            type: integer
        - in: query
          name: created_month
          required: false
          description: Created Month (1-12)
          schema:
            type: integer
        - in: query
          name: created_day
          required: false
          description: Created Day (1-31)
          schema:
            type: integer
        - in: query
          name: updated_year
          required: false
          description: Updated Year (4 digits)
          schema:
            type: integer
        - in: query
          name: updated_month
          required: false
          description: Updated Month (1-12)
          schema:
            type: integer
        - in: query
          name: updated_day
          required: false
          description: Updated Day (1-31)
          schema:
            type: integer
        - in: query
          name: tags
          required: false
          description: Filter for tags (separated by ",")
          schema:
            type: string
            minLength: 1
            example: 1,2
        - in: query
          name: orderby
          required: false
          description: Sort Order (Fields List --- Subject (Sort A-Z, Sort Z-A), Client (A-Z, Z-A), Company (A-Z, Z-A), Department (A-Z, Z-A), Status (A-Z, Z-A), Assigned User (A-Z, Z-A), Updated By (A-Z, Z-A), Created (High To Low, Low To High), Due Date (High To Low, Low To High), Priority (High To Low, Low To High), Time Spent (High To Low, Low To High), Ticket Number (High To Low, Low To High), Last Updated At (High To Low, Low To High))
          schema:
            type: string
            enum:
              - subject
              - subject_desc
              - client
              - client_desc
              - organization
              - organization_desc
              - department
              - department_desc
              - status
              - status_desc
              - user
              - user_desc
              - edit_user
              - edit_user_desc
              - created_desc
              - created
              - duedate_desc
              - duedate
              - priority
              - priority_desc
              - timespent_desc
              - timespent
              - id_desc
              - id
              - lastupdated_desc
              - lastupdated

      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/SupportTicketBrief"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/create:
    post:
      tags:
        - support
      summary: Create ticket
      security:
        - access_token: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SupportTicketAdd"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SupportTicketDetails"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/{id}:
    get:
      tags:
        - support
      summary: Information of the ticket
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Ticket ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SupportTicketDetails"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/{id}/activity:
    get:
      tags:
        - support
      summary: List of activities for selected ticket
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Ticket ID
          schema:
            type: integer
            format: int64
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        text:
                          type: string
                          description: Activity description
                        time:
                          type: string
                          description: time of activity in W3C format
                          example: "2022-05-15T06:31:00+00:00"
                        icon:
                          type: string
                          description: Icon in SVG-format
                          example: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"h-5 w-5 text-white feather feather-layers\"><polygon points=\"12 2 2 7 12 12 22 7 12 2\"/><polyline points=\"2 17 12 22 22 17\"/><polyline points=\"2 12 12 17 22 12\"/></svg>"
                        icon_color:
                          type: string
                          enum:
                            - priority
                            - yellow
                            - blue
                            - gray
                            - green
                            - green_second
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/{id}/messages:
    get:
      tags:
        - support
      summary: List of messages for selected ticket
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Ticket ID
          schema:
            type: integer
            format: int64
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/SupportTicketMessage"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
    post:
      tags:
        - support
      summary: Create a meessage for the ticket
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Ticket ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: Note content
                close_ticket:
                  type: integer
                  description: Close Ticket After Message Was Sent ( 0 - do not close the ticket; 1 - close the ticket )
                  enum:
                    - 0
                    - 1
                attachments:
                  type: array
                  items:
                    type: integer
                    description: "ID of the file uploaded with `POST /file-upload/generic-multipart`"
              required:
                - text
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SupportTicketMessage"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/{id}/note:
    get:
      tags:
        - support
      summary: List of notes for selected ticket
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: Ticket ID
          schema:
            type: integer
            format: int64
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/SupportTicketNote"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
    post:
      tags:
        - support
      summary: Create a note for the ticket
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: Ticket ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: Note content
                attachments:
                  type: array
                  items:
                    type: integer
                    description: "ID of the file uploaded with `POST /file-upload/generic-multipart`"
              required:
                - text
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SupportTicketNote"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/note/{id}:
    patch:
      tags:
        - support
      summary: Edit Note
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: Note ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: Note content
                attachments:
                  type: array
                  items:
                    type: integer
                    description: "ID of the file uploaded with `POST /file-upload/generic-multipart`"
              required:
                - text
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SupportTicketNote"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
    delete:
      tags:
        - support
      summary: Delete note
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/{id}/priority:
    patch:
      tags:
        - support
      summary: Change a priority for the ticket
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Ticket ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                priority:
                 $ref: "#/components/schemas/SupportTicketPriority"
              required:
                - status
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SupportTicketDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/{id}/status:
    patch:
      tags:
        - support
      summary: Change a status for the ticket
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Ticket ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                 $ref: "#/components/schemas/SupportTicketStatus"
              required:
                - status
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SupportTicketDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/{id}/user:
    patch:
      tags:
        - support
      summary: Change an assigned user for the ticket
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Ticket ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                user_id:
                 type: integer
                 description: User ID to change (`GET /company/users`)
              required:
                - user_id
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SupportTicketDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/{id}/department:
    patch:
      tags:
        - support
      summary: Change an assigned user for the ticket
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Ticket ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                department_id:
                 type: integer
                 description: Department ID to change (`GET /company/departments`)
              required:
                - user_id
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SupportTicketDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/{id}/timelog:
    get:
      tags:
        - support
      summary: Time Log list for selected ticket
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: Ticket ID
          schema:
            type: integer
            format: int64
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/SupportTicketTimeLog"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
    patch:
      tags:
        - support
      summary: Add Time Log
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Ticket ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                time_start:
                  type: string
                  description: Start Time (W3C format)
                  example: "2022-05-24T01:18:00+00:00"
                time_end:
                  type: string
                  description: Stop Time (W3C format)
                  example: "2022-05-24T01:18:00+00:00"
                text:
                  type: string
                  description: description
                note:
                  type: string
                  description: note
                attachments:
                  type: array
                  items:
                    type: integer
                    description: "ID of the file uploaded with `POST /support/form/file-upload/generic-multipart`"
              required:
                - time_start
                - time_end
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/SupportTicketTimeLogDetails"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/timelog/{id}:
    get:
      tags:
        - support
      summary: Time Log details
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: Time Log ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/SupportTicketTimeLogDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
    patch:
      tags:
        - support
      summary: Edit Time Log
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: Time log
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                time_start:
                  type: string
                  description: Start Time (W3C format)
                  example: "2022-05-24T01:18:00+00:00"
                time_end:
                  type: string
                  description: Stop Time (W3C format)
                  example: "2022-05-24T01:18:00+00:00"
                text:
                  type: string
                  description: description
                note:
                  type: string
                  description: note
                attachments:
                  type: array
                  items:
                    type: integer
                    description: "ID of the file uploaded with `POST /support/form/file-upload/generic-multipart`"
              required:
                - text
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SupportTicketTimeLogDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
    delete:
      tags:
        - support
      summary: Delete time log
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: Time log ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/timelog/{id}/attachment:
    post:
      tags:
        - support
      summary: add time log attachment
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: Time log ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                attachments:
                  type: array
                  items:
                    type: integer
                    description: "ID of the file uploaded with `POST /support/form/file-upload/generic-multipart`"
              required:
                - text
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SupportTicketTimeLogDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/ticket/timelog/{id}/attachment/{id_attachment}:
    delete:
      tags:
        - support
      summary: Delete time log attachment
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: Time log ID
          schema:
            type: integer
            format: int64
        - in: path
          name: id_attachment
          required: true
          description: Attachment ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SupportTicketTimeLogDetails"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/types:
    get:
      tags:
        - support
      summary: List of the Types/Sub Types (dropdown)
      security:
        - access_token: [ ]
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successfull
          content:
            "*/*":
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: Type ID
                    title:
                      type: string
                      description: Type title
                    subtypes:
                      type: array
                      items:
                        $ref: "#/components/schemas/SubTypeList"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /support/messagetemplates:
    get:
      tags:
        - support
      summary: Templates for support messages
      security:
        - access_token: []
      parameters:
        - in: query
          name: type
          required: false
          description: type id (Template Category ID)
          schema:
            type: integer
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                    title:
                      type: string
                      description: Template Title
                    body:
                      type: string
                      description: HTML for email's body
                    attachments:
                      type: array
                      description: attachments for the template (absent if no attachments)
                      items:
                        type: object
                        properties:
                          id:
                            type: integer
                            description: Attachment ID
                          title:
                            type: string
                            description: file name
                          url:
                            type: string
                            description: URL of the file thumbnail
                          download_url:
                            type: string
                            description: URL of the file to download
                        required:
                          - file
                  required:
                    - id
                    - title
                    - body
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  #---------------------------------------------------------------------------------------------------------------------

  /activities:
    get:
      tags:
        - activities
      summary: List of activities
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
        - in: query
          name: contact_id
          required: false
          description: Filter for contact ID (`contact_id` or `user_id` required)
          schema:
            type: integer
        - in: query
          name: user_id
          required: false
          description: Filter for user_id ID (`contact_id` or `user_id` required)
          schema:
            type: integer
        - in: query
          name: organization_id
          required: false
          description: Filter for organization_id ID
          schema:
            type: integer
        - in: query
          name: type
          required: false
          description: Filter for activity type
          schema:
            type: string
            enum:
              - sms
              - email
              - task
              - call
              - note
              - booked_call
        - in: query
          name: direction
          required: false
          description: Filter for outgoing/incoming calls/emails/sms
          schema:
            type: string
            enum:
              - incoming
              - outgoing
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  stats:
                    type: array
                    items:
                      type: object
                      description: Activity Stats
                      properties:
                        last_contacted:
                          type: object
                          description: Last Contacted
                          properties:
                            title:
                              type: string
                            value:
                              type: string
                        interactions:
                          type: object
                          description: Interactions
                          properties:
                            title:
                              type: string
                            value:
                              type: string
                        inactive:
                          type: object
                          description: Inactive days
                          properties:
                            title:
                              type: string
                            value:
                              type: string
                  data:
                    type: array
                    items:
                      type: object
                      description: Activity item
                      properties:
                        id:
                          type: integer
                          description: Activity ID
                        title:
                          type: string
                          example: "Broadcast SMS"
                        description:
                          type: string
                          example: "User John sent an SMS to Bill"
                        time:
                          type: string
                          description: time of activity in W3C format
                          example: "2022-05-15T06:31:00+00:00"
                        scheduled_time:
                          type: string
                          description: time when activity is/was scheduled in W3C format. May be empty or absent if activity wasn't scheduled.
                          example: "2022-05-24T01:18:00+00:00"
                        object:
                          type: object
                          description: Object for designated activity
                          properties:
                            id:
                              description: ID of the object
                              type: integer
                            type:
                              description: type of the object
                              type: string
                              enum:
                              - sms
                              - email
                              - task
                              - call
                              - note
                            direction:
                              type: string
                              description: direction of the message if applicable. Can be empty or absent
                              enum:
                              - incoming
                              - outgoing
                              - ""
                            object_details:
                              type: object
                              description: Object for designated activity
                              properties:
                                contact_id:
                                  type: integer
                                  description: ID of the contact
                                name:
                                  type: string
                                  description: Name of contact
                                  example: "John Smith"
                                phone:
                                  type: string
                                  description: Phone number (formatted, empty if no phone)
                                email:
                                  type: string
                                  description: Email Address
                                subject:
                                  description: email subject (if action is related to email)
                                  type: string
                                text:
                                  description: text
                                  type: string
                                time_scheduled:
                                  type: string
                                  description: Scheduled Time (W3C format)
                                  example: "2022-05-24T01:18:00+00:00"
                              required:
                                - text
                          required:
                          - id
                          - type
                        unread:
                          description: "Is this activity unread"
                          type: boolean
                      required:
                          - id
                          - title
                          - description
                          - time
                          - object
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"

  /communication/call/{id}:
    get:
      tags:
        - activities
      summary: Information about the call
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Call ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: call ID
                  contact_id:
                    type: integer
                    description: ID of the contact (`0` if no contact)
                  user_id:
                    type: integer
                    description: ID of the user (`0` if no user)
                  time:
                    type: string
                    description: Time (W3C format)
                    example: "2022-05-24T01:18:00+00:00"
                  status:
                    type: string
                    description: Status from twilio (possible values https://support.twilio.com/hc/en-us/articles/223132547-What-are-the-Possible-Call-Statuses-and-What-do-They-Mean-)
                  duration:
                    type: integer
                    description: durations in seconds
                  recording_url:
                    type: string
                    description: recording URL. May be empty if no recording available
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ContactDetails"

  /communication/sms/{id}:
    get:
      tags:
        - activities
      summary: Information about SMS
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: SMS ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SMSInfo"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /communication/sms/contact/{contact_id}:
    post:
      tags:
        - activities
      summary: Send SMS
      security:
        - access_token: []
      parameters:
        - in: path
          name: contact_id
          required: true
          description: Contact ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: Message text
                time:
                  type: string
                  description: Scheduled time (W3C format), optional. SMS will be sent immediately if this parameter does not exist
                  example: "2022-05-24T01:18:00+00:00"
              required:
                - text
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/SMSInfo"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /communication/tasks/todos:
    get:
      tags:
        - activities
      summary: List of tasks
      security:
        - access_token: [ ]
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
        - in: query
          name: status
          required: false
          description: Filter for task status
          schema:
            type: string
            enum:
              - Active
              - Completed
        - in: query
          name: orderby
          required: false
          description: Order tasks
          schema:
            type: string
            enum:
              - date
        - in: query
          name: contact_id
          required: false
          description: contact ID
          schema:
            type: integer
        - in: query
          name: year
          required: false
          description: Year (4 digits)
          schema:
            type: integer
        - in: query
          name: month
          required: false
          description: Month (1-12)
          schema:
            type: integer
        - in: query
          name: day
          required: false
          description: Day (1-31)
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      description: Task item
                      properties:
                        id:
                          type: integer
                          description: Task ID
                        time_scheduled:
                          type: string
                          description: time of activity in W3C format
                          example: "2022-05-15T06:31:00+00:00"
                        priority:
                          type: string
                          description: Task Priority
                          example: "High"
                        status:
                          type: string
                          description: Task Status
                          example: "Active"
                        text:
                          type: string
                          description: Task Text
                          example: "this is another task"
                      required:
                        - id
                        - time_scheduled
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"

  /communication/tasks/{id}:
    get:
      tags:
        - activities
      summary: Information about task
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: task ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/TaskInfo"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
    patch:
      tags:
        - activities
      summary: Edit a task
      security:
        - access_token: [ ]
      parameters:
        - in: path
          name: id
          required: true
          description: Task ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: Note content
                time_scheduled:
                  type: string
                  description: Scheduled Time (W3C format)
                  example: "2022-05-24T01:18:00+00:00"
                reminder:
                  type: integer
                  description: Reminder in minutes before scheduled time
                  enum:
                    - 5
                    - 15
                    - 30
                    - 60
                priority:
                  type: string
                  description: Task Priority
                status:
                  type: string
                  description: Task Status
              required:
                - text
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/TaskInfo"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /communication/bookedcalls:
    get:
      tags:
        - activities
      summary: List of booked calls
      security:
        - access_token: [ ]
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
        - in: query
          name: contact_id
          required: false
          description: contact ID
          schema:
            type: integer
        - in: query
          name: year
          required: false
          description: Year (4 digits)
          schema:
            type: integer
        - in: query
          name: month
          required: false
          description: Month (1-12)
          schema:
            type: integer
        - in: query
          name: day
          required: false
          description: Day (1-31)
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      description: Task item
                      properties:
                        id:
                          type: integer
                          description: Booked Call ID
                        time_scheduled:
                          type: string
                          description: time of activity in W3C format
                          example: "2022-05-15T06:31:00+00:00"
                        status:
                          type: string
                          description: Task Status
                          example: "Active"
                        text:
                          type: string
                          description: Task Text
                          example: "30 Minutes Meeting"
                        cancel_url:
                          type: string
                          description: Cancel Booked Call URL
                        reschedule_url:
                          type: string
                          description: Reschedule Booked Call URL
                      required:
                        - id
                        - time_scheduled
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"


  /communication/bookedcalls/{id}:
    get:
      tags:
        - activities
      summary: Information about Booked Call
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: booked call ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/BookedCallInfo"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /communication/tasks/contact/{contact_id}:
    post:
      tags:
        - activities
      summary: Create a task
      security:
        - access_token: []
      parameters:
        - in: path
          name: contact_id
          required: true
          description: Contact ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: Note content
                time_scheduled:
                  type: string
                  description: Scheduled Time (W3C format)
                  example: "2022-05-24T01:18:00+00:00"
                reminder:
                  type: integer
                  description: Reminder in minutes before scheduled time
                  enum:
                    - 5
                    - 15
                    - 30
                    - 60
                priority:
                  type: string
                  description: Task Priority
                status:
                  type: string
                  description: Task Status
              required:
                - text
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/TaskInfo"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /communication/emails/{id}:
    get:
      tags:
        - activities
      summary: Information about email
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/EmailInfo"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /communication/emails/contact/{contact_id}:
    post:
      tags:
        - activities
      summary: Send email
      security:
        - access_token: []
      parameters:
        - in: path
          name: contact_id
          required: true
          description: Contact ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                subject:
                  type: string
                  description: Subject line
                message:
                  type: string
                  description: Message HTML
                time:
                  type: string
                  description: Scheduled time (W3C format), optional. SMS will be sent immediately if this parameter does not exist
                  example: "2022-05-24T01:18:00+00:00"
              required:
                - subject
                - message
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/EmailInfo"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /communication/notes/{id}:
    get:
      tags:
        - activities
      summary: Information about note
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/NoteInfo"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
    patch:
      tags:
        - activities
      summary: Update note
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: Note content
              required:
                - text
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/NoteInfo"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
    delete:
      tags:
        - activities
      summary: Delete note
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: ID
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /communication/notes/contact/{contact_id}:
    post:
      tags:
        - activities
      summary: Create note
      security:
        - access_token: []
      parameters:
        - in: path
          name: contact_id
          required: true
          description: Contact ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: Note content
              required:
                - text
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/NoteInfo"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  #---------------------------------------------------------------------------------------------------------------------

  /account/profile:
    get:
      tags:
        - my account
      summary: Information of the contact
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/MyAccountDetails"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /account/shared:
    get:
      tags:
        - my account
      summary: List of shared content
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      description: Shared Content
                      properties:
                        title:
                          type: string
                          example: "Check this cool video!"
                        destination:
                          type: string
                          description: Social Media where content was shared
                          example: "Facebook / Page"
                        published_time:
                          type: string
                          description: Time (W3C format)
                          example: "2022-05-24T01:18:00+00:00"
                        url:
                          type: string
                          description: "Post URL"
                      required:
                        - title
                        - destination
                        - published_time
                        - url
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "404":
          description: Item not found
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /account/sendvideourl:
    get:
      tags:
        - my account
      summary: Send SMS with upload video URL
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  #---------------------------------------------------------------------------------------------------------------------

  /media/videos:
    get:
      tags:
        - files
      summary: List of videos
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
        - in: query
          name: contact_id
          required: false
          description: Filter for contact ID (`contact_id` or `user_id` or `filter_my` required)
          schema:
            type: integer
        - in: query
          name: filter_my
          required: false
          description: Filter for current user only (`contact_id` or `user_id` or `filter_my` required)
          schema:
            type: integer
        - in: query
          name: user_id
          required: false
          description: Filter for user_id ID (`contact_id` or `user_id` or `filter_my` required)
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      description: Video
                      properties:
                        id:
                          type: integer
                          description: Video ID
                        title:
                          type: string
                          example: "My cool video!"
                        uploaded_by_name:
                          type: string
                          description: Name of the person who uploaded the video
                          example: "John Smith"
                        preview_image:
                          type: string
                          description: "URL to the thumbnail"
                        video_url:
                          type: string
                          description: "URL to the video"
                        publication_status_name:
                          description: "Status of the pulication (to display)"
                          type: string
                          example: "Not Published"
                        featured:
                          description: "Is this video marked as featured"
                          type: boolean
                        published_time:
                          type: string
                          description: Time (W3C format)
                          example: "2022-05-24T01:18:00+00:00"
                        received_time:
                          type: string
                          description: Time (W3C format)
                          example: "2022-05-24T01:18:00+00:00"
                        share_buttons:
                          type: object
                          description: Buttons to share the content (absent if no buttons available)
                          properties:
                            facebook_url:
                              type: string
                              description: "URL to redirect user to share the content"
                            twitter_url:
                              type: string
                              description: "URL to redirect user to share the content"
                            linkedin_url:
                              type: string
                              description: "URL to redirect user to share the content"
                      required:
                          - id
                          - title
                          - uploaded_by_name
                          - preview_image
                          - publication_status_name
                          - featured
                          - received_time
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"

  "/file-upload/generic-multipart":
    post:
      tags:
        - files
      summary: Upload a files
      security:
        - access_token: []
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: File identidier
        "400":
          description: Invalid data or unable to upload the files (size is too big, wrong forma etc)
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"


  #---------------------------------------------------------------------------------------------------------------------

  /company/pipeline-tree:
    get:
      tags:
        - company
      summary: Full tree of pipeline statuses with stages
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: array
                items:
                  type: object
                  properties:
                    status:
                      $ref: "#/components/schemas/ContactStatusValue"
                    title:
                      $ref: "#/components/schemas/ContactStatusTitle"
                    stages:
                      type: array
                      items:
                        type: object
                        properties:
                          stage:
                            $ref: "#/components/schemas/ContactStageValue"
                          title:
                            $ref: "#/components/schemas/ContactStageTitle"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /company/stages/{status}:
    get:
      tags:
        - company
      summary: Stages for the company
      security:
        - access_token: []
      parameters:
        - in: path
          name: status
          required: true
          description: Status
          schema:
            type: string
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: array
                items:
                  type: object
                  properties:
                    stage:
                      $ref: "#/components/schemas/ContactStageValue"
                    title:
                      $ref: "#/components/schemas/ContactStageTitle"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /company/tags:
    get:
      tags:
        - company
      summary: List of available tags
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/Tag"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /company/users:
    get:
      tags:
        - company
      summary: List of all active users for the company
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/UserBrief"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /company/departments:
    get:
      tags:
        - company
      summary: List of all departments
      security:
        - access_token: []
      parameters:
        - in: query
          name: support
          required: false
          description: "Filter departments available for support (`1` to activate filter)"
          schema:
            type: integer
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                        title:
                          type: string
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /company/locations:
    get:
      tags:
        - company
      summary: List of all locations
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                        title:
                          type: string
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  #---------------------------------------------------------------------------------------------------------------------

  /social/facebook/connect-url:
    get:
      tags:
        - social
      summary: Get URL to authorize the app to post on the facebook pages
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/WebView"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /social/facebook/current:
    delete:
      tags:
        - social
      summary: Disconnect Facebook account
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Social network is not connected
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /social/email/connect-url:
    get:
      tags:
        - social
      summary: Get URL to authorize the app to work with email
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/WebView"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /social/email/current:
    delete:
      tags:
        - social
      summary: Disconnect current authorized email account
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Social network is not connected
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /social/email/calendars:
    get:
      tags:
        - social
      summary: Get list of available calendars for connected email
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        calendar_token:
                          type: string
                        title:
                          type: string
        "400":
          description: Email is not connected or network error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /social/email/calendars/current:
    post:
      tags:
        - social
      summary: Connect the calendar
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                calendar_token:
                  type: string
                  description: "Token form `GET /social/email/calendars`"
              required:
                - calendar_token
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Email is not connected or network error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
    delete:
      tags:
        - social
      summary: Disconnect current calendar for connected email
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Email/calendar is not connected or network error
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /social/twitter/connect-url:
    get:
      tags:
        - social
      summary: Get URL to authorize the app to post on the Twitter
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/WebView"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /social/twitter/current:
    delete:
      tags:
        - social
      summary: Disconnect Twitter account
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Social network is not connected
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /social/linkedin/connect-url:
    get:
      tags:
        - social
      summary: Get URL to authorize the app to post on the LinkedIn
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/WebView"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /social/linkedin/current:
    delete:
      tags:
        - social
      summary: Disconnect LinkedIn account
        - social
      security:
        - access_token: []
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Social network is not connected
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  #---------------------------------------------------------------------------------------------------------------------

  /content/socialcontent:
    get:
      tags:
        - content
      summary: List of social content
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ShareableItem"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/socialcontent/{id}/sms:
    post:
      tags:
        - content
      summary: share content via sms
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Social Content ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareViaSMS"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/socialcontent/{id}/facebook:
    post:
      tags:
        - content
      summary: share content on facebook
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Social Content ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareOnSocial"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/socialcontent/{id}/twitter:
    post:
      tags:
        - content
      summary: share content on twitter
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Social Content ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareOnSocial"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/socialcontent/{id}/linkedin:
    post:
      tags:
        - content
      summary: share content on linkedin
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Social Content ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareOnSocial"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/plans:
    get:
      tags:
        - content
      summary: List of recurring plans
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ShareableItem"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/plan/{id}/sms:
    post:
      tags:
        - content
      summary: share plan via sms
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Plan ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareViaSMS"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/plan/{id}/facebook:
    post:
      tags:
        - content
      summary: share plan on facebook
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Plan ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareOnSocial"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/plan/{id}/twitter:
    post:
      tags:
        - content
      summary: share plan on twitter
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Plan ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareOnSocial"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/plan/{id}/linkedin:
    post:
      tags:
        - content
      summary: share plan on linkedin
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Plan ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareOnSocial"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/products:
    get:
      tags:
        - content
      summary: List of available for sale products
      security:
        - access_token: []
      parameters:
        - in: query
          name: limit
          required: false
          description: limit for pagination (default value is `15`)
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: limit for pagination
          schema:
            type: integer
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ShareableItem"
                  pagination:
                    $ref: "#/components/schemas/PaginationInformation"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/product/{id}/sms:
    post:
      tags:
        - content
      summary: share product via sms
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Product ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareViaSMS"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/product/{id}/facebook:
    post:
      tags:
        - content
      summary: share product on facebook
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Product ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareOnSocial"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/product/{id}/twitter:
    post:
      tags:
        - content
      summary: share product on twitter
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Product ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareOnSocial"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /content/product/{id}/linkedin:
    post:
      tags:
        - content
      summary: share product on linkedin
      security:
        - access_token: []
      parameters:
        - in: path
          name: id
          required: true
          description: Product ID
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareOnSocial"
        required: true
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericMessage"
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  #---------------------------------------------------------------------------------------------------------------------

  /templates/categories/{type}:
    get:
      tags:
        - templates
      summary: Categories with templates count for designated type
      security:
        - access_token: []
      parameters:
        - in: path
          name: type
          required: true
          description: Template type
          schema:
            type: string
            enum:
              - text
              - email
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                    title:
                      type: string
                    count:
                      type: integer
                      description: Count for selected type
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /templates/for-text/{category_id}:
    get:
      tags:
        - templates
      summary: Templates for the text messages
      security:
        - access_token: []
      parameters:
        - in: path
          name: category_id
          required: true
          description: Category from `GET /templates/categories/text`
          schema:
            type: string
            enum:
              - text
              - email
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                    text:
                      type: string
                    type_title:
                      type: string
                      description: Title for message type
                      example: "Global Template"
                    type_title_color:
                      $ref: "#/components/schemas/ColorTag"
                    image:
                      description: Information about attached image. Doesn't exist if no image aatched
                      type: object
                      properties:
                        url:
                          type: string
                        thumb_url:
                          type: string
                      required:
                        - url
                  required:
                    - id
                    - text
                    - type_title
                    - type_title_color
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  /templates/for-email/{category_id}:
    get:
      tags:
        - templates
      summary: Templates for emails
      security:
        - access_token: []
      parameters:
        - in: path
          name: category_id
          required: true
          description: Category from `GET /templates/categories/email`
          schema:
            type: string
            enum:
              - text
              - email
      responses:
        "200":
          description: Operation successful
          content:
            "*/*":
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                    subject:
                      type: string
                    body:
                      type: string
                      description: HTML for email's body
                    type_title:
                      type: string
                      description: Title for message type
                      example: "Global Template"
                    type_title_color:
                      $ref: "#/components/schemas/ColorTag"
                  required:
                    - id
                    - subject
                    - body
                    - type_title
                    - type_title_color
        "400":
          description: Invalid data
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"
        "403":
          description: Authorization required
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/GenericError"

  #---------------------------------------------------------------------------------------------------------------------

components:
  securitySchemes:
    access_token:
      type: apiKey
      in: header
      name: access_token
      description: Access Token received in `/login` method
  schemas:
    BoolSetVal:
      description: Structure for submitting the data
      type: object
      properties:
        set:
          type: boolean
          example: true
      required:
      - set
    ContactStatusValue:
      type: string
      description: Status value
      example: opportunities
    ContactStageValue:
      type: string
      description: Stage value
      example: lost
    ContactStatusTitle:
      type: string
      description: Status title
      example: Opportunities
    ContactStageTitle:
      type: string
      description: Stage title
      example: Lost
    CampaignBrief:
      description: Brief information about the campaign
      type: object
      properties:
        id:
          type: integer
          description: Campaign ID
        title:
          type: string
          description: Campaign title
      required:
      - id
      - title
    CampaignForContactBrief:
      description: Information about the campaign for some contact
      type: object
      properties:
        id:
          type: integer
          description: Campaign ID
        title:
          type: string
          description: Campaign title
        progress:
          type: string
          description: Campaign progress title
        time_started:
          type: string
          description: start campaign time in W3C format
          example: "2022-05-15T06:31:00+00:00"
        stop_campaign_available:
          type: boolean
          description: Is it possible to stop a campaign for this campaign
      required:
      - id
      - title
      - progress
      - stop_campaign_available
    NoteInfo:
      description: Note detail
      type: object
      properties:
        id:
          type: integer
          description: ID
        contact_id:
          type: integer
          description: ID of the contact (`0` if no contact)
        user_id:
          type: integer
          description: ID of the user (`0` if no user)
        time:
          type: string
          description: Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        text:
          type: string
          description: Note content
      required:
      - id
      - contact_id
      - user_id
      - time
      - text
    ColorTag:
      type: string
      example: "success"
      enum:
        - default
        - success
        - info
        - danger
        - warning
        - primary
    ContactBrief:
      description: contacts information for views in lists
      type: object
      properties:
        id:
          type: integer
          description: ID of the contact
        initials:
          type: string
          description: Contact initials to display
        name:
          type: string
          description: Contact name to display
        phone:
          type: string
          description: Phone number (formatted)
        email:
          type: string
          description: Email Address
        status:
          $ref: '#/components/schemas/ContactStatusTitle'
        stage:
          $ref: '#/components/schemas/ContactStageTitle'
        value:
          type: integer
          description: Contact's value
        show_status:
          type: boolean
          description: Show status field in the contact info
        show_stage:
          type: boolean
          description: Show stage field in the contact info
      required:
      - id
      - name
    ContactEdit:
      description: Contact information for add/edit
      type: object
      properties:
        first_name:
          type: string
          description: First name
        last_name:
          type: string
          description: Last name
        address:
          type: object
          description: Address
          properties:
            street_address:
              type: string
            city:
              type: string
            state:
              $ref: "#/components/schemas/State2SymbolsUSA"
            zip:
              type: string
            country:
              type: string
        phones:
          type: array
          description: Phone numbers array (short_phone - phone number without phone prefix, country - country name (the list of available countries, prefixes etc. you can get from GET /common/app-phones-prefixes) , type - phone type (the list of available values you can get from GET /common/app-phone-types) extension - extension or empty)
          items:
            type: object
            properties:
              short_phone:
                type: string
              country: 
                type: string
              type: 
                type: string
              extension: 
                type: string
            required:
              - short_phone
              - country
              - type
        email:
          type: string
          description: Email Address
        value:
          type: integer
          description: Contact's value
        arr:
          type: string
          description: Contact's ARR value
          example: $120
        mrr:
          type: string
          description: Contact's ARR value
          example: $120
        title:
          type: string
          description: Contact's title
        confidence_level:
          type: integer
          description: Contact's confidence level
          example: 10
        deal_close_date_month:
          type: string
          description: Customer Deal Close Date (Month) )
          example: "11"
        deal_close_date_day:
          type: string
          description: Customer Deal Close Date (Day) )
          example: "24"
        deal_close_date_year:
          type: string
          description: Customer Deal Close Date (Year) )
          example: "2022"
        assigned_user:
          type: object
          properties:
            id:
              type: integer
              description: Assigned User ID
          required:
          - id
        location:
          type: object
          description: Information about location
          properties:
            id:
              type: integer
              description: Location ID
          required:
          - id
        organization:
          type: object
          description: Information about organization
          properties:
            id:
              type: integer
              description: organization ID
          required:
          - id
        status:
          $ref: "#/components/schemas/ContactStatusValue"
        stage:
          $ref: "#/components/schemas/ContactStageValue"
        additional:
          description: Additional fields values
          type: array
          items:
            type: object
            properties:
              id:
                description: Field ID
                type: integer
              title:
                type: string
                description: Field title
              value:
                type: string
                description: Field value
        facebook_url:
          type: string
        twitter_url:
          type: string
        linkedin_url:
          type: string
        instagram_url:
          type: string
      required:
      - id
      - status
    ContactDetails:
      description: Contact information for detailed views
      type: object
      properties:
        id:
          type: integer
          description: ID of the contact
        initials:
          type: string
          description: Initials
        first_name:
          type: string
          description: First name
        last_name:
          type: string
          description: Last name
        address_formatted:
          type: string
          description: Address Formatted
        address:
          type: object
          description: Address
          properties:
            street_address:
              type: string
            city:
              type: string
            state:
              $ref: "#/components/schemas/State2SymbolsUSA"
            zip:
              type: string
            country:
              type: string
        phones:
          type: object
          description: Phone numbers (formatted, empty if no phone)
          properties:
            phone_type:
              type: string
              example: Main
            phone_formatted:
              type: string
              description: full phone number formatted
              example: +1 (111) 111 1111
            prefix:
              type: string
              description: phone prefix
              example: 1
            short_phone:
              type: string
              example: 1111111111
              description: short phone number (without phone prefix)
            country:
              type: string
            extension:
              type: string
        email:
          type: string
          description: Email Address
        value:
          type: integer
          description: Contact's value
        arr:
          type: string
          description: Contact's ARR value
          example: $120
        mrr:
          type: string
          description: Contact's ARR value
          example: $120
        title:
          type: string
          description: Contact's title
          example: Mr.
        confidence_level:
          type: integer
          description: Contact's confidence level (in percents %)
          example: 10
        deal_close_date:
          type: string
          description: Customer Deal Close Date W3C format
          example: "2022-05-15T06:31:00+00:00"
        assigned_user:
          type: object
          description: Assigned User Details (the property does not exist if no user assigned)
          properties:
            id:
              type: integer
              description: Assigned User ID
            name:
              type: string
              description: Assigned User Name
          required:
          - id
          - name
        location:
          type: object
          description: Information about location
          properties:
            id:
              type: integer
              description: Location ID
            title:
              type: string
              description: Location Title
          required:
          - id
          - title
        organization:
          type: object
          description: Information about organization
          properties:
            id:
              type: integer
              description: organization ID
            title:
              type: string
              description: organization Title
            url:
              type: string
              description: organization URL (does not exist if no URL)
          required:
          - id
          - title
        status:
          $ref: "#/components/schemas/ContactStatusTitle"
        stage:
          $ref: "#/components/schemas/ContactStageTitle"
        tags:
          description: Tags for the contact
          type: array
          items:
            type: object
            properties:
              id:
                description: Tag ID
                type: integer
              title:
                type: string
                description: Tag title
        additional:
          description: Additional fields values
          type: array
          items:
            type: object
            properties:
              id:
                description: Field ID
                type: integer
              title:
                type: string
                description: Field title
              value:
                type: string
                description: Field value
        facebook_url:
          type: string
        twitter_url:
          type: string
        linkedin_url:
          type: string
        instagram_url:
          type: string
        permissions:
          description: Designate which actions are available to current user for contact
          type: object
          properties:
            make_call:
              type: boolean
              description: User can call this contact
            send_sms:
              type: boolean
              description: User can send SMS to this contact
            send_email:
              type: boolean
              description: User can send an email to this contact
            unsubscribe_from_email:
              type: boolean
              description: User can unsubscribe this contact from emails
            subscribe_to_email:
              type: boolean
              description: User can subscribe this contact to emails
            unsubscribe_from_sms:
              type: boolean
              description: User can unsubscribe this contact from sms
            subscribe_to_sms:
              type: boolean
              description: User can subscribe this contact to sms
            approve:
              type: boolean
              description: User can approve this contact
            start_campaign:
              type: boolean
              description: User can start campaign for this contact
            create_task:
              type: boolean
              description: User can create task for this contact
            send_video_upload_link:
              type: boolean
              description: User can send upload video URL this contact
            show_status:
              type: boolean
              description: Show status on the contact details or edit/add form
            show_stage:
              type: boolean
              description: Show stage on the contact details or edit/add form
            change_status:
              type: boolean
              description: Ability to change the status for contact
            change_stage:
              type: boolean
              description: Ability to change the stage for contact
      required:
      - id
      - initials
      - first_name
      - last_name
      - address_formatted
      - address
      - phone
      - email
      - status
      - stage
    MyAccountDetails:
      description: My Profile information
      type: object
      properties:
        id:
          type: integer
          description: ID of the contact
        initials:
          type: string
          description: Initials
        first_name:
          type: string
          description: First name
        last_name:
          type: string
          description: Last name
        phone:
          type: string
          description: Phone number (formatted, empty if no phone)
        twilio_phone:
          type: string
          description: Twilio Phone number (formatted, empty if no phone)
        email:
          type: string
          description: Email Address
        location:
          type: object
          description: Information about location
          properties:
            id:
              type: integer
              description: Location ID
            title:
              type: string
              description: Location Title
          required:
            - id
            - title
        department:
          type: object
          description: Information about department
          properties:
            id:
              type: integer
              description: Department ID
            title:
              type: string
              description: Depatment Title
          required:
            - id
            - title
        balance:
          type: string
          description: User's balance
        tags:
          description: Tags for the contact
          type: array
          items:
            type: object
            properties:
              id:
                description: Tag ID
                type: integer
              title:
                type: string
                description: Tag title
        additional:
          description: Additional fields values
          type: array
          items:
            type: object
            properties:
              title:
                type: string
                description: Field title
              value:
                type: string
                description: Field value
        permissions:
          description: Designate which actions are available to current user for account
          type: object
          properties:
            send_video_upload_link:
              type: boolean
              description: User can send upload video URL this contact
            connect_email:
              type: boolean
              description: User can connect his email account
            disconnect_email:
              type: boolean
              description: User can disconnect his email account
            connect_callendar:
              type: boolean
              description: User can connect his calendar account
            disconnect_callendar:
              type: boolean
              description: User can disconnect his calendar account
            connect_facebook:
              type: boolean
              description: User can connect his facebook account
            disconnect_facebook:
              type: boolean
              description: User can disconnect his facebook account
            connect_twitter:
              type: boolean
              description: User can connect his twitter account
            disconnect_twitter:
              type: boolean
              description: User can disconnect his twitter account
            connect_linkedin:
              type: boolean
              description: User can connect his linkedin account
            disconnect_linkedin:
              type: boolean
              description: User can disconnect his linkedin account
      required:
      - id
      - initials
      - first_name
      - last_name
    ContactList:
      description: Information about the contact list
      type: object
      properties:
        id:
          type: integer
          description: contact list ID
        title:
          type: string
          description: Title to display
      required:
      - id
      - title
    EmailInfo:
      description: Information about email
      type: object
      properties:
        id:
          type: integer
          description: ID
        contact_id:
          type: integer
          description: ID of the contact (`0` if no contact)
        user_id:
          type: integer
          description: ID of the user (`0` if no user)
        time:
          type: string
          description: Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        subject:
          type: string
          description: Email subject
        message:
          type: string
          description: Email body
      required:
      - id
      - contact_id
      - user_id
      - time
      - subject
      - message
    GenericError:
      description: Generic error message
      type: object
      properties:
        message:
          type: string
        code:
          description: Error code (optional)
          type: string
      required:
      - message
    GenericMessage:
      description: Generic message for several operations
      type: object
      properties:
        message:
          type: string
    GenericMessageWithTitle:
      description: Generic message with title for several operations
      type: object
      properties:
        title:
          type: string
        message:
          type: string
    GenericMoneyAmount:
      description: Generic money information
      type: object
      properties:
        total_cents:
          type: integer
          format: int64
        currency:
          type: string
      required:
        - total_cents
        - currency
    HTML:
      description: Generic HTML-message
      type: object
      properties:
        title:
          type: string
          description: Title
        html:
          type: string
          description: HTML-formatted text
      required:
        - html
    Organization:
      description: Information about organization
      type: object
      properties:
        id:
          type: integer
          description: organization ID
        title:
          type: string
          description: Title to display
        initials:
          type: string
          description: Initials to display
        phone:
          type: string
          description: Phone number (formatted)
        email:
          type: string
          description: Phone number (formatted)
        address_formatted:
          type: string
          description: Address Formatted
        website:
          type: string
          description: Website
        status:
          $ref: '#/components/schemas/ContactStatusTitle'
        stage:
          $ref: '#/components/schemas/ContactStageTitle'
        value:
          type: integer
          description: Organization's value
        arr:
          type: string
          description: Contact's ARR value
          example: $120
        mrr:
          type: string
          description: Contact's ARR value
          example: $120
        show_status:
          type: boolean
          description: Show status field in the contact info
        show_stage:
          type: boolean
          description: Show stage field in the contact info
      required:
      - id
      - title
    OrganizationDetails:
      description: Organization information for detailed views
      type: object
      properties:
        id:
          type: integer
          description: ID of the organization
        title:
          type: string
          description: Title
        initials:
          type: string
          description: Initials (First Letter of Organization)
        phones:
          type: object
          description: Phone numbers (formatted, empty if no phone)
          properties:
            phone_type:
              type: string
              example: Main
            phone_formatted:
              type: string
              description: full phone number formatted
              example: +1 (111) 111 1111
            prefix:
              type: string
              description: phone prefix
              example: 1
            short_phone:
              type: string
              example: 1111111111
              description: short phone number (without phone prefix)
            country:
              type: string
            extension:
              type: string
        email:
          type: string
          description: Phone number (formatted)
        address_formatted:
          type: string
          description: Address Formatted
        address:
          type: object
          description: Address
          properties:
            street_address:
              type: string
            city:
              type: string
            state:
              $ref: "#/components/schemas/State2SymbolsUSA"
            zip:
              type: string
            country:
              type: string
        website:
          type: string
          description: Website
        employee_size:
          type: string
          description: Employee Size
        business_category:
          type: string
          description: Business Category
        sic_code:
          type: string
          description: SIC Code
        value:
          type: integer
          description: Value
        arr:
          type: string
          description: Contact's ARR value
          example: $120
        mrr:
          type: string
          description: Contact's ARR value
          example: $120
        confidence_level:
          type: integer
          description: Contact's confidence level (in percents %)
          example: 10
        deal_close_date:
          type: string
          description: Customer Deal Close Date W3C format
          example: "2022-05-15T06:31:00+00:00"
        assigned_user:
          type: object
          description: Assigned User Details (the property does not exist if no user assigned)
          properties:
            id:
              type: integer
              description: Assigned User ID
            name:
              type: string
              description: Assigned User Name
          required:
            - id
            - name
        status:
          $ref: "#/components/schemas/ContactStatusTitle"
        stage:
          $ref: "#/components/schemas/ContactStageTitle"
        tags:
          description: Tags for the contact
          type: array
          items:
            type: object
            properties:
              id:
                description: Tag ID
                type: integer
              title:
                type: string
                description: Tag title
        facebook_url:
          type: string
          description: Facebook URL
        twitter_url:
          type: string
          description: Twittwe URL
        linkedin_url:
          type: string
          description: LinkedIn URL
        instagram_url:
          type: string
          description: Instagram URL
        permissions:
          description: Designate which actions are available to current user for company
          type: object
          properties:
            make_call:
              type: boolean
              description: User can call this company
            show_status:
              type: boolean
              description: Show status on the contact details or edit/add form
            show_stage:
              type: boolean
              description: Show stage on the contact details or edit/add form
            change_status:
              type: boolean
              description: Ability to change the status for contact
            change_stage:
              type: boolean
              description: Ability to change the stage for contact
    OrganizationEdit:
      description: Organization information for add/edit
      type: object
      properties:
        title:
          type: string
          description: Title
        phones:
          type: array
          description: Phone numbers array (short_phone - phone number without phone prefix, country - country name (the list of available countries, prefixes etc. you can get from GET /common/app-phones-prefixes) , type - phone type (the list of available values you can get from GET /common/app-phone-types) extension - extension or empty)
          items:
            type: object
            properties:
              short_phone:
                type: string
              country: 
                type: string
              type: 
                type: string
              extension: 
                type: string
            required:
              - short_phone
              - country
              - type
        email:
          type: string
          description: Phone number (formatted)
        address_formatted:
          type: string
          description: Address Formatted
        address:
          type: object
          description: Address
          properties:
            street_address:
              type: string
            city:
              type: string
            state:
              $ref: "#/components/schemas/State2SymbolsUSA"
            zip:
              type: string
            country:
              type: string
        website:
          type: string
          description: Website
        employee_size:
          $ref: "#/components/schemas/Range1_500"
        value:
          type: integer
          description: Value
        confidence_level:
          type: integer
          description: Contact's confidence level
          example: 10
        deal_close_date_month:
          type: string
          description: Customer Deal Close Date (Month) )
          example: "11"
        deal_close_date_day:
          type: string
          description: Customer Deal Close Date (Day) )
          example: "24"
        deal_close_date_year:
          type: string
          description: Customer Deal Close Date (Year) )
          example: "2022"
        assigned_user:
          type: object
          properties:
            id:
              type: integer
              description: Assigned User ID
          required:
            - id
        status:
          $ref: "#/components/schemas/ContactStatusValue"
        stage:
          $ref: "#/components/schemas/ContactStageValue"
        business_category:
          type: string
          description: Business Category
        sic_code:
          type: string
          description: SIC Code
        facebook_url:
          type: string
          description: Facebook URL
        twitter_url:
          type: string
          description: Twittwe URL
        linkedin_url:
          type: string
          description: LinkedIn URL
        instagram_url:
          type: string
          description: Instagram URL
      required:
        - title
    ShareViaSMS:
      description: share content via sms (Content section)
      type: object
      properties:
        phone:
          type: string
          description: Phone number (formatted)
        message:
          type: string
          description: check this out!
        schedule_time_in_seconds:
          type: integer
          description: schedule time to share (in seconds). 0 - to send immediately
          example: 1800
      required:
        - phone
        - message
    ShareOnSocial:
      description: share content on social media (Content section)
      type: object
      properties:
        message:
          type: string
          description: check this out!
        schedule_time_in_seconds:
          type: integer
          description: schedule time to share (in seconds). 0 - to send immediately
          example: 1800
      required:
        - message
    Range1_500:
      type: string
      minLength: 1
      example: "11-50"
      enum:
        - 1-10
        - 11-50
        - 51-100
        - 101-200
        - 201-500
        - 501++
    Reward:
      type: object
      properties:
        title:
          type: string
          description: Reward title
        value:
          type: integer
          description: Reward price in cents or points amount
        is_money:
          type: boolean
          description: true when reward is money, false when reward is points
    ShareableItem:
      type: object
      properties:
        title:
          type: string
          description: Title
        thumbnail:
          type: string
          description: Thumbnail URL (optional)
        rewards:
          type: object
          description: Rewards for the item (sale - rewards for the sale, lead - reward for a new lead, success - reward when lead became client)
          properties:
            sale:
              $ref: "#/components/schemas/Reward"
            lead:
              $ref: "#/components/schemas/Reward"
            success:
              $ref: "#/components/schemas/Reward"
        share:
          type: object
          properties:
            permissions:
              type: object
              properties:
                facebook_pages_available:
                  type: boolean
                  description: Available to share on facebook pages via API
                twitter_available:
                  type: boolean
                  description: Available to share on twitter via API
                linkedin_available:
                  type: boolean
                  description: Available to share on linkedin via API
                embed_available:
                  type: boolean
                  description: Available to embed
                email_available:
                  type: boolean
                  description: Available to share by email
                sms_available:
                  type: boolean
                  description: Available to share by SMS message
              required:
                - facebook_pages_available
                - twitter_available
                - linkedin_available
                - embed_available
                - email_available
                - sms_available
            embed:
              type: string
              description: Code to embed
            email:
              type: object
              description: Information to pass to the email client
              properties:
                subject:
                  type: string
                  description: Email subject
                message:
                  type: string
                  description: Email message
          required:
            - permissions
      required:
        - title
        - share
    State2SymbolsUSA:
      type: string
      minLength: 1
      example: "AL"
      enum:
        - AL
        - AK
        - AZ
        - AR
        - CA
        - CO
        - CT
        - DE
        - FL
        - GA
        - HI
        - ID
        - IL
        - IN
        - IA
        - KS
        - KY
        - LA
        - ME
        - MD
        - MA
        - MI
        - MN
        - MS
        - MO
        - MT
        - NE
        - NV
        - NH
        - NJ
        - NM
        - NY
        - NC
        - ND
        - OH
        - OK
        - OR
        - PA
        - RI
        - SC
        - SD
        - TN
        - TX
        - UT
        - VT
        - VA
        - WA
        - WV
        - WI
        - WY
    Tag:
      description: Information about the tag
      type: object
      properties:
        id:
          type: integer
          description: tag ID
        title:
          type: string
          description: Title to display
      required:
      - id
      - title
    PaginationInformation:
      description: Information for paggination/loading
      type: object
      properties:
        total_items:
          type: integer
          description: Total items for currrent request
        current_limit:
          type: integer
          description: current `limit` value
        current_offset:
          type: integer
          description: current `offset` value
    SMSInfo:
      description: Information about SMS
      type: object
      properties:
        id:
          type: integer
          description: call ID
        contact_id:
          type: integer
          description: ID of the contact (`0` if no contact)
        user_id:
          type: integer
          description: ID of the user (`0` if no user)
        time:
          type: string
          description: Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        text:
          type: string
          description: Content of the message
      required:
      - id
      - contact_id
      - user_id
      - time
      - text
    StringSetVal:
      description: Structure for submitting the data
      type: object
      properties:
        set:
          type: string
          example: "test"
      required:
        - set
    CommunicationChannel:
      type: string
      enum:
        - email
        - sms
    SupportTicketAdd:
      type: object
      description: Attention! Additional fields requerements depends on fields settings.
      properties:
        subject:
          type: string
          description: Subject
        text:
          type: string
          description: Text of the ticket
        priority:
          $ref: '#/components/schemas/SupportTicketPriority'
        status:
          $ref: '#/components/schemas/SupportTicketStatus'
        time_due:
          type: object
          description: time due
          properties:
            year:
              type: integer
              description: Year in 4 digits fromat
            month:
              type: integer
              description: Month from 1 to 12
            day:
              type: integer
              description: Day from 1 to 31
        department:
          type: integer
          description: department ID
        assigned_user:
          type: integer
          description: Assigned User ID
        contact_id:
          type: integer
          description: ID of the contact
        additional:
          description: Additional fields values
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
                description: Field ID
              value:
                type: string
                description: Field value
            required:
            - id
            - value
        attachments:
          type: array
          items:
            type: integer
            description: "ID of the file uploaded with `POST /file-upload/generic-multipart`"
        communication_channel:
          $ref: '#/components/schemas/CommunicationChannel'
      required:
      - subject
      - text
      - priority
      - status
    SupportTicketBrief:
      type: object
      properties:
        id:
          type: integer
          description: Ticket ID
        index:
          type: string
          description: Ticket ID to display to user
        subject:
          type: string
          description: Subject
        text:
          type: string
          description: Text of the ticket
        priority:
          type: object
          properties:
            tag:
              $ref: '#/components/schemas/SupportTicketPriority'
            title:
              type: string
              description: name of the priority
          required:
          - tag
          - title
        status:
          type: object
          properties:
            tag:
              type: string
              description: status tag value. `active` - initial status, `closed` - finalized status. There will be other statuses, configureable from database. All other statuses except these two mean that ticket is in processing.
            title:
              type: string
              description: name of the status
          required:
          - tag
          - title
        time_created:
          type: string
          description: created time in W3C format
          example: "2022-05-15T06:31:00+00:00"
        time_updated:
          type: string
          description: last updated time in W3C format
          example: "2022-05-15T06:31:00+00:00"
        time_due:
          type: string
          description: time due in W3C format
          example: "2022-05-15T06:31:00+00:00"
        age:
          type: string
          description: time passed from the start (readable format)
          example: "1 hr 10 min"
        time_spent_sec:
          type: integer
          description: time spent for this ticket (in seconds)
          example: 1800
        attachments:
          type: array
          description: attachments for the ticket (absent if no attachments)
          items:
            type: object
            properties:
              thumb:
                type: string
                description: URL of thumb image
              file:
                type: string
                description: URL of the file to download/display
            required:
            - file
        department:
          type: object
          description: department info (absent if no department)
          properties:
            id:
              type: integer
              description: department ID
            title:
              type: string
              example: "Finance Department"
          required:
          - id
          - title
        assigned_user:
          type: object
          description: Assigned User Details (absent if no user assigned)
          properties:
            id:
              type: integer
              description: Assigned User ID
            name:
              type: string
              description: Assigned User Name
          required:
            - id
            - name
        organization:
          type: object
          description: Organization info (absent if no user assigned)
          properties:
            id:
              type: integer
              description: Organization ID
            title:
              type: string
              description: Organization Title
          required:
          - id
          - title
        assigned_contact:
          type: object
          description: Assigned Support Contact ID
          properties:
            id:
              type: integer
              description: Assigned Support Contact ID
            name:
              type: string
              description: Assigned Support Contact Name
          required:
          - id
          - name
        additional:
          description: Additional fields values
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
                description: Field ID
              type:
                description: Field type
                type: string
                enum:
                - select
                - input
                - checkbox
              title:
                type: string
                description: Field title
              value:
                type: string
                description: Field value
            required:
            - type
            - title
            - value
      required:
      - id
      - index
      - subject
      - text
      - priority
      - status
      - time_created
      - time_due
      - age
      - time_spent_sec
    SupportTicketDetails:
      type: object
      properties:
        id:
          type: integer
          description: Ticket ID
        index:
          type: string
          description: Ticket ID to display to user
        subject:
          type: string
          description: Subject
        text:
          type: string
          description: Text of the ticket (usually empty)
        priority:
          type: object
          properties:
            tag:
              $ref: '#/components/schemas/SupportTicketPriority'
            title:
              type: string
              description: name of the priority
          required:
          - tag
          - title
        status:
          type: object
          properties:
            tag:
              type: string
              description: status tag value. `active` - initial status, `closed` - finalized status. There will be other statuses, configureable from database. All other statuses except these two mean that ticket is in processing.
            title:
              type: string
              description: name of the status
          required:
          - tag
          - title
        time_created:
          type: string
          description: created time in W3C format
          example: "2022-05-15T06:31:00+00:00"
        time_updated:
          type: string
          description: last updated time in W3C format
          example: "2022-05-15T06:31:00+00:00"
        time_due:
          type: string
          description: time due in W3C format
          example: "2022-05-15T06:31:00+00:00"
        age:
          type: string
          description: time passed from the start (readable format)
          example: "1 hr 10 min"
        time_spent_sec:
          type: integer
          description: time spent for this ticket (in seconds)
          example: 1800
        attachments:
          type: array
          description: attachments for the ticket (absent if no attachments)
          items:
            type: object
            properties:
              thumb:
                type: string
                description: URL of thumb image
              file:
                type: string
                description: URL of the file to download/display
            required:
            - file
        department:
          type: object
          description: department info (absent if no department)
          properties:
            id:
              type: integer
              description: department ID
            title:
              type: string
              example: "Finance Department"
          required:
          - id
          - title
        assigned_user:
          type: object
          description: Assigned User Details (absent if no user assigned)
          properties:
            id:
              type: integer
              description: Assigned User ID
            name:
              type: string
              description: Assigned User Name
          required:
          - id
          - name
        organization:
          type: object
          description: Organization info (absent if no user assigned)
          properties:
            id:
              type: integer
              description: Organization ID
            title:
              type: string
              description: Organization Title
          required:
            - id
            - title
        assigned_contact:
          type: object
          description: Assigned Support Contact Details (absent if no contact assigned)
          properties:
            id:
              type: integer
              description: Assigned Support Contact ID
            name:
              type: string
              description: Assigned Support Contact Name
          required:
          - id
          - name
        additional:
          description: Additional fields values
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
                description: Field ID
              type:
                description: Field type
                type: string
                enum:
                - select
                - input
                - checkbox
              title:
                type: string
                description: Field title
              value:
                type: string
                description: Field value
            required:
            - type
            - title
            - value
        tags:
          description: Tags for the ticket
          type: array
          items:
            type: object
            properties:
              id:
                description: Tag ID
                type: integer
              title:
                type: string
                description: Tag title
      required:
      - id
      - index
      - subject
      - priority
      - status
      - time_created
      - time_due
      - age
      - time_spent_sec
    SupportTicketMessage:
      description: Information about message in conversation for ticket
      type: object
      properties:
        id:
          type: integer
          description: Message ID
        text:
          type: string
          description: message in HTML format
        added_time:
          type: string
          description: Added Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        direction:
          type: string
          description: Direction
          enum:
            - incoming
            - outgoing
        sender_name:
          type: string
          description: Name of the sender
        attachments:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
                description: Attachment ID
              thumb_url:
                type: string
                description: Thumbnail URL
              download_url:
                type: string
                description: URL to download
              title:
                type: string
                description: File title
            required:
              - id
              - thumb_url
              - download_url
              - title
      required:
        - id
        - text
        - added_time
        - direction
        - sender_name
    SubTypeList:
      description: Custom Field available options (if select or checkbox etc.)
      type: object
      properties:
        id:
          type: integer
          description: Sub Type ID
        title:
          type: string
          description: Title to display
      required:
        - id
        - title
    SupportTicketNote:
      description: Information about note for ticket
      type: object
      properties:
        id:
          type: integer
          description: Note ID
        id_ticket:
          type: integer
          description: Ticket ID
        text:
          type: string
          description: text in HTML format
        added_time:
          type: string
          description: Added Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        user:
          type: array
          description: User info (who created a ticket)
          items:
            type: object
            properties:
              id:
                type: integer
                description: User ID
              initial:
                type: string
                description: User Initials
              name:
                type: string
                description: User Name
            required:
              - id
              - initial
              - name
        attachments:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
                description: Attachment ID
              thumb_url:
                type: string
                description: Thumbnail URL
              download_url:
                type: string
                description: URL to download
              title:
                type: string
                description: File title
            required:
              - id
              - thumb_url
              - download_url
              - title
      required:
        - id
        - id_ticket
        - text
        - added_time
    SupportTicketTimeLog:
      description: Information about Time Log for ticket
      type: object
      properties:
        id:
          type: integer
          description: Time Log ID
        text:
          type: string
          description: text in HTML format
        time_start:
          type: string
          description: Start Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        time_end:
          type: string
          description: Stop Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        duration:
          type: string
          description: Duration Time
          example: "5m 0s"
        user:
          type: array
          description: User info (who created a Time Record)
          items:
            type: object
            properties:
              id:
                type: integer
                description: User ID
              name:
                type: string
                description: User Name
            required:
              - id
              - name
      required:
        - id
        - time_start
        - time_end
        - duration
    SupportTicketTimeLogDetails:
      description: Information about time log
      type: object
      properties:
        id:
          type: integer
          description: Time Log ID
        text:
          type: string
          description: text in HTML format
        time_start:
          type: string
          description: Start Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        time_end:
          type: string
          description: Stop Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        duration:
          type: string
          description: Duration Time
          example: "5m 0s"
        user:
          type: array
          description: User info (who created a Time Record)
          items:
            type: object
            properties:
              id:
                type: integer
                description: User ID
              name:
                type: string
                description: User Name
            required:
              - id
              - name
        attachments:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
                description: Attachment ID
              thumb_url:
                type: string
                description: Thumbnail URL
              download_url:
                type: string
                description: URL to download
              title:
                type: string
                description: File title
            required:
              - id
              - thumb_url
              - download_url
              - title
        notes:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
                description: Note ID
              text:
                type: string
                description: text in HTML format
              added_time:
                type: string
                description: Added Time (W3C format)
                example: "2022-05-24T01:18:00+00:00"
            required:
              - id
              - text
              - added_time
      required:
        - id
        - time_start
        - time_end
        - duration
    SupportTicketPriority:
      type: string
      enum:
        - low
        - medium
        - high
    SupportTicketStatus:
      type: string
      description: status tag value. `active` - initial status, `closed` - finalized status. There will be other statuses, configureable from database `GET /support/statuses`. All other statuses except these two mean that ticket is in processing.
    TaskInfo:
      description: Information about Task
      type: object
      properties:
        id:
          type: integer
          description: ID
        contact_id:
          type: integer
          description: ID of the contact (`0` if no contact)
        user_id:
          type: integer
          description: ID of the user (`0` if no user)
        time_created:
          type: string
          description: Created Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        time_scheduled:
          type: string
          description: Scheduled Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        priority:
          type: string
          description: Task Priority
        status:
          type: string
          description: Task Status
        text:
          type: string
          description: Task description/notes
      required:
      - id
      - contact_id
      - user_id
      - time
      - text
    BookedCallInfo:
      description: Information about Task
      type: object
      properties:
        id:
          type: integer
          description: ID
        contact_id:
          type: integer
          description: ID of the contact (`0` if no contact)
        user_id:
          type: integer
          description: ID of the user (`0` if no user)
        time_created:
          type: string
          description: Created Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        time_scheduled:
          type: string
          description: Scheduled Time (W3C format)
          example: "2022-05-24T01:18:00+00:00"
        status:
          type: string
          description: Task Status
        text:
          type: string
          description: Task description/notes
        cancel_url:
          type: string
          description: Cancel Booked Call URL
        reschedule_url:
          type: string
          description: Reschedule Booked Call URL
      required:
        - id
        - contact_id
        - user_id
        - time_created
        - time_scheduled
    UserBrief:
      description: Information about the user
      type: object
      properties:
        id:
          type: integer
          description: User ID
        title:
          type: string
          description: Name to display
      required:
      - id
      - title
    WebView:
      description: Information about the user
      type: object
      properties:
        url:
          type: string
          description: URL to open in web-view
          example: "https://your-crm-domain.com/index.php?m=account"
      required:
      - url