> ## Documentation Index
> Fetch the complete documentation index at: https://api-reference.hyperswitch.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Routing Events

> ClickHouse-backed routing events read endpoint.



## OpenAPI

````yaml decision_engine_openapi-specs.json GET /analytics/routing-events
openapi: 3.1.0
info:
  title: Decision Engine
  description: >-
    Open-source payment gateway routing service by Juspay. Selects the optimal
    payment processor for each transaction in real-time using success-rate
    scoring, rule-based routing, and elimination logic.


    ## Authentication


    This API supports two authentication methods:


    1. **JWT Bearer Token** - For dashboard/user sessions
       - Header: `Authorization: Bearer <jwt_token>`
       - Obtain via `/auth/login` endpoint

    2. **API Key** - For service-to-service/programmatic access
       - Header: `x-api-key: DE_<64_char_hex>`
       - Create via `/api-key/create` endpoint

    Protected endpoints require one of these authentication methods.
  version: 1.4.0
  contact:
    name: Juspay
    url: https://github.com/juspay/decision-engine
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
servers:
  - url: http://localhost:8080
    description: Local development
  - url: https://sandbox.hyperswitch.io
    description: 'Hyperswitch sandbox with x-feature: decision-engine'
security: []
tags:
  - name: Health
    description: Service liveness, readiness, and diagnostics
  - name: Auth
    description: Dashboard auth and merchant selection
  - name: API Keys
    description: Service-to-service API key management
  - name: Gateway Decision
    description: Core routing decision APIs
  - name: Score Feedback
    description: Feed transaction outcomes back to improve SR scoring
  - name: Merchant Account
    description: Merchant configuration management
  - name: Routing Rules
    description: Euclid declarative routing rules engine
  - name: Rule Configuration
    description: Service-level SR/elimination config
  - name: Config
    description: Routing key and dimension metadata
  - name: Analytics
    description: ClickHouse-backed analytics and audit reads
  - name: Compatibility
    description: Legacy compatibility routes
  - name: Connector Costs
  - name: Merchant Features
  - name: Autopilot
paths:
  /analytics/routing-events:
    get:
      tags:
        - Analytics
      summary: Routing events
      description: >-
        Historical feed of routing-relevant state changes: SR leader changes,
        gateways entering/exiting the multi-objective auth band, and autopilot
        calibration runs.
      operationId: analyticsRoutingEvents
      parameters:
        - name: x-tenant-id
          in: header
          required: true
          description: >-
            Tenant to resolve. The shipped config files define only the "public"
            tenant. No fallback — omitting this fails with TE_03.
          schema:
            type: string
            default: public
        - name: range
          in: query
          required: false
          schema:
            type: string
        - name: start_ms
          in: query
          required: false
          schema:
            type: integer
        - name: end_ms
          in: query
          required: false
          schema:
            type: integer
        - name: payment_method_type
          in: query
          required: false
          schema:
            type: string
        - name: payment_method
          in: query
          required: false
          schema:
            type: string
        - name: min_transaction_count
          in: query
          required: false
          schema:
            type: integer
        - name: min_score_delta
          in: query
          required: false
          schema:
            type: number
        - name: tolerance_pp
          in: query
          required: false
          schema:
            type: number
        - name: limit
          in: query
          required: false
          schema:
            type: integer
        - name: bucket
          in: query
          required: false
          schema:
            type: string
        - name: merchant_id
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutingEventsResponse'
      security:
        - BearerAuth: []
        - ApiKeyAuth: []
components:
  schemas:
    RoutingEventsResponse:
      type: object
      properties:
        merchant_id:
          type: string
        range:
          type: string
        events:
          type: array
          items:
            $ref: '#/components/schemas/RoutingEvent'
        generated_at_ms:
          type: integer
          format: int64
    RoutingEvent:
      type: object
      properties:
        id:
          type: string
        event_type:
          $ref: '#/components/schemas/RoutingEventType'
        merchant_id:
          type: string
        payment_method_type:
          type: string
          nullable: true
        payment_method:
          type: string
          nullable: true
        bucket_ms:
          type: integer
          format: int64
        gateway:
          type: string
        previous_gateway:
          type: string
          nullable: true
        score:
          type: number
          format: double
          nullable: true
        previous_score:
          type: number
          format: double
          nullable: true
        transaction_count:
          type: integer
          format: int64
          nullable: true
        bucket_size:
          type: integer
          format: int32
          nullable: true
        previous_bucket_size:
          type: integer
          format: int32
          nullable: true
        hedging_percent:
          type: number
          format: double
          nullable: true
        previous_hedging_percent:
          type: number
          format: double
          nullable: true
        card_network:
          type: string
          nullable: true
        currency:
          type: string
          nullable: true
        country:
          type: string
          nullable: true
        auth_type:
          type: string
          nullable: true
    RoutingEventType:
      type: string
      enum:
        - LeaderChanged
        - GatewayEnteredAuthBand
        - GatewayExitedAuthBand
        - CalibrationApplied
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token obtained from /auth/login
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key created via /api-key/create

````