> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ocean.security/llms.txt
> Use this file to discover all available pages before exploring further.

# Get top threat types

> Returns a list of the top 5 threat types and their counts within the specified time period.



## OpenAPI

````yaml get /api/v1/metrics/top_threat_types
openapi: 3.0.0
info:
  contact: {}
  title: Ocean Security 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: Threats
    description: Operations for retrieving threat information
  - name: Metrics
    description: Security metrics and analytics endpoints
paths:
  /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'
components:
  schemas:
    ocean_api_common.BaseResponse-controllers_metrics_TopThreatTypesResult:
      properties:
        results:
          $ref: '#/components/schemas/controllers_metrics.TopThreatTypesResult'
        status:
          type: integer
      type: object
    types.ErrorResponse:
      properties:
        error:
          type: string
      type: object
    controllers_metrics.TopThreatTypesResult:
      properties:
        items:
          items:
            $ref: '#/components/schemas/controllers_metrics.TopThreatTypeRow'
          type: array
      type: object
    controllers_metrics.TopThreatTypeRow:
      properties:
        count_threats:
          type: number
        type:
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: API key for authentication

````