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

# Entity Rating Change

> Entity-level rating changes over a lookback window. Use to identify upgrades and downgrades across a portfolio.



## OpenAPI

````yaml /openapi/consensus-data.yaml post /analytics/v2/data/entityratingchange
openapi: 3.1.0
info:
  title: Credit Benchmark API
  description: |
    Authentication, entity resolution, data, analytics, and metadata endpoints.
  version: 1.0.0
  contact:
    name: Credit Benchmark API Support
    email: api-support@creditbenchmark.com
    url: https://creditbenchmark.com/support
  license:
    name: Proprietary
    url: https://creditbenchmark.com/terms
servers:
  - url: https://gateway.creditbenchmark.com
    description: Production gateway
security:
  - BearerAuth: []
tags:
  - name: authentication
    description: Token generation endpoints.
    x-group: Authentication
  - name: entity-resolution
    description: Entity name resolution endpoints.
    x-group: Entity Resolution
  - name: data
    description: Raw data extraction endpoints.
    x-group: Data
  - name: analytics
    description: Analytics endpoints.
    x-group: Analytics
  - name: metadata
    description: Metadata discovery endpoints.
    x-group: Metadata
paths:
  /analytics/v2/data/entityratingchange:
    post:
      tags:
        - analytics
      summary: Entity Rating Change
      description: >-
        Entity-level rating changes over a lookback window. Use to identify
        upgrades and downgrades across a portfolio.
      operationId: entityRatingChange
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EntityRatingChangeRequest'
            example:
              metric: CCR
              rating_scale: CB21
              effective_date: 20250930
              lookback_period: 6
              lookback_unit: months
              scope:
                portfolio:
                  CB_ID:
                    - CB0000022706
                    - CB0000022177
              result_filter:
                sort:
                  - field: CB_CCR_Change
                    direction: asc
                limit: 25
      responses:
        '200':
          description: Entity rating changes retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EntityRatingChangeResponse'
              example:
                CB_ID:
                  - CB0000075935
                  - CB0000035484
                CB_Legal_Name:
                  - VANGUARD MARKETING CORP
                  - NATIONAL BANK FINANCIAL INC
                CB_CCR:
                  - bbb-
                  - a-
                CB_CCR_6M:
                  - bbb
                  - a-
                CB_CCR_PD:
                  - 0.00322
                  - 0.00119
                CB_CCR_PD_6M:
                  - 0.00212
                  - 0.00119
                CB_CCR_Change:
                  - -1
                  - 0
                CB_CCR_PD_Change:
                  - 0.0011
                  - 0
                CB_CCR_Change_With_OCI:
                  - 0
                  - 0
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/FrameworkValidationError'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    EntityRatingChangeRequest:
      type: object
      required:
        - scope
      properties:
        metric:
          type: string
          enum:
            - CCR
            - MyRating
          default: CCR
          description: >-
            Metric to compute. Use `CCR` for consensus analytics or `MyRating`
            for client-specific analytics.
        rating_scale:
          type: string
          enum:
            - CB21
            - CB7
            - MyScale
          default: CB21
          description: >-
            Rating scale to map results onto. Use `CB21`, `CB7`, or `MyScale`
            for the requesting bank's master scale.
        effective_date:
          type: integer
          description: >-
            As-of date in YYYYMMDD format. If omitted, the latest available date
            is used.
        lookback_period:
          type: integer
          minimum: 0
          default: 6
          description: >-
            Number of `lookback_unit` intervals used for the rating-change
            window.
        lookback_unit:
          type: string
          enum:
            - months
            - quarters
            - years
          default: months
        scope:
          $ref: '#/components/schemas/Scope'
        result_filter:
          allOf:
            - $ref: '#/components/schemas/ResultFilter'
          description: >-
            Optional result shaping applied after rating-change rows are
            computed. This route accepts final response fields such as `CB_ID`,
            `CB_CCR_PD_Change`, and `ClientRating_Change`, and stable aliases
            such as `entity.*`, `metrics.*`, and `client.*` when those fields
            are present.
    EntityRatingChangeResponse:
      type: object
      description: Entity rating change results.
      properties:
        CB_ID:
          $ref: '#/components/schemas/StringArray'
        CB_Legal_Name:
          $ref: '#/components/schemas/StringArray'
        CB_CCR:
          $ref: '#/components/schemas/ColumnArray'
        CB_CCR_PD:
          $ref: '#/components/schemas/NumberArray'
        CB_CCR_Change:
          $ref: '#/components/schemas/NumberArray'
        CB_CCR_PD_Change:
          $ref: '#/components/schemas/NumberArray'
        CB_CCR_Change_With_OCI:
          $ref: '#/components/schemas/NumberArray'
        ClientRating:
          $ref: '#/components/schemas/ColumnArray'
        ClientPD:
          $ref: '#/components/schemas/NumberArray'
        client_change:
          $ref: '#/components/schemas/NumberArray'
        client_change_w_oci:
          $ref: '#/components/schemas/NumberArray'
      patternProperties:
        ^CB_CCR_\d+M$:
          $ref: '#/components/schemas/ColumnArray'
        ^CB_CCR_PD_\d+M$:
          $ref: '#/components/schemas/NumberArray'
        ^ClientRating_\d+M$:
          $ref: '#/components/schemas/ColumnArray'
        ^ClientPD_\d+M$:
          $ref: '#/components/schemas/NumberArray'
      additionalProperties:
        $ref: '#/components/schemas/ColumnArray'
    Scope:
      type: object
      additionalProperties: false
      description: Defines the input universe. Use `portfolio`, `filters`, or both.
      properties:
        portfolio:
          $ref: '#/components/schemas/ScopePortfolio'
        filters:
          type: array
          items:
            $ref: '#/components/schemas/ScopeFilter'
          description: >-
            Universe filters. Use them alone to build the universe from public
            columns, or with `portfolio` to subset the supplied portfolio. Only
            built-in scopeable columns are allowed in `filters[].key`; custom
            `scope.portfolio` columns are not valid scope filters.
        filters_join:
          type: array
          items:
            type: string
          description: >-
            Optional logic used to join `filters`. Only `&`, `|`, and `~` are
            supported. Length must be `len(filters)+1`.
    ResultFilter:
      type: object
      additionalProperties: false
      description: >-
        Filtering, sorting, and limiting applied after an analytic has computed
        its results. `filters[].key` and `sort.field` must reference supported
        result fields for the selected route. Some routes also accept documented
        alias names that map to returned fields.
      properties:
        limit:
          type: integer
          minimum: 1
          description: Return only the first N rows after `filters` and `sort` are applied.
        filters:
          type: array
          description: >-
            Filters applied to computed result rows. These do not change the
            analytic itself.
          items:
            $ref: '#/components/schemas/ResultFilterCondition'
        filters_join:
          type: array
          items:
            type: string
          description: >-
            Optional logic used to join `filters`. Length must be
            `len(filters)+1`. If omitted, conditions are AND-joined.
        sort:
          type: array
          items:
            $ref: '#/components/schemas/ResultFilterSort'
          description: Priority-ordered sort rules.
    StringArray:
      type: array
      items:
        type: string
    ColumnArray:
      type: array
      items:
        $ref: '#/components/schemas/ScalarValue'
    NumberArray:
      type: array
      items:
        type: number
    SimpleError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
    UnauthorizedError:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
    FastApiValidationErrorResponse:
      type: object
      required:
        - detail
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/FastApiValidationErrorDetail'
    RateLimitError:
      type: object
      required:
        - error
        - detail
      properties:
        error:
          type: string
        detail:
          type: string
    ScopePortfolio:
      type: object
      description: >-
        Explicit entity universe. `CB_ID` is required. Any extra keys are
        treated as custom portfolio columns.
      required:
        - CB_ID
      properties:
        CB_ID:
          type: array
          items:
            type: string
          description: List of Credit Benchmark entity identifiers.
      additionalProperties: true
    ScopeFilter:
      type: object
      additionalProperties: false
      required:
        - key
        - operator
      properties:
        key:
          type: string
          description: >-
            Public input column used to build or filter the universe. Only
            supported scopeable columns are allowed; see `/v2/metadata/columns`.
        operator:
          type: string
          enum:
            - '=='
            - '!='
            - '>'
            - <
            - '>='
            - <=
            - in
            - not in
            - is null
            - is not null
          description: Comparison operator.
        values:
          $ref: '#/components/schemas/FilterValue'
          description: >-
            Single value or list of values for the filter. Use an empty string
            for `is null` or `is not null`.
    ResultFilterCondition:
      type: object
      additionalProperties: false
      required:
        - key
        - operator
      properties:
        key:
          type: string
          description: >-
            Supported result field name to filter after the analytic has been
            computed. Valid values come from returned analytic fields or
            documented route aliases, not arbitrary source columns.
        operator:
          type: string
          enum:
            - '=='
            - '!='
            - '>'
            - <
            - '>='
            - <=
            - in
            - not in
            - contains
            - starts with
            - ends with
            - does not contain
            - does not start with
            - does not end with
            - is null
            - is not null
          description: Comparison operator.
        values:
          allOf:
            - $ref: '#/components/schemas/FilterValue'
          description: >-
            Single value or list of values for the filter. Not used for `is
            null` or `is not null`.
    ResultFilterSort:
      type: object
      additionalProperties: false
      required:
        - field
      properties:
        field:
          type: string
          description: >-
            Supported result field name to sort by for this route. Valid values
            come from returned analytic fields or documented route aliases, not
            arbitrary source columns.
        direction:
          type: string
          enum:
            - asc
            - desc
          default: desc
          description: Sort direction.
    ScalarValue:
      anyOf:
        - type: string
        - type: integer
        - type: number
        - type: boolean
        - type: 'null'
    FastApiValidationErrorDetail:
      type: object
      properties:
        loc:
          type: array
          items:
            oneOf:
              - type: string
              - type: integer
        msg:
          type: string
        type:
          type: string
    FilterValue:
      anyOf:
        - $ref: '#/components/schemas/ScalarValue'
        - $ref: '#/components/schemas/ColumnArray'
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SimpleError'
          example:
            error: >-
              Invalid request parameters: scope requires at least 'portfolio' or
              'filters'.
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthorizedError'
          example:
            detail: Unauthorized request
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SimpleError'
          example:
            error: Client-backed analytics inputs require contributor entitlement.
    FrameworkValidationError:
      description: Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/FastApiValidationErrorResponse'
          example:
            detail:
              - loc:
                  - body
                  - effective_date
                msg: Input should be a valid integer
                type: int_parsing
    TooManyRequests:
      description: Too many requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitError'
          example:
            error: Rate limit exceeded
            detail: 60 per 1 minute
    InternalServerError:
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SimpleError'
          example:
            error: >-
              An error occurred while processing your request. Please try again
              later.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT bearer token.

````