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

# alerts histogram for this contract



## OpenAPI

````yaml /openapi.json post /api/v1/contract/{id}/histogram
openapi: 3.0.3
info:
  title: Extractor Project (dev)
  version: 0.0.649
servers: []
security: []
paths:
  /api/v1/contract/{id}/histogram:
    post:
      tags:
        - Contract Route
      summary: alerts histogram for this contract
      parameters:
        - name: id
          in: path
          required: true
          schema:
            format: int64
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HistogramRequestDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractHistogramDto'
      security:
        - SecurityScheme: []
components:
  schemas:
    HistogramRequestDto:
      required:
        - from
        - to
        - interval
      type: object
      properties:
        query:
          description: >-
            Query string according to
            https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html
            with Default: auto_generate_synonyms_phrase_query=false,
            fuzzy_max_expansions=0, fuzzy_transpositions=false
          type: string
          example: address:0xdAC17F958D2ee523a2206206994597C13D831ec7
        from:
          format: int64
          description: From milliseconds timestamp for histogram calculation
          minimum: 0
          type: integer
        to:
          format: int64
          description: To milliseconds timestamp for histogram calculation
          minimum: 0
          type: integer
        interval:
          description: 'Interval for histogram buckets calculation. Example: 1h, 3h, 1d, 1M'
          type: string
          example: 1d
        timezone:
          description: 'TimeZone for histogram buckets calculation. Default: UTC'
          type: string
          example: '-01:00'
    ContractHistogramDto:
      type: object
      properties:
        data:
          description: Response data
          type: array
          items:
            $ref: '#/components/schemas/ContractHistogramBucketDto'
        total:
          description: Total counts of different group of alerts for this contract
          type: object
          additionalProperties:
            format: int64
            type: integer
          example:
            SECURITY: 1
            COMPLIANCE: 2
            action: 3
            trigger: 4
        count:
          description: Count of different entries associated with the extractor contract
          type: object
          additionalProperties:
            format: int32
            type: integer
          example:
            SECURITY: 1
            COMPLIANCE: 2
            action: 3
            trigger: 4
    ContractHistogramBucketDto:
      type: object
      properties:
        ts:
          format: int64
          description: Timestamp milliseconds for this histogram bucket
          type: integer
        bucket:
          description: Histogram bucket data for different groups of alerts
          type: object
          additionalProperties:
            $ref: '#/components/schemas/ContractHistogramBucketDataDto'
          example:
            SECURITY:
              count: 2
              maxSeverity: CRITICAL
            COMPLIANCE:
              count: 2
              maxSeverity: CRITICAL
            action:
              count: 1
              maxSeverity: HIGH
            trigger:
              count: 1
              maxSeverity: LOW
    ContractHistogramBucketDataDto:
      type: object
      properties:
        count:
          format: int64
          description: Total count of alerts for this histogram bucket
          type: integer
        maxSeverity:
          description: Max severity level for this histogram bucket
          type: string
          allOf:
            - $ref: '#/components/schemas/SeverityLevel'
    SeverityLevel:
      enum:
        - INFO
        - LOW
        - MEDIUM
        - HIGH
        - CRITICAL
      type: string
  securitySchemes:
    SecurityScheme:
      type: http
      description: Authentication
      scheme: bearer
      bearerFormat: JWT

````