---
title: "Custom Aggregate"
method: POST
path: "/api/analytics/custom-aggregate"
tags: ["Analytics"]
---

# Custom Aggregate

`POST /api/analytics/custom-aggregate`

## Request

- Base URL: `https://api.creditbenchmark.com`
- URL: `https://api.creditbenchmark.com/api/analytics/custom-aggregate`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/creditbenchmark/apis/credit-benchmark-api/docs/api/analytics/custom-aggregate/post.ts> (a function with typed inputs; its response is checked against the schema)

Return aggregate trend metrics.

## Request body

- RequestEnvelopeCustomAggregateRequest
  - `Parameters` CustomAggregateRequest, required
    - `portfolio` Portfolio, required
      - `name` string, required
      - `entities` FlexibleCBPortfolio, required
        - `CBId` string[]
    - `EffectiveDateId` integer
    - `effectivedateid_min_lag_months` integer
    - `use_client_scale` boolean
    - `facet_column` string: Optional column to group by (e.g., Sector, Industry)

## Response `200`

Custom aggregate calculation successful

- CustomAggregateResponse: Response containing facet values and aggregated metrics over time
  - `CBSector` string[], required: Values of the grouping column (matches facet_column parameter, e.g., CBSector)
  - `EffectiveDateId` integer[], required: Effective date identifiers
  - `EntityCount` integer[], required: Number of entities in each group
  - `CCRPD100Mid_log` number[], required: Log-transformed PD values
  - `CCRPD100Mid` number[], required: Aggregate probability of default (mid)
  - `CCRPD100Mid_index` number[], required: PD index value (relative to first date)
  - `CCR` string[], required: Aggregate credit ratings

## Other responses

- `400`: Bad request - invalid parameters
- `401`: Unauthorized - invalid or missing JWT token
- `403`: Forbidden - insufficient permissions or access denied
- `422`: Validation error - request parameters are invalid
- `500`: Internal server error

---

[API](https://skmtc.dev/creditbenchmark/apis/credit-benchmark-api.md) - [All operations](https://skmtc.dev/creditbenchmark/apis/credit-benchmark-api/llms.txt) - [OpenAPI document](https://skmtc.dev/creditbenchmark/apis/credit-benchmark-api/revisions/b357bbdb41e6?raw)
