{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pluggy/json-schema/pluggy-scr-response-schema.json",
  "title": "SCR",
  "description": "Bacen's SCR response, forwarded exactly as the Banco Central returns it — field names, codes and all. Nothing is renamed or normalised, so a value read here is the same value an institution reads at the source.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pluggy-scr-api-openapi.yml#/components/schemas/ScrResponse",
  "type": "object",
  "required": [
    "dtbConsult",
    "cdCli",
    "tpCli"
  ],
  "properties": {
    "dtbConsult": {
      "type": "string",
      "description": "The base dates consulted"
    },
    "cdCli": {
      "type": "string",
      "description": "The consulted document: the CPF for an individual, or the 8-digit CNPJ root for a company"
    },
    "tpCli": {
      "type": "string",
      "enum": [
        "1",
        "2"
      ],
      "description": "Type of client: \"1\" for an individual, \"2\" for a legal entity"
    },
    "lsDtb": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ScrDatabase"
      },
      "description": "One entry per consulted base date. A base date with no data for the client is still listed, with no operations"
    },
    "listaDeMensagensDeValidacao": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ScrValidationMessage"
      },
      "description": "Validation messages raised by Bacen for this request"
    }
  },
  "$defs": {
    "ScrAdditionalInfo": {
      "title": "SCR Additional Info",
      "type": "object",
      "properties": {
        "tp": {
          "type": "string",
          "description": "Type of the complementary information"
        },
        "cd": {
          "type": "string",
          "description": "Code of the complementary information"
        },
        "qtd": {
          "type": "number",
          "description": "Number of operations grouped under this entry"
        }
      }
    },
    "ScrDatabase": {
      "title": "SCR Base Date",
      "type": "object",
      "description": "One consulted base date, and what the SCR holds for the client in it",
      "properties": {
        "dtb": {
          "type": "number",
          "description": "The base date, as YYYYMM. Numeric, not a string"
        },
        "msg": {
          "type": "string",
          "description": "Bacen's message for this base date, when it has one — for example that the base date is not available for consultation"
        },
        "docProc": {
          "type": "string",
          "description": "Percentage of the expected 3040 documents already incorporated by Bacen for this base date. A low value means the picture is still partial"
        },
        "volProc": {
          "type": "string",
          "description": "Percentage of the expected operation volume already accepted for this base date"
        },
        "qtdIfs": {
          "type": "number",
          "description": "Number of financial institutions where the client has operations"
        },
        "qtdCongFinc": {
          "type": "number",
          "description": "Number of financial conglomerates where the client has operations"
        },
        "dtbIniRel": {
          "type": "string",
          "description": "Start of the client's relationship with the national financial system"
        },
        "coobAss": {
          "type": "number",
          "description": "Co-obligation assumed by the client in credit assignments, in BRL"
        },
        "coobRec": {
          "type": "number",
          "description": "Co-obligation received in credit assignments, in BRL"
        },
        "lsOp": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScrOperation"
          },
          "description": "Operation groups reported for this base date"
        }
      }
    },
    "ScrGuarantee": {
      "title": "SCR Guarantee",
      "type": "object",
      "properties": {
        "tp": {
          "type": "string",
          "description": "Bacen's code for the guarantee type"
        },
        "qtd": {
          "type": "number",
          "description": "Number of operations grouped under this type"
        }
      }
    },
    "ScrMaturityBalances": {
      "title": "SCR Maturity Balances",
      "type": "object",
      "description": "Balance of the operation group split across Bacen's maturity vertices, in BRL. Each key is a vertex code and belongs to one of three families: amounts not yet due (a payment up to 14 days late still counts here), amounts overdue graded by how old the delay is, and a few categories that are not time windows at all. The window behind each individual code is defined by Bacen's DOC3040 reference — read it there rather than inferring it from the number. Only the vertices that carry a value are present.",
      "properties": {
        "v20": {
          "type": "number"
        },
        "v40": {
          "type": "number"
        },
        "v60": {
          "type": "number"
        },
        "v80": {
          "type": "number"
        },
        "v110": {
          "type": "number"
        },
        "v120": {
          "type": "number"
        },
        "v130": {
          "type": "number"
        },
        "v140": {
          "type": "number"
        },
        "v150": {
          "type": "number"
        },
        "v160": {
          "type": "number"
        },
        "v165": {
          "type": "number"
        },
        "v170": {
          "type": "number"
        },
        "v175": {
          "type": "number"
        },
        "v180": {
          "type": "number"
        },
        "v190": {
          "type": "number"
        },
        "v199": {
          "type": "number"
        },
        "v205": {
          "type": "number"
        },
        "v210": {
          "type": "number"
        },
        "v220": {
          "type": "number"
        },
        "v230": {
          "type": "number"
        },
        "v240": {
          "type": "number"
        },
        "v245": {
          "type": "number"
        },
        "v250": {
          "type": "number"
        },
        "v255": {
          "type": "number"
        },
        "v260": {
          "type": "number"
        },
        "v270": {
          "type": "number"
        },
        "v280": {
          "type": "number"
        },
        "v290": {
          "type": "number"
        },
        "v310": {
          "type": "number"
        },
        "v320": {
          "type": "number"
        }
      }
    },
    "ScrOperation": {
      "title": "SCR Operation",
      "type": "object",
      "description": "A group of credit operations. The SCR does not return contracts one by one: it aggregates them by the combination of modality, source of funds, index and exchange variation.",
      "properties": {
        "mod": {
          "type": "string",
          "description": "Bacen's code for the operation modality"
        },
        "oriRec": {
          "type": "string",
          "description": "Bacen's code for the source of funds"
        },
        "indx": {
          "type": "string",
          "description": "Bacen's code for the reference rate or index"
        },
        "varCamb": {
          "type": "string",
          "description": "Bacen's code for the exchange rate variation"
        },
        "subJDisc": {
          "type": "string",
          "description": "Present when the operation is under dispute: \"D\" for disagreement, \"J\" for sub judice, \"JD\" for both"
        },
        "resVenc": {
          "$ref": "#/$defs/ScrMaturityBalances"
        },
        "lsGar": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScrGuarantee"
          },
          "description": "Guarantees backing the operations in this group"
        },
        "lsInfAd": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScrAdditionalInfo"
          },
          "description": "Complementary information reported for this group"
        }
      }
    },
    "ScrValidationMessage": {
      "title": "SCR Validation Message",
      "type": "object",
      "properties": {
        "codigo": {
          "type": "string"
        },
        "mensagem": {
          "type": "string"
        }
      }
    }
  }
}