Ocean Security Metrics API

Security metrics and analytics endpoints

OpenAPI Specification

ocean-security-metrics-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  contact: {}
  title: Ocean Security Metrics API
  version: 1.0.0
  description: Ocean Security API for threat detection and security metrics
servers:
- url: https://api.ocean.security
  description: Production server
security:
- ApiKeyAuth: []
tags:
- name: Metrics
  description: Security metrics and analytics endpoints
paths:
  /api/v1/metrics/hours_saved:
    get:
      tags:
      - Metrics
      summary: Get hours saved metric
      description: Calculates the estimated hours saved based on prevented threats within the specified time period.
      parameters:
      - description: Authentication API Key
        in: header
        name: X-Api-Key
        required: true
        schema:
          type: string
      - description: Number of days to look back (default 30)
        in: query
        name: days_ago
        schema:
          type: integer
      responses:
        '200':
          description: Estimated hours saved metric
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ocean_api_common.BaseResponse-controllers_metrics_hoursSavedResult'
        '400':
          description: Invalid input parameters (e.g., invalid days_ago)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '401':
          description: Unauthorized (invalid or missing API Key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
      operationId: getHoursSavedMetric
  /api/v1/metrics/prevented_loss:
    get:
      tags:
      - Metrics
      summary: Get prevented financial loss metric (USD)
      description: Calculates the total estimated financial loss prevented (in USD) based on threats within the specified time period.
      parameters:
      - description: Authentication API Key
        in: header
        name: X-Api-Key
        required: true
        schema:
          type: string
      - description: Number of days to look back (default 30)
        in: query
        name: days_ago
        schema:
          type: integer
      responses:
        '200':
          description: Estimated financial loss prevented (USD)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ocean_api_common.BaseResponse-controllers_metrics_preventedLossResult'
        '400':
          description: Invalid input parameters (e.g., invalid days_ago)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '401':
          description: Unauthorized (invalid or missing API Key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
      operationId: getPreventedFinancialLoss
  /api/v1/metrics/protected_inboxes:
    get:
      tags:
      - Metrics
      summary: Get protected inboxes count
      description: Retrieves the count of unique protected inboxes that received mail within the specified time period.
      parameters:
      - description: Authentication API Key
        in: header
        name: X-Api-Key
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Count of protected inboxes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ocean_api_common.BaseResponse-controllers_metrics_protectedInboxesResult'
        '401':
          description: Unauthorized (invalid or missing API Key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
      operationId: getProtectedInboxesCount
  /api/v1/metrics/threats_over_time:
    get:
      tags:
      - Metrics
      summary: Get threats over time metric
      description: Returns the count of threats grouped by day for the specified time period.
      parameters:
      - description: Authentication API Key
        in: header
        name: X-Api-Key
        required: true
        schema:
          type: string
      - description: Number of days to look back (default 7)
        in: query
        name: days_ago
        schema:
          type: integer
      - description: Page number for pagination (default 1)
        in: query
        name: page
        schema:
          type: integer
      responses:
        '200':
          description: A paginated list of daily threat counts
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/common.PaginatedResponse'
                - properties:
                    results:
                      $ref: '#/components/schemas/controllers_metrics.threatsOverTimeResult'
                  type: object
        '400':
          description: Invalid input parameters (e.g., invalid days_ago)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '401':
          description: Unauthorized (invalid or missing API Key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
      operationId: getThreatsOverTime
  /api/v1/metrics/highlighted_threats:
    get:
      tags:
      - Metrics
      summary: Get top highlighted threats
      description: Retrieves a list of the top 5 highlighted threats within the specified time period.
      parameters:
      - description: Authentication API Key
        in: header
        name: X-Api-Key
        required: true
        schema:
          type: string
      - description: Number of days to look back (default 7)
        in: query
        name: days_ago
        schema:
          type: integer
      responses:
        '200':
          description: A list of top 5 highlighted threats
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ocean_api_common.BaseResponse-controllers_metrics_highlightedThreatsResult'
        '400':
          description: Invalid input parameters (e.g., invalid days_ago)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '401':
          description: Unauthorized (invalid or missing API Key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
      operationId: getTopHighlightedThreats
  /api/v1/metrics/top_targeted_entities:
    get:
      tags:
      - Metrics
      summary: Get top targeted entities
      description: Returns a list of the top 5 targeted entities (users or groups) based on threat count within the specified time period.
      parameters:
      - description: Authentication API Key
        in: header
        name: X-Api-Key
        required: true
        schema:
          type: string
      - description: Number of days to look back (default 7)
        in: query
        name: days_ago
        schema:
          type: integer
      - description: Type of entity to query ('user' or 'group', default 'user')
        in: query
        name: type
        schema:
          type: string
      responses:
        '200':
          description: List of top targeted entities and their threat counts
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ocean_api_common.BaseResponse-controllers_metrics_topTargetedEntitiesResult'
        '400':
          description: Invalid input parameters (e.g., invalid days_ago, type, or limit)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '401':
          description: Unauthorized (invalid or missing API Key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
      operationId: getTopTargetedEntities
  /api/v1/metrics/top_threat_types:
    get:
      tags:
      - Metrics
      summary: Get top threat types
      description: Returns a list of the top 5 threat types and their counts within the specified time period.
      parameters:
      - description: Authentication API Key
        in: header
        name: X-Api-Key
        required: true
        schema:
          type: string
      - description: Number of days to look back (default 7)
        in: query
        name: days_ago
        schema:
          type: integer
      responses:
        '200':
          description: List of top threat types and their counts
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ocean_api_common.BaseResponse-controllers_metrics_topThreatTypesResult'
        '400':
          description: Invalid input parameters (e.g., invalid days_ago or limit)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '401':
          description: Unauthorized (invalid or missing API Key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.ErrorResponse'
      operationId: getTopThreatTypes
components:
  schemas:
    controllers_metrics.preventedLossResult:
      properties:
        currency:
          type: string
        prevented_loss:
          type: integer
      type: object
    ocean_api_common.BaseResponse-controllers_metrics_highlightedThreatsResult:
      properties:
        results:
          $ref: '#/components/schemas/controllers_metrics.highlightedThreatsResult'
        status:
          type: integer
      type: object
    common.PaginationParams:
      properties:
        page:
          description: Current page number (1-based)
          type: integer
        page_size:
          description: Number of items on this page (max 100)
          type: integer
        total:
          description: Total number of items
          type: integer
      type: object
    controllers_metrics.TopTargetedEntityRow:
      properties:
        count_threats:
          type: number
        full_name:
          type: string
        job_title:
          type: string
      type: object
    controllers_metrics.hoursSavedResult:
      properties:
        hours_saved:
          type: integer
      type: object
    types.ErrorResponse:
      properties:
        error:
          type: string
      type: object
    controllers_metrics.highlightedThreatsResult:
      properties:
        items:
          items:
            $ref: '#/components/schemas/ocean_api_controllers_threats.ThreatItem'
          type: array
      type: object
    common.PaginatedResponse:
      properties:
        pagination:
          allOf:
          - $ref: '#/components/schemas/common.PaginationParams'
          description: Pagination information
        results:
          description: The actual data
        status:
          description: HTTP status code
          type: integer
      type: object
    ocean_api_common.BaseResponse-controllers_metrics_topTargetedEntitiesResult:
      properties:
        results:
          $ref: '#/components/schemas/controllers_metrics.topTargetedEntitiesResult'
        status:
          type: integer
      type: object
    controllers_metrics.topThreatTypesResult:
      properties:
        items:
          items:
            $ref: '#/components/schemas/controllers_metrics.TopThreatTypeRow'
          type: array
      type: object
    ocean_api_common.BaseResponse-controllers_metrics_protectedInboxesResult:
      properties:
        results:
          $ref: '#/components/schemas/controllers_metrics.protectedInboxesResult'
        status:
          type: integer
      type: object
    controllers_metrics.topTargetedEntitiesResult:
      properties:
        items:
          items:
            $ref: '#/components/schemas/controllers_metrics.TopTargetedEntityRow'
          type: array
      type: object
    ocean_api_common.BaseResponse-controllers_metrics_preventedLossResult:
      properties:
        results:
          $ref: '#/components/schemas/controllers_metrics.preventedLossResult'
        status:
          type: integer
      type: object
    controllers_metrics.TopThreatTypeRow:
      properties:
        count_threats:
          type: number
        type:
          type: string
      type: object
    ocean_api_controllers_threats.ThreatItem:
      properties:
        detection_time:
          example: '1970-01-01T11:59:59.000Z'
          format: date-time
          type: string
        id:
          type: string
        recipient_email:
          type: string
        recipient_name:
          type: string
        remediation_time:
          example: '1970-01-01T11:59:59.000Z'
          format: date-time
          type: string
        sender_email:
          type: string
        sender_name:
          type: string
        source:
          type: string
        subject:
          type: string
        threat_indicators:
          items:
            $ref: '#/components/schemas/ocean_api_controllers_threats.ThreatIndicator'
          type: array
        threat_type:
          type: string
        time:
          example: '1970-01-01T11:59:59.000Z'
          format: date-time
          type: string
      type: object
    ocean_api_common.BaseResponse-controllers_metrics_hoursSavedResult:
      properties:
        results:
          $ref: '#/components/schemas/controllers_metrics.hoursSavedResult'
        status:
          type: integer
      type: object
    ocean_api_common.BaseResponse-controllers_metrics_topThreatTypesResult:
      properties:
        results:
          $ref: '#/components/schemas/controllers_metrics.topThreatTypesResult'
        status:
          type: integer
      type: object
    controllers_metrics.ThreatsOverTimeRow:
      properties:
        count_threats:
          type: number
        date:
          example: '1970-01-01T00:00:00.000Z'
          format: date
          type: string
      type: object
    ocean_api_controllers_threats.ThreatIndicator:
      properties:
        indicator_type:
          type: string
      type: object
    controllers_metrics.protectedInboxesResult:
      properties:
        protected_inboxes:
          type: integer
      type: object
    controllers_metrics.threatsOverTimeResult:
      properties:
        items:
          items:
            $ref: '#/components/schemas/controllers_metrics.ThreatsOverTimeRow'
          type: array
      type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: API key for authentication