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

# Calculate Key Rate Durations

> Measures sensitivity to changes in specific points (key rates) along the yield curve while holding other rates constant. More precise than overall duration for understanding where yield curve exposure lies. Essential for bullet vs barbell strategies and curve positioning trades. [Tier: PRO, Credits: 5]



## OpenAPI

````yaml api-specs/risk.json post /quantlib/risk/sensitivities/key-rate-duration
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Risk Module
  description: >-
    Professional-grade risk management endpoints including Value at Risk (VaR),
    stress testing, copulas, extreme value theory (EVT), XVA calculations,
    sensitivities, and portfolio hedging. Part of the Pro Tier (5 credits per
    request).
  version: 3.0.0
  contact:
    name: Fincept API Support
    url: https://fincept.in
    email: support@fincept.in
servers:
  - url: https://api.fincept.in
    description: Fincept API Production Server
security:
  - APIKeyHeader: []
tags:
  - name: quantlib-risk
    description: Risk Management Module - Pro Tier (5 credits/request)
    x-displayName: Risk
paths:
  /quantlib/risk/sensitivities/key-rate-duration:
    post:
      tags:
        - quantlib-risk
      summary: Calculate Key Rate Durations
      description: >-
        Measures sensitivity to changes in specific points (key rates) along the
        yield curve while holding other rates constant. More precise than
        overall duration for understanding where yield curve exposure lies.
        Essential for bullet vs barbell strategies and curve positioning trades.
        [Tier: PRO, Credits: 5]
      operationId: key_rate_dur
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - cashflows
                - times
                - curve_rates
              properties:
                cashflows:
                  type: array
                  description: Bond cashflows (coupon payments and principal)
                  items:
                    type: number
                  example:
                    - 5
                    - 5
                    - 5
                    - 105
                times:
                  type: array
                  description: Time points (in years) when cashflows occur
                  items:
                    type: number
                  example:
                    - 1
                    - 2
                    - 3
                    - 4
                curve_rates:
                  type: array
                  description: Current yield curve rates at each time point
                  items:
                    type: number
                  example:
                    - 0.02
                    - 0.025
                    - 0.03
                    - 0.035
                bump_size:
                  type: number
                  description: Rate bump size for sensitivity calculation
                  example: 0.0001
                  default: 0.0001
            example:
              cashflows:
                - 50
                - 50
                - 50
                - 50
                - 1050
              times:
                - 1
                - 2
                - 3
                - 4
                - 5
              curve_rates:
                - 0.025
                - 0.028
                - 0.03
                - 0.032
                - 0.034
              bump_size: 0.0001
      responses:
        '200':
          description: Key rate durations
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      key_rate_durations:
                        type: array
                        description: Duration contribution at each key rate
                        items:
                          type: number
                        example:
                          - 0.95
                          - 1.82
                          - 2.68
                          - 3.45
                          - 4.15
              example:
                success: true
                data:
                  key_rate_durations:
                    - 0.95
                    - 1.82
                    - 2.68
                    - 3.45
                    - 4.15
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/InsufficientCreditsError'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  responses:
    UnauthorizedError:
      description: Authentication information is missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Invalid API key
    InsufficientCreditsError:
      description: Insufficient API credits for this request
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Insufficient credits. This endpoint requires 5 credits.
    ValidationError:
      description: Request validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: array
                items:
                  type: object
                  properties:
                    loc:
                      type: array
                      items:
                        type: string
                    msg:
                      type: string
                    type:
                      type: string
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for authentication. Get your key at
        https://api.fincept.in/auth/register

````