openapi: 3.0.0
info:
  title: API Security
  description: >-
    Discover and monitor application APIs to protect your services against
    cybersecurity attacks and prevent sensitive data exposure.
  version: ''
tags: []
servers:
  - url: https://api.transmitsecurity.io/apisec
    description: Production environment (US)
paths:
  /v1/api/events:
    get:
      operationId: getEvents
      summary: Get all events
      description: Retrieves a list of requests processed by your endpoints.
      parameters:
        - name: endpoint
          required: false
          in: query
          description: >-
            Allows filtering endpoints by path. Supports regex and partial
            search.
          example: example.com
          schema:
            type: string
        - name: start_date
          required: false
          in: query
          description: >-
            Allows filtering events within a specific time interval. Defines the
            start date to filter events that occurred after this timestamp. If
            not specified, treated as 7 days ago. Maximum 90 days from
            'end_date'.
          example: '2024-01-01T00:00:00Z'
          schema:
            type: string
        - name: end_date
          required: false
          in: query
          description: >-
            Allows filtering events within a specific time interval. Defines the
            end of the period. If not specified, treated as now.
          example: '2024-01-07T00:00:00Z'
          schema:
            type: string
        - name: limit
          required: false
          in: query
          description: Limits the number of events in the response.
          example: 500
          schema:
            type: number
            default: 100
        - name: order
          required: false
          in: query
          description: >-
            Orders events by their 'publish_time' in descending (DESC) or
            ascending order (ASC).
          example: ASC
          schema:
            type: string
            default: DESC
        - name: host
          required: false
          in: query
          description: Searches events by the Host request header.
          example: api.transmitsecurity.io
          schema:
            type: string
        - name: user_agent
          required: false
          in: query
          description: Searches events by the User-Agent request header.
          schema:
            type: string
      responses:
        '200':
          description: Array of events containing the request and response data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetEventsResponseDto'
        '400':
          description: Bad request in case of invalid query parameters
        '401':
          description: Unauthorized access
      security:
        - bearer: []
  /v1/api/events/endpoints:
    get:
      operationId: getEndpointsCount
      summary: Get endpoints
      description: >-
        Retrieves all endpoint URIs with their occurrences in the descending
        order.
      parameters:
        - name: endpoint
          required: false
          in: query
          description: >-
            Allows filtering endpoints by path. Supports subpath and partial
            search.
          example: example.com
          schema:
            type: string
        - name: limit
          required: false
          in: query
          description: Limits the number of endpoints in the response.
          example: 500
          schema:
            type: number
            default: 100
      responses:
        '200':
          description: Array of endpoints
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GetEndpointMetaDataResponseDto'
        '400':
          description: Bad request in case of invalid query parameters
        '401':
          description: Unauthorized access
      security:
        - bearer: []
components:
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        An access token generated by the [token
        endpoint](/openapi/token.openapi/other/getaccesstoken)
  schemas:
    EventResponseDto:
      type: object
      properties:
        publish_time:
          type: string
          description: The timestamp the request occurred.
        uri:
          type: string
          description: The endpoint URI.
        request:
          type: object
          description: Request data.
        response:
          type: object
          description: Response data.
      required:
        - publish_time
        - uri
        - request
        - response
    GetEventsResponseDto:
      type: object
      properties:
        events:
          type: array
          items:
            $ref: '#/components/schemas/EventResponseDto'
      required:
        - events
    GetEndpointMetaDataResponseDto:
      type: object
      properties:
        occurrences:
          type: number
          description: The number of times the endpoint triggered.
        uri:
          type: string
          description: The endpoint URI.
      required:
        - occurrences
        - uri
