> ## 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.

# API Payload Examples

> Copy-paste request bodies for common Credit Benchmark Analytics API queries, including filter join syntax and multi-dimension payload examples.

Use these as canonical payload shapes for common Analytics API requests. The most common request is a point-in-time `getdata` call for a known list of `CB_ID`s.

<AccordionGroup>
  <Accordion title="Get Data for CB IDs">
    For a list of known entities, use `scope.portfolio.CB_ID`. Set `lookback_period` to `0` for point-in-time data, and request only the columns you need.

    ```json theme={null}
    {
      "lookback_period": 0,
      "columns": [
        "CB_ID",
        "CB_Legal_Name",
        "CB_Effective_Date_ID",
        "CB_CCR",
        "CB_CCR_100_PDMid"
      ],
      "scope": {
        "portfolio": {
          "CB_ID": [
            "CB0000022706",
            "CB0000022177"
          ]
        }
      }
    }
    ```
  </Accordion>

  <Accordion title="Get Data for a Universe">
    Use `scope.filters` when you want the API to build the input universe **before the query runs**. This example returns United States entities with a rating of `bbb-` or worse.

    ```json theme={null}
    {
      "lookback_period": 0,
      "columns": [
        "CB_ID",
        "CB_Legal_Name",
        "CB_Effective_Date_ID",
        "CB_CCR",
        "CB_CCR_100_PDMid"
      ],
      "scope": {
        "filters": [
          {
            "key": "CB_Country",
            "operator": "==",
            "values": "United States"
          },
          {
            "key": "CB_CCR_21_Notch",
            "operator": ">=",
            "values": 8
          }
        ]
      }
    }
    ```
  </Accordion>

  <Accordion title="Get All Data">
    Use a broad `scope.filters` condition when you want all entities with a consensus rating.

    ```json theme={null}
    {
      "lookback_period": 0,
      "columns": [
        "CB_ID",
        "CB_Legal_Name",
        "CB_Effective_Date_ID",
        "CB_CCR",
        "CB_CCR_100_PDMid"
      ],
      "scope": {
        "filters": [
          {
            "key": "CB_CCR",
            "operator": "!=",
            "values": ""
          }
        ]
      }
    }
    ```
  </Accordion>

  <Accordion title="Result Filtering and Sorting">
    Use `result_filter` to filter or sort rows **after the data is selected**. This is separate from `scope.filters`, which defines the input universe **before the query runs**.

    ```json theme={null}
    {
      "lookback_period": 0,
      "columns": [
        "CB_ID",
        "CB_Legal_Name",
        "CB_Effective_Date_ID",
        "CB_CCR",
        "CB_CCR_100_PDMid"
      ],
      "scope": {
        "portfolio": {
          "CB_ID": [
            "CB0000022706",
            "CB0000022177"
          ]
        }
      },
      "result_filter": {
        "filters": [
          {
            "key": "CB_CCR_100_PDMid",
            "operator": ">",
            "values": 0.002
          }
        ],
        "sort": [
          {
            "field": "CB_CCR_100_PDMid",
            "direction": "asc"
          }
        ]
      }
    }
    ```
  </Accordion>

  <Accordion title="Filter Join Syntax">
    `filters_join` is optional. If you omit it, multiple filters are joined with AND.

    Only add `filters_join` when you need explicit boolean logic such as NOT, OR, or a mixed expression. When present, it is positional and must have one more item than `filters`.

    For a simple AND, omit `filters_join`.

    ```json theme={null}
    {
      "scope": {
        "filters": [
          {
            "key": "CB_Country",
            "operator": "==",
            "values": "United States"
          },
          {
            "key": "CB_CCR_21_Notch",
            "operator": ">=",
            "values": 8
          }
        ]
      }
    }
    ```

    For explicit OR, place `|` between the filters.

    ```json theme={null}
    {
      "scope": {
        "filters": [
          {
            "key": "CB_Country",
            "operator": "==",
            "values": "United States"
          },
          {
            "key": "CB_Sector",
            "operator": "!=",
            "values": "Insurance"
          }
        ],
        "filters_join": ["", "|", ""]
      }
    }
    ```

    <Tip>
      Use `scope.filters` to define the input universe before the analytic runs. Use `result_filter.filters` only to filter computed output rows after the analytic has already run.
    </Tip>
  </Accordion>
</AccordionGroup>
