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

# Qscore Index

> Consulta el índice trimestral público de Qscore con buckets anónimos por país, industria y banda de riesgo.

export const EnvUrls = ({lang = "en"}) => {
  const T = {
    en: {
      test: "Test",
      live: "Live",
      hint: "Same API on both environments — build against test first, then go live by swapping the base URL and the key.",
      guide: "Environments and testing",
      href: "/en/environment-testing"
    },
    es: {
      test: "Test",
      live: "Live",
      hint: "La misma API en ambos ambientes — construye primero contra test y pasa a live cambiando la URL base y la key.",
      guide: "Entorno y pruebas",
      href: "/es/entorno-y-pruebas"
    },
    zh: {
      test: "Test",
      live: "Live",
      hint: "两个环境的 API 完全一致——先在 test 环境构建，再通过切换基础 URL 和密钥上线。",
      guide: "环境与测试",
      href: "/zh/environment-testing"
    }
  };
  const t = T[lang] || T.en;
  const row = (label, url, keyPattern, badgeCls) => <div className="flex flex-wrap items-center gap-2 px-3 py-2">
      <span className={"rounded px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide " + badgeCls}>
        {label}
      </span>
      <code className="text-xs">{url}</code>
      <span className="text-xs text-gray-400 dark:text-zinc-500">·</span>
      <code className="text-xs">{keyPattern}</code>
    </div>;
  return <div className="my-4 rounded-xl border border-gray-200 dark:border-zinc-700 divide-y divide-gray-200 dark:divide-zinc-700 text-sm not-prose">
      {row(t.test, "https://cryptobank.qbank.cl/platform", "pk_test_...", "bg-amber-100 text-amber-800 dark:bg-amber-900/40 dark:text-amber-300")}
      {row(t.live, "https://api.qbank.cl/platform", "pk_...", "bg-emerald-100 text-emerald-800 dark:bg-emerald-900/40 dark:text-emerald-300")}
      <p className="px-3 py-2 text-xs text-gray-500 dark:text-zinc-400 m-0">
        {t.hint} <a href={t.href}>{t.guide} →</a>
      </p>
    </div>;
};

<EnvUrls lang="es" />

Qscore Index es una vista pública y agregada de la distribución trimestral de
scores. Es informativa: no consulta personas ni empresas individuales. Nunca
expone RUT, IDs de cuenta ni poblaciones menores al mínimo estadístico.

```mermaid theme={"theme":{"light":"github-light","dark":"github-dark"}}
flowchart LR
    C[Tu sistema] --> I[GET /v1/qscore/index]
    I --> F[period + country + industry]
    F --> B[Buckets anónimos con mínimo 5 sujetos]
```

## Leer el índice

`GET /v1/qscore/index` es público y no exige credenciales. Si omites
`period`, usa el trimestre UTC cerrado más reciente. Filtros opcionales:

| Query           | Descripción                           |
| --------------- | ------------------------------------- |
| `period`        | Trimestre exacto `YYYY-Q1`…`YYYY-Q4`. |
| `country`       | Filtro de país ISO 3166-1 alpha-2.    |
| `industry_code` | Filtro de industria/ISIC.             |

```bash Índice público theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl "https://api.qbank.cl/platform/v1/qscore/index?period=2026-Q2&country=CL&industry_code=6499"
```

```json 200 OK theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"period":"2026-Q2","country":"CL","industry_code":"6499","items":[{"period":"2026-Q2","country":"CL","industry_code":"6499","band":"B","subject_count":12,"avg_score":742,"created_at":"2026-07-01T00:00:00Z"}],"methodology":"quarterly anonymous buckets; each bucket requires at least five subjects"}
```

Los `items` vienen ordenados por país, industria y banda. No hay paginación:
la respuesta es el snapshot filtrado.

## Estados de respuesta, metodología y privacidad

|                 HTTP | Significado                        | Acción                     |
| -------------------: | ---------------------------------- | -------------------------- |
|                `200` | Snapshot trimestral filtrado       | Lee los `items` anónimos   |
| `400 invalid_period` | Período mal formado o no soportado | Envía un `YYYY-Qn` cerrado |

Al cerrar cada trimestre se toma el último score de cada sujeto existente antes
del cierre. Se agrupa por país, industria y banda (`A`, `B`, `C`, `D`, `E` o
`SC`). Solo se publica un bucket con **al menos cinco sujetos**. `avg_score`
es el promedio entero redondeado del bucket.

El índice es append-only por período y bucket. No es un score vivo de una
persona o empresa y no permite drill-down individual.

Consulta el [catálogo de errores](/es/errores).

## Equivalente autenticado

`GET /v1/qscore/index/account` devuelve el mismo snapshot y filtros para una
cuenta o scope de lectura admin autenticado. Una cuenta requiere el servicio
`risk`; los scopes administrativos no dependen del flag de una cuenta.

El índice no cobra, no emite webhook y no envía email.

## Errores y FAQ

Un período inválido responde `400 invalid_period`; usa `YYYY-Q1` a `YYYY-Q4`
y años entre 2020 y 9999.

<AccordionGroup>
  <Accordion title="¿Puedo identificar a un sujeto?">
    No. Los buckets menores a cinco se omiten y nunca aparecen identificadores.
  </Accordion>

  <Accordion title="¿Sin período significa el trimestre actual?">
    No. Significa el último trimestre UTC cerrado.
  </Accordion>

  <Accordion title="¿Puedo filtrar una industria?">
    Sí, envía `industry_code` junto con `country` y `period`.
  </Accordion>
</AccordionGroup>
